|
|
a21e2b |
From fdaa448ae9bedd07356d5c8337b698f23c61f1fe Mon Sep 17 00:00:00 2001
|
|
|
a21e2b |
From: Christian Persch <chpe@gnome.org>
|
|
|
a21e2b |
Date: Thu, 20 Jun 2013 22:17:45 +0200
|
|
|
a21e2b |
Subject: [PATCH] appmenu: Add Quit item
|
|
|
a21e2b |
|
|
|
a21e2b |
https://bugzilla.gnome.org/show_bug.cgi?id=690910
|
|
|
a21e2b |
---
|
|
|
a21e2b |
src/terminal-app.c | 18 +++++++++++++++++-
|
|
|
a21e2b |
src/terminal-appmenu.ui | 4 ++++
|
|
|
a21e2b |
src/terminal-window.c | 16 ++++++++++++----
|
|
|
a21e2b |
src/terminal-window.h | 2 ++
|
|
|
a21e2b |
4 files changed, 35 insertions(+), 5 deletions(-)
|
|
|
a21e2b |
|
|
|
a21e2b |
diff --git a/src/terminal-app.c b/src/terminal-app.c
|
|
|
a21e2b |
index 54a4ccd..4e061b6 100644
|
|
|
a21e2b |
--- a/src/terminal-app.c
|
|
|
a21e2b |
+++ b/src/terminal-app.c
|
|
|
a21e2b |
@@ -281,6 +281,21 @@ app_menu_about_cb (GSimpleAction *action,
|
|
|
a21e2b |
terminal_util_show_about (gtk_application_get_active_window (application));
|
|
|
a21e2b |
}
|
|
|
a21e2b |
|
|
|
a21e2b |
+static void
|
|
|
a21e2b |
+app_menu_quit_cb (GSimpleAction *action,
|
|
|
a21e2b |
+ GVariant *parameter,
|
|
|
a21e2b |
+ gpointer user_data)
|
|
|
a21e2b |
+{
|
|
|
a21e2b |
+ GtkApplication *application = user_data;
|
|
|
a21e2b |
+ GtkWindow *window;
|
|
|
a21e2b |
+
|
|
|
a21e2b |
+ window = gtk_application_get_active_window (application);
|
|
|
a21e2b |
+ if (TERMINAL_IS_WINDOW (window))
|
|
|
a21e2b |
+ terminal_window_request_close (TERMINAL_WINDOW (window));
|
|
|
a21e2b |
+ else /* a dialogue */
|
|
|
a21e2b |
+ gtk_widget_destroy (GTK_WIDGET (window));
|
|
|
a21e2b |
+}
|
|
|
a21e2b |
+
|
|
|
a21e2b |
/* Class implementation */
|
|
|
a21e2b |
|
|
|
a21e2b |
G_DEFINE_TYPE (TerminalApp, terminal_app, GTK_TYPE_APPLICATION)
|
|
|
a21e2b |
@@ -299,7 +314,8 @@ terminal_app_startup (GApplication *application)
|
|
|
a21e2b |
const GActionEntry app_menu_actions[] = {
|
|
|
a21e2b |
{ "preferences", app_menu_preferences_cb, NULL, NULL, NULL },
|
|
|
a21e2b |
{ "help", app_menu_help_cb, NULL, NULL, NULL },
|
|
|
a21e2b |
- { "about", app_menu_about_cb, NULL, NULL, NULL }
|
|
|
a21e2b |
+ { "about", app_menu_about_cb, NULL, NULL, NULL },
|
|
|
a21e2b |
+ { "quit", app_menu_quit_cb, NULL, NULL, NULL }
|
|
|
a21e2b |
};
|
|
|
a21e2b |
|
|
|
a21e2b |
GtkBuilder *builder;
|
|
|
a21e2b |
diff --git a/src/terminal-appmenu.ui b/src/terminal-appmenu.ui
|
|
|
a21e2b |
index 36b7e0b..0c6b86b 100644
|
|
|
a21e2b |
--- a/src/terminal-appmenu.ui
|
|
|
a21e2b |
+++ b/src/terminal-appmenu.ui
|
|
|
a21e2b |
@@ -32,6 +32,10 @@
|
|
|
a21e2b |
<attribute name="label" translatable="yes">_About</attribute>
|
|
|
a21e2b |
<attribute name="action">app.about</attribute>
|
|
|
a21e2b |
</item>
|
|
|
a21e2b |
+ <item>
|
|
|
a21e2b |
+ <attribute name="label" translatable="yes">_Quit</attribute>
|
|
|
a21e2b |
+ <attribute name="action">app.quit</attribute>
|
|
|
a21e2b |
+ </item>
|
|
|
a21e2b |
</section>
|
|
|
a21e2b |
</menu>
|
|
|
a21e2b |
</interface>
|
|
|
a21e2b |
diff --git a/src/terminal-window.c b/src/terminal-window.c
|
|
|
a21e2b |
index 3670da0..1fafb39 100644
|
|
|
a21e2b |
--- a/src/terminal-window.c
|
|
|
a21e2b |
+++ b/src/terminal-window.c
|
|
|
a21e2b |
@@ -2948,10 +2948,7 @@ static void
|
|
|
a21e2b |
file_close_window_callback (GtkAction *action,
|
|
|
a21e2b |
TerminalWindow *window)
|
|
|
a21e2b |
{
|
|
|
a21e2b |
- if (confirm_close_window_or_tab (window, NULL))
|
|
|
a21e2b |
- return;
|
|
|
a21e2b |
-
|
|
|
a21e2b |
- gtk_widget_destroy (GTK_WIDGET (window));
|
|
|
a21e2b |
+ terminal_window_request_close (window);
|
|
|
a21e2b |
}
|
|
|
a21e2b |
|
|
|
a21e2b |
#ifdef ENABLE_SAVE
|
|
|
a21e2b |
@@ -3612,3 +3609,14 @@ terminal_window_get_ui_manager (TerminalWindow *window)
|
|
|
a21e2b |
|
|
|
a21e2b |
return priv->ui_manager;
|
|
|
a21e2b |
}
|
|
|
a21e2b |
+
|
|
|
a21e2b |
+void
|
|
|
a21e2b |
+terminal_window_request_close (TerminalWindow *window)
|
|
|
a21e2b |
+{
|
|
|
a21e2b |
+ g_return_if_fail (TERMINAL_IS_WINDOW (window));
|
|
|
a21e2b |
+
|
|
|
a21e2b |
+ if (confirm_close_window_or_tab (window, NULL))
|
|
|
a21e2b |
+ return;
|
|
|
a21e2b |
+
|
|
|
a21e2b |
+ gtk_widget_destroy (GTK_WIDGET (window));
|
|
|
a21e2b |
+}
|
|
|
a21e2b |
diff --git a/src/terminal-window.h b/src/terminal-window.h
|
|
|
a21e2b |
index 880ec19..3cf6794 100644
|
|
|
a21e2b |
--- a/src/terminal-window.h
|
|
|
a21e2b |
+++ b/src/terminal-window.h
|
|
|
a21e2b |
@@ -87,6 +87,8 @@ void terminal_window_update_geometry (TerminalWindow *window);
|
|
|
a21e2b |
|
|
|
a21e2b |
GtkWidget* terminal_window_get_mdi_container (TerminalWindow *window);
|
|
|
a21e2b |
|
|
|
a21e2b |
+void terminal_window_request_close (TerminalWindow *window);
|
|
|
a21e2b |
+
|
|
|
a21e2b |
G_END_DECLS
|
|
|
a21e2b |
|
|
|
a21e2b |
#endif /* TERMINAL_WINDOW_H */
|
|
|
a21e2b |
--
|
|
|
a21e2b |
1.8.4.2
|
|
|
a21e2b |
|