[eog: 1/2] Make pressing Ctrl+Q close all windows.
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog: 1/2] Make pressing Ctrl+Q close all windows.
- Date: Sat, 8 Aug 2020 10:49:32 +0000 (UTC)
commit 12ed97fdcca9c42b31a0419aff795a5731d4eb81
Author: Martin van Zijl <martin vanzijl gmail com>
Date: Tue Aug 4 07:33:11 2020 +1200
Make pressing Ctrl+Q close all windows.
Fixes #138.
src/eog-application.c | 13 +++++++++++++
src/eog-application.h | 2 ++
src/eog-window.c | 12 ++++++++++++
3 files changed, 27 insertions(+)
---
diff --git a/src/eog-application.c b/src/eog-application.c
index a464e4e42..69a5c0605 100644
--- a/src/eog-application.c
+++ b/src/eog-application.c
@@ -206,6 +206,7 @@ eog_application_init_accelerators (GtkApplication *application)
"win.save", "<Ctrl>s", NULL ,
"win.save-as", "<Ctrl><shift>s", NULL,
"win.close", "<Ctrl>w", NULL,
+ "win.close-all", "<Ctrl>q", NULL,
"win.print", "<Ctrl>p", NULL,
"win.properties", "<Alt>Return", NULL,
"win.set-wallpaper", "<Ctrl>F8", NULL,
@@ -728,6 +729,18 @@ eog_application_open_uris (EogApplication *application,
flags, error);
}
+gboolean
+eog_application_close_all_windows (EogApplication *application)
+{
+ GList *windows;
+
+ windows = gtk_application_get_windows (GTK_APPLICATION (application));
+
+ g_list_foreach (windows, (GFunc) eog_window_close, NULL);
+
+ return TRUE;
+}
+
static void
eog_application_load_accelerators (void)
{
diff --git a/src/eog-application.h b/src/eog-application.h
index 55b32ccf2..d8009f93c 100644
--- a/src/eog-application.h
+++ b/src/eog-application.h
@@ -84,6 +84,8 @@ gboolean eog_application_open_uris (EogApplication *applicati
EogStartupFlags flags,
GError **error);
+gboolean eog_application_close_all_windows (EogApplication *application);
+
G_END_DECLS
#endif /* __EOG_APPLICATION_H__ */
diff --git a/src/eog-window.c b/src/eog-window.c
index 885de04af..9a3da25c9 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -610,6 +610,7 @@ _eog_window_enable_window_actions (EogWindow *window, gboolean enable)
static const gchar *window_actions[] = {
"open",
"close",
+ "close-all",
"preferences",
"manual",
"about",
@@ -2461,6 +2462,16 @@ eog_window_action_close_window (GSimpleAction *action,
eog_window_close (EOG_WINDOW (user_data));
}
+static void
+eog_window_action_close_all_windows (GSimpleAction *action,
+ GVariant *variant,
+ gpointer user_data)
+{
+ g_return_if_fail (EOG_IS_WINDOW (user_data));
+
+ eog_application_close_all_windows (EOG_APP);
+}
+
static void
eog_window_action_preferences (GSimpleAction *action,
GVariant *variant,
@@ -3957,6 +3968,7 @@ static const GActionEntry window_actions[] = {
{ "save", eog_window_action_save },
{ "save-as", eog_window_action_save_as },
{ "close", eog_window_action_close_window },
+ { "close-all", eog_window_action_close_all_windows },
{ "print", eog_window_action_print },
{ "properties", eog_window_action_properties },
{ "set-wallpaper", eog_window_action_wallpaper },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]