From 0a28a308b3983b75e2e0d02e54647d8c628d5b02 Mon Sep 17 00:00:00 2001 From: Jonathan Blandford Date: Fri, 19 Mar 1999 17:13:33 +0000 Subject: [PATCH] 1999-03-19 Jonathan Blandford * gcmd.c (dentry_apply_callback): new function. (gnome_new_launcher): We can now create new 1999-03-19 Jonathan Blandford * file.c (panel_operate): Ugly hack for GNOME. We only treat the copy as if it were many files, and skip the only_one branch. --- gnome/ChangeLog | 5 +++++ gnome/gcmd.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ gnome/gcmd.h | 1 + gnome/gdesktop.c | 3 +-- gnome/gdesktop.h | 3 +++ gnome/gdialogs.c | 13 +++++------- src/ChangeLog | 4 ++++ src/file.c | 8 +++++--- 8 files changed, 77 insertions(+), 13 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 82feb8cb1..1e3022770 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,8 @@ +1999-03-19 Jonathan Blandford + + * gcmd.c (dentry_apply_callback): new function. + (gnome_new_launcher): We can now create new + 1999-03-19 Miguel de Icaza * gpopup2.c (create_mime_actions): Free full_name, just once, not diff --git a/gnome/gcmd.c b/gnome/gcmd.c index 76c2b2174..c781cb27c 100644 --- a/gnome/gcmd.c +++ b/gnome/gcmd.c @@ -22,6 +22,7 @@ #include "gcmd.h" #include "dialog.h" #include "layout.h" +#include "gdesktop.h" #include "../vfs/vfs.h" enum { @@ -753,4 +754,56 @@ gnome_mkdir_cmd (GtkWidget *widget, WPanel *panel) { mkdir_cmd (panel); } +static void +dentry_apply_callback(GtkWidget *widget, int page, gpointer data) +{ + GnomeDesktopEntry *dentry; + gchar *desktop_directory; + if (page != -1) + return; + + g_return_if_fail(data!=NULL); + g_return_if_fail(GNOME_IS_DENTRY_EDIT(data)); + dentry = gnome_dentry_get_dentry(GNOME_DENTRY_EDIT(data)); + + if (getenv ("GNOME_DESKTOP_DIR") != NULL) + desktop_directory = g_strconcat (getenv ("GNOME_DESKTOP_DIR"), + "/", + dentry->name, ".desktop", + NULL); + else + desktop_directory = g_strconcat (gnome_user_home_dir, "/", + DESKTOP_DIR_NAME, "/", + dentry->name, ".desktop", + NULL); + + dentry->location = desktop_directory; + gnome_desktop_entry_save(dentry); + gnome_desktop_entry_free(dentry); + gnome_config_sync (); + desktop_reload_icons (FALSE, 0, 0); + +} + +void +gnome_new_launcher (GtkWidget *widget, WPanel *panel) +{ + GtkWidget *dialog; + GtkObject *dentry; + + dialog = gnome_property_box_new (); + gtk_window_set_title(GTK_WINDOW(dialog), _("Desktop entry properties")); + gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, TRUE); + dentry = gnome_dentry_edit_new_notebook(GTK_NOTEBOOK(GNOME_PROPERTY_BOX(dialog)->notebook)); + gtk_signal_connect_object(GTK_OBJECT(dentry), "changed", + GTK_SIGNAL_FUNC(gnome_property_box_changed), + GTK_OBJECT(dialog)); + + gtk_signal_connect(GTK_OBJECT(dialog), "apply", + GTK_SIGNAL_FUNC(dentry_apply_callback), + dentry); + gtk_widget_show(dialog); + + +} diff --git a/gnome/gcmd.h b/gnome/gcmd.h index b58324d0e..c1d3d8f10 100644 --- a/gnome/gcmd.h +++ b/gnome/gcmd.h @@ -22,6 +22,7 @@ void gnome_external_panelize (GtkWidget *widget, WPanel *panel); void gnome_open_files (GtkWidget *widget, WPanel *panel); void gnome_run_new (GtkWidget *widget, GnomeDesktopEntry *gde); void gnome_mkdir_cmd (GtkWidget *widget, WPanel *panel); +void gnome_new_launcher (GtkWidget *widget, WPanel *panel); void gnome_reverse_selection_cmd_panel (WPanel *panel); #endif /* __GCMD_H */ diff --git a/gnome/gdesktop.c b/gnome/gdesktop.c index 3cc6c1bb3..cd236a964 100644 --- a/gnome/gdesktop.c +++ b/gnome/gdesktop.c @@ -32,8 +32,6 @@ #include "../vfs/vfs.h" #include "main.h" -/* Name of the user's desktop directory (i.e. ~/desktop) */ -#define DESKTOP_DIR_NAME ".gnome-desktop" struct layout_slot { @@ -2400,6 +2398,7 @@ static GnomeUIInfo gnome_panel_new_menu [] = { GNOMEUIINFO_ITEM_NONE(N_("_Terminal"), N_("Launch a new terminal in the current directory"), gnome_open_terminal), /* If this ever changes, make sure you update create_new_menu accordingly. */ GNOMEUIINFO_ITEM_NONE( N_("_Directory..."), N_("Creates a new directory"), gnome_mkdir_cmd ), + GNOMEUIINFO_ITEM_NONE( N_("_Launcher..."), N_("Creates a new launcher"), gnome_new_launcher ), GNOMEUIINFO_END }; diff --git a/gnome/gdesktop.h b/gnome/gdesktop.h index 04830e6cc..f224ad026 100644 --- a/gnome/gdesktop.h +++ b/gnome/gdesktop.h @@ -18,6 +18,9 @@ #define DESKTOP_SNAP_X 80 #define DESKTOP_SNAP_Y 80 +/* Name of the user's desktop directory (i.e. ~/desktop) */ +#define DESKTOP_DIR_NAME ".gnome-desktop" + /* Configuration options for the desktop */ diff --git a/gnome/gdialogs.c b/gnome/gdialogs.c index e90c14884..70a27f17a 100644 --- a/gnome/gdialogs.c +++ b/gnome/gdialogs.c @@ -242,12 +242,9 @@ file_progress_show (FileOpContext *ctx, long done, long total) if (total > 0) { perc = (double) done / (double) total; - snprintf (count, 9, "%d%%", (gint) (100.0 * perc)); + snprintf (count, 9, "%3d%% ", (gint) (100.0 * perc)); gtk_label_set_text (GTK_LABEL (ui->file_label), count); - gtk_progress_bar_update (GTK_PROGRESS_BAR (ui->byte_prog), perc); - } else - gtk_progress_bar_update (GTK_PROGRESS_BAR (ui->byte_prog), 0.0); - + } while (gtk_events_pending ()) gtk_main_iteration (); return FILE_CONT; @@ -270,7 +267,7 @@ file_progress_show_count (FileOpContext *ctx, long done, long total) if (ui->aborting) return FILE_ABORT; - snprintf (count, 13, "%d/%d", done, total); + snprintf (count, 13, "%d/%d ", done, total); gtk_label_set_text (GTK_LABEL (ui->count_label), count); while (gtk_events_pending ()) gtk_main_iteration (); @@ -893,10 +890,10 @@ file_op_context_create_ui (FileOpContext *ctx, FileOperation op, int with_eta) ui->count_label = GTK_OBJECT (gtk_label_new ("")); gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (ui->count_label), FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_(" is ")), FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("is ")), FALSE, FALSE, 0); ui->file_label = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (hbox), ui->file_label, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_(" Done.")), FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (_("done.")), FALSE, FALSE, 0); gtk_container_add (GTK_CONTAINER (alignment), hbox); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (ui->op_win)->vbox), diff --git a/src/ChangeLog b/src/ChangeLog index c6b732d29..f4d594e75 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +1999-03-19 Jonathan Blandford + + * file.c (panel_operate): Ugly hack for GNOME. We only treat the + copy as if it were many files, and skip the only_one branch. 1999-03-18 Miguel de Icaza * utilunix.c (close_error_pipe): Inform parent of the return value diff --git a/src/file.c b/src/file.c index 15fbf27c8..c9649ef8f 100644 --- a/src/file.c +++ b/src/file.c @@ -765,7 +765,7 @@ copy_file_file (FileOpContext *ctx, char *src_path, char *dst_path, int ask_over } file_progress_set_stalled_label (ctx, stalled_msg); - + file_progress_show_bytes (ctx, *progress_bytes + n_read_total, ctx->progress_bytes); return_status = file_progress_show (ctx, n_read_total, file_size); mc_refresh (); if (return_status != FILE_CONT) @@ -1942,6 +1942,7 @@ panel_operate (void *source_panel, FileOperation operation, char *thedefault, in file_op_context_create_ui (ctx, operation, 1); /* This code is only called by the tree and panel code */ +#ifndef HAVE_GNOME if (only_one){ /* We now have ETA in all cases */ @@ -2002,7 +2003,7 @@ panel_operate (void *source_panel, FileOperation operation, char *thedefault, in unmark_files (panel); } else { /* Many files */ - +#endif /* Check destination for copy or move operation */ if (operation != OP_DELETE){ retry_many_dst_stat: @@ -2107,8 +2108,9 @@ panel_operate (void *source_panel, FileOperation operation, char *thedefault, in mc_refresh (); } /* Loop for every file */ +#ifndef HAVE_GNOME } /* Many files */ - +#endif clean_up: /* Clean up */