[file-roller] set a fixed title for the progress dialog



commit fd497f4f9db806ce97f68d0366ae1f7fd37eccd1
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Jun 17 11:55:02 2012 +0200

    set a fixed title for the progress dialog

 src/fr-window.c |   22 ++++++++++++++++------
 src/fr-window.h |    3 ++-
 src/main.c      |    4 ++--
 src/server.c    |    8 ++++----
 4 files changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/src/fr-window.c b/src/fr-window.c
index edccebd..23ca246 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -384,6 +384,7 @@ struct _FrWindowPrivateData {
 					 	* mode. */
 	GList            *batch_action_list;   /* FRBatchAction * elements */
 	GList            *batch_action;        /* current action. */
+	char             *batch_title;
 
 	/* misc */
 
@@ -425,6 +426,9 @@ fr_window_free_batch_data (FrWindow *window)
 	g_list_free (window->priv->batch_action_list);
 	window->priv->batch_action_list = NULL;
 	window->priv->batch_action = NULL;
+
+	g_free (window->priv->batch_title);
+	window->priv->batch_title = NULL;
 }
 
 
@@ -795,6 +799,7 @@ fr_window_init (FrWindow *window)
 	window->priv->update_dropped_files = FALSE;
 	window->priv->filter_mode = FALSE;
 	window->priv->use_progress_dialog = TRUE;
+	window->priv->batch_title = NULL;
 
 	g_signal_connect (window,
 			  "realize",
@@ -2350,7 +2355,6 @@ progress_dialog__set_last_action (FrWindow *window,
 
 	window->priv->pd_last_action = action;
 	title = get_message_from_action (window->priv->pd_last_action);
-	gtk_window_set_title (GTK_WINDOW (window->priv->progress_dialog), title);
 	markup = g_markup_printf_escaped ("<span weight=\"bold\" size=\"larger\">%s</span>", title);
 	gtk_label_set_markup (GTK_LABEL (window->priv->pd_action), markup);
 	g_free (markup);
@@ -2480,7 +2484,6 @@ create_the_progress_dialog (FrWindow *window)
 	GtkWidget      *align;
 	GtkWidget      *progress_vbox;
 	GtkWidget      *lbl;
-	const char     *title;
 	char           *markup;
 	PangoAttrList  *attr_list;
 	GdkPixbuf      *icon;
@@ -2498,8 +2501,7 @@ create_the_progress_dialog (FrWindow *window)
 	}
 
 	window->priv->pd_last_action = window->priv->action;
-	title = get_message_from_action (window->priv->pd_last_action);
-	window->priv->progress_dialog = gtk_dialog_new_with_buttons (title,
+	window->priv->progress_dialog = gtk_dialog_new_with_buttons ((window->priv->batch_mode ? window->priv->batch_title : NULL),
 								     parent,
 								     flags,
 								     NULL);
@@ -2535,7 +2537,8 @@ create_the_progress_dialog (FrWindow *window)
 
 	lbl = window->priv->pd_action = gtk_label_new ("");
 
-	markup = g_markup_printf_escaped ("<span weight=\"bold\" size=\"larger\">%s</span>", title);
+	markup = g_markup_printf_escaped ("<span weight=\"bold\" size=\"larger\">%s</span>",
+					  get_message_from_action (window->priv->pd_last_action));
 	gtk_label_set_markup (GTK_LABEL (lbl), markup);
 	g_free (markup);
 
@@ -8966,6 +8969,10 @@ fr_window_start_batch (FrWindow *window)
 	if (window->priv->batch_action_list == NULL)
 		return;
 
+	if (window->priv->progress_dialog != NULL)
+		gtk_window_set_title (GTK_WINDOW (window->priv->progress_dialog),
+				      window->priv->batch_title);
+
 	window->priv->batch_mode = TRUE;
 	window->priv->batch_action = window->priv->batch_action_list;
 	window->archive->can_create_compressed_file = window->priv->batch_adding_one_file;
@@ -9013,10 +9020,13 @@ fr_window_is_batch_mode (FrWindow *window)
 
 
 void
-fr_window_new_batch (FrWindow *window)
+fr_window_new_batch (FrWindow   *window,
+		     const char *title)
 {
 	fr_window_free_batch_data (window);
 	window->priv->non_interactive = TRUE;
+	g_free (window->priv->batch_title);
+	window->priv->batch_title = g_strdup (title);
 }
 
 
diff --git a/src/fr-window.h b/src/fr-window.h
index 290643f..884b1d9 100644
--- a/src/fr-window.h
+++ b/src/fr-window.h
@@ -283,7 +283,8 @@ void        fr_window_use_progress_dialog         (FrWindow   *window,
 
 /* batch mode procedures. */
 
-void       fr_window_new_batch                    (FrWindow      *window);
+void       fr_window_new_batch                    (FrWindow      *window,
+						   const char    *title);
 void       fr_window_set_current_batch_action     (FrWindow      *window,
 						   FrBatchActionType  action,
 						   void          *data,
diff --git a/src/main.c b/src/main.c
index 2a194a2..0588d31 100644
--- a/src/main.c
+++ b/src/main.c
@@ -165,7 +165,7 @@ prepare_app (void)
 			file_list = g_list_prepend (file_list, get_uri_from_command_line (filename));
 		file_list = g_list_reverse (file_list);
 
-		fr_window_new_batch (FR_WINDOW (window));
+		fr_window_new_batch (FR_WINDOW (window), _("Compress"));
 		fr_window_set_batch__add (FR_WINDOW (window), add_to_uri, file_list);
 		fr_window_append_batch_action (FR_WINDOW (window),
 					       FR_BATCH_ACTION_QUIT,
@@ -185,7 +185,7 @@ prepare_app (void)
 		if (default_url != NULL)
 			fr_window_set_default_dir (FR_WINDOW (window), default_url, TRUE);
 
-		fr_window_new_batch (FR_WINDOW (window));
+		fr_window_new_batch (FR_WINDOW (window), _("Extract archive"));
 		while ((archive = remaining_args[i++]) != NULL) {
 			char *archive_uri;
 
diff --git a/src/server.c b/src/server.c
index 9fa7ead..1ada414 100644
--- a/src/server.c
+++ b/src/server.c
@@ -293,7 +293,7 @@ handle_method_call (GDBusConnection       *connection,
 		g_signal_connect (window, "progress", G_CALLBACK (window_progress_cb), connection);
 		g_signal_connect (window, "ready", G_CALLBACK (window_ready_cb), invocation);
 
-		fr_window_new_batch (FR_WINDOW (window));
+		fr_window_new_batch (FR_WINDOW (window), _("Compress"));
 		fr_window_set_batch__add (FR_WINDOW (window), archive, file_list);
 		fr_window_append_batch_action (FR_WINDOW (window), FR_BATCH_ACTION_QUIT, NULL, NULL);
 		fr_window_start_batch (FR_WINDOW (window));
@@ -326,7 +326,7 @@ handle_method_call (GDBusConnection       *connection,
 		g_signal_connect (window, "progress", G_CALLBACK (window_progress_cb), connection);
 		g_signal_connect (window, "ready", G_CALLBACK (window_ready_cb), invocation);
 
-		fr_window_new_batch (FR_WINDOW (window));
+		fr_window_new_batch (FR_WINDOW (window), _("Extract archive"));
 		fr_window_set_batch__add (FR_WINDOW (window), NULL, file_list);
 		fr_window_append_batch_action (FR_WINDOW (window), FR_BATCH_ACTION_QUIT, NULL, NULL);
 		fr_window_start_batch (FR_WINDOW (window));
@@ -351,7 +351,7 @@ handle_method_call (GDBusConnection       *connection,
 		g_signal_connect (window, "progress", G_CALLBACK (window_progress_cb), connection);
 		g_signal_connect (window, "ready", G_CALLBACK (window_ready_cb), invocation);
 
-		fr_window_new_batch (FR_WINDOW (window));
+		fr_window_new_batch (FR_WINDOW (window), _("Extract archive"));
 		fr_window_set_batch__extract (FR_WINDOW (window), archive, destination);
 		fr_window_append_batch_action (FR_WINDOW (window), FR_BATCH_ACTION_QUIT, NULL, NULL);
 		fr_window_start_batch (FR_WINDOW (window));
@@ -374,7 +374,7 @@ handle_method_call (GDBusConnection       *connection,
 		g_signal_connect (window, "progress", G_CALLBACK (window_progress_cb), connection);
 		g_signal_connect (window, "ready", G_CALLBACK (window_ready_cb), invocation);
 
-		fr_window_new_batch (FR_WINDOW (window));
+		fr_window_new_batch (FR_WINDOW (window), _("Extract archive"));
 		fr_window_set_batch__extract_here (FR_WINDOW (window), archive);
 		fr_window_append_batch_action (FR_WINDOW (window), FR_BATCH_ACTION_QUIT, NULL, NULL);
 		fr_window_start_batch (FR_WINDOW (window));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]