[gthumb] Added Ctrl+Q to close all windows



commit 364cbdd71b088b32b48a4ff7f8dabc544efc7727
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Jul 15 11:33:50 2011 +0200

    Added Ctrl+Q to close all windows
    
    [bug #654496, new feature]

 gthumb/dlg-preferences-extensions.c   |    2 +-
 gthumb/gth-browser-ui.h               |    1 +
 gthumb/gth-window-actions-callbacks.c |   10 ++++++++++
 gthumb/gth-window-actions-callbacks.h |    1 +
 gthumb/gth-window-actions-entries.h   |    7 ++++++-
 gthumb/main.c                         |    8 ++++----
 gthumb/main.h                         |    2 +-
 7 files changed, 24 insertions(+), 7 deletions(-)
---
diff --git a/gthumb/dlg-preferences-extensions.c b/gthumb/dlg-preferences-extensions.c
index 01124f8..2df17cd 100644
--- a/gthumb/dlg-preferences-extensions.c
+++ b/gthumb/dlg-preferences-extensions.c
@@ -823,7 +823,7 @@ extensions__dlg_preferences_apply (GtkWidget  *dialog,
 		gtk_widget_destroy (dialog);
 
 		if (response == GTK_RESPONSE_OK)
-			gth_restart ();
+			gth_quit (TRUE);
 	}
 
 	g_slist_foreach (active_extensions, (GFunc) g_free, NULL);
diff --git a/gthumb/gth-browser-ui.h b/gthumb/gth-browser-ui.h
index ba035dd..0c00e0f 100644
--- a/gthumb/gth-browser-ui.h
+++ b/gthumb/gth-browser-ui.h
@@ -50,6 +50,7 @@ static const char *fixed_ui_info =
 "      </menu>"
 "      <placeholder name='Misc_Actions'/>"
 "      <separator/>"
+"      <menuitem action='File_Quit'/>"
 "      <menuitem action='File_CloseWindow'/>"
 "    </menu>"
 "    <menu name='Edit' action='EditMenu'>"
diff --git a/gthumb/gth-window-actions-callbacks.c b/gthumb/gth-window-actions-callbacks.c
index f4ae477..92851c5 100644
--- a/gthumb/gth-window-actions-callbacks.c
+++ b/gthumb/gth-window-actions-callbacks.c
@@ -21,6 +21,8 @@
 
 #include <config.h>
 #include "gth-window.h"
+#include "main.h"
+
 
 void
 gth_window_activate_action_file_close_window (GtkAction *action,
@@ -28,3 +30,11 @@ gth_window_activate_action_file_close_window (GtkAction *action,
 {
 	gth_window_close ((GthWindow*)data);
 }
+
+
+void
+gth_window_activate_action_file_quit_application (GtkAction *action,
+						  gpointer   data)
+{
+	gth_quit (FALSE);
+}
diff --git a/gthumb/gth-window-actions-callbacks.h b/gthumb/gth-window-actions-callbacks.h
index 8f83c74..ffb790e 100644
--- a/gthumb/gth-window-actions-callbacks.h
+++ b/gthumb/gth-window-actions-callbacks.h
@@ -27,5 +27,6 @@
 #define DEFINE_ACTION(x) void x (GtkAction *action, gpointer data);
 
 DEFINE_ACTION(gth_window_activate_action_file_close_window)
+DEFINE_ACTION(gth_window_activate_action_file_quit_application)
 
 #endif /* GTH_WINDOW_ACTIONS_CALLBACK_H */
diff --git a/gthumb/gth-window-actions-entries.h b/gthumb/gth-window-actions-entries.h
index ec56857..1ee3d30 100644
--- a/gthumb/gth-window-actions-entries.h
+++ b/gthumb/gth-window-actions-entries.h
@@ -30,7 +30,12 @@ static GtkActionEntry gth_window_action_entries[] = {
 	{ "File_CloseWindow", GTK_STOCK_CLOSE,
 	  NULL, NULL,
 	  N_("Close this window"),
-	  G_CALLBACK (gth_window_activate_action_file_close_window) }
+	  G_CALLBACK (gth_window_activate_action_file_close_window) },
+
+	{ "File_Quit", GTK_STOCK_QUIT,
+	  N_("Close _All Windows"), NULL,
+	  NULL,
+	  G_CALLBACK (gth_window_activate_action_file_quit_application) }
 };
 static guint gth_window_action_entries_size = G_N_ELEMENTS (gth_window_action_entries);
 
diff --git a/gthumb/main.c b/gthumb/main.c
index 1c647b4..93c2d55 100644
--- a/gthumb/main.c
+++ b/gthumb/main.c
@@ -63,7 +63,7 @@ static UniqueApp   *gthumb_app;
 #endif
 static char       **remaining_args;
 static const char  *program_argv0; /* argv[0] from main(); used as the command to restart the program */
-static gboolean     restart = FALSE;
+static gboolean     Restart = FALSE;
 static gboolean     version = FALSE;
 
 
@@ -579,7 +579,7 @@ main (int argc, char *argv[])
 	gth_main_release ();
 	gth_pref_release ();
 
-	if (restart)
+	if (Restart)
 		g_spawn_command_line_async (program_argv0, NULL);
 
 	return 0;
@@ -587,7 +587,7 @@ main (int argc, char *argv[])
 
 
 void
-gth_restart (void)
+gth_quit (gboolean restart)
 {
 	GList *windows;
 	GList *scan;
@@ -597,5 +597,5 @@ gth_restart (void)
 		gth_window_close (GTH_WINDOW (scan->data));
 	g_list_free (windows);
 
-	restart = TRUE;
+	Restart = restart;
 }
diff --git a/gthumb/main.h b/gthumb/main.h
index 9f4a211..68067ea 100644
--- a/gthumb/main.h
+++ b/gthumb/main.h
@@ -33,7 +33,7 @@ extern gboolean ImportPhotos;
 extern int ClutterInitResult;
 #endif
 
-void gth_restart (void);
+void gth_quit (gboolean restart);
 
 G_END_DECLS
 



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