~larsu/gnome-terminal/update-restore-transparency-patch

« back to all changes in this revision

Viewing changes to debian/patches/git-add-quit.patch

  • Committer: Jeremy Bicha
  • Date: 2013-06-30 03:30:22 UTC
  • Revision ID: jbicha@ubuntu.com-20130630033022-7vzlptjxpsl3tsgk
* debian/patches/git-add-quit:
  - Backport patch to add Quit to app menu

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From b56dfe662b0cd86d37d6c5c1964129a37332510c Mon Sep 17 00:00:00 2001
 
2
From: Christian Persch <chpe@gnome.org>
 
3
Date: Thu, 20 Jun 2013 20:17:45 +0000
 
4
Subject: appmenu: Add Quit item
 
5
 
 
6
https://bugzilla.gnome.org/show_bug.cgi?id=690910
 
7
---
 
8
diff --git a/src/terminal-app.c b/src/terminal-app.c
 
9
index 7ad5d14..6d6fbe9 100644
 
10
--- a/src/terminal-app.c
 
11
+++ b/src/terminal-app.c
 
12
@@ -282,6 +282,21 @@ app_menu_about_cb (GSimpleAction *action,
 
13
   terminal_util_show_about (gtk_application_get_active_window (application));
 
14
 }
 
15
 
 
16
+static void
 
17
+app_menu_quit_cb (GSimpleAction *action,
 
18
+                  GVariant      *parameter,
 
19
+                  gpointer       user_data)
 
20
+{
 
21
+  GtkApplication *application = user_data;
 
22
+  GtkWindow *window;
 
23
+
 
24
+  window = gtk_application_get_active_window (application);
 
25
+  if (TERMINAL_IS_WINDOW (window))
 
26
+    terminal_window_request_close (TERMINAL_WINDOW (window));
 
27
+  else /* a dialogue */
 
28
+    gtk_widget_destroy (GTK_WIDGET (window));
 
29
+}
 
30
+
 
31
 /* Class implementation */
 
32
 
 
33
 G_DEFINE_TYPE (TerminalApp, terminal_app, GTK_TYPE_APPLICATION)
 
34
@@ -300,7 +315,8 @@ terminal_app_startup (GApplication *application)
 
35
   const GActionEntry app_menu_actions[] = {
 
36
     { "preferences", app_menu_preferences_cb,   NULL, NULL, NULL },
 
37
     { "help",        app_menu_help_cb,          NULL, NULL, NULL },
 
38
-    { "about",       app_menu_about_cb,         NULL, NULL, NULL }
 
39
+    { "about",       app_menu_about_cb,         NULL, NULL, NULL },
 
40
+    { "quit",        app_menu_quit_cb,          NULL, NULL, NULL }
 
41
   };
 
42
 
 
43
   GtkBuilder *builder;
 
44
diff --git a/src/terminal-appmenu.ui b/src/terminal-appmenu.ui
 
45
index 36b7e0b..0c6b86b 100644
 
46
--- a/src/terminal-appmenu.ui
 
47
+++ b/src/terminal-appmenu.ui
 
48
@@ -32,6 +32,10 @@
 
49
         <attribute name="label" translatable="yes">_About</attribute>
 
50
         <attribute name="action">app.about</attribute>
 
51
       </item>
 
52
+      <item>
 
53
+        <attribute name="label" translatable="yes">_Quit</attribute>
 
54
+        <attribute name="action">app.quit</attribute>
 
55
+      </item>
 
56
     </section>
 
57
   </menu>
 
58
 </interface>
 
59
diff --git a/src/terminal-window.c b/src/terminal-window.c
 
60
index 743cbcb..c863f43 100644
 
61
--- a/src/terminal-window.c
 
62
+++ b/src/terminal-window.c
 
63
@@ -2860,10 +2860,7 @@ static void
 
64
 file_close_window_callback (GtkAction *action,
 
65
                             TerminalWindow *window)
 
66
 {
 
67
-  if (confirm_close_window_or_tab (window, NULL))
 
68
-    return;
 
69
-
 
70
-  gtk_widget_destroy (GTK_WIDGET (window));
 
71
+  terminal_window_request_close (window);
 
72
 }
 
73
 
 
74
 #ifdef ENABLE_SAVE
 
75
@@ -3524,3 +3521,14 @@ terminal_window_get_ui_manager (TerminalWindow *window)
 
76
 
 
77
   return priv->ui_manager;
 
78
 }
 
79
+
 
80
+void
 
81
+terminal_window_request_close (TerminalWindow *window)
 
82
+{
 
83
+  g_return_if_fail (TERMINAL_IS_WINDOW (window));
 
84
+
 
85
+  if (confirm_close_window_or_tab (window, NULL))
 
86
+    return;
 
87
+
 
88
+  gtk_widget_destroy (GTK_WIDGET (window));
 
89
+}
 
90
diff --git a/src/terminal-window.h b/src/terminal-window.h
 
91
index dd50abb..1f2191d 100644
 
92
--- a/src/terminal-window.h
 
93
+++ b/src/terminal-window.h
 
94
@@ -85,6 +85,8 @@ void terminal_window_update_geometry  (TerminalWindow *window);
 
95
 
 
96
 GtkWidget* terminal_window_get_mdi_container (TerminalWindow *window);
 
97
 
 
98
+void terminal_window_request_close (TerminalWindow *window);
 
99
+
 
100
 G_END_DECLS
 
101
 
 
102
 #endif /* TERMINAL_WINDOW_H */
 
103
--
 
104
cgit v0.9.2
 
105