summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-05-17 17:07:13 +0200
committerLubomir Rintel <lkundrak@v3.sk>2018-05-22 09:56:28 +0200
commit5acbe0375289fa9d4d4a9a9cf089a6d2e4e668f7 (patch)
treef2737170c2f72e8aba9c67b0fca5e7d4aaeea2e5
parentf3782da21cbd730515263fb68660bb79047bcbd5 (diff)
downloadnetwork-manager-applet-5acbe0375289fa9d4d4a9a9cf089a6d2e4e668f7.tar.gz
connection-editor: add an appmenu
It just contains a Quit entry solemnly for the purpose of using a standard accelerator (Ctrl+Q). https://bugzilla.redhat.com/show_bug.cgi?id=1539697
-rw-r--r--Makefile.am1
-rw-r--r--po/POTFILES.in1
-rw-r--r--src/connection-editor/ce.gresource.xml1
-rw-r--r--src/connection-editor/gtk/menus.ui12
-rw-r--r--src/connection-editor/main.c16
-rw-r--r--src/connection-editor/meson.build1
6 files changed, 32 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 25c894ad..44c06cdc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -761,6 +761,7 @@ EXTRA_DIST += \
src/connection-editor/ce-page-wifi-security.ui \
src/connection-editor/ce-page-wifi.ui \
src/connection-editor/ce-ppp-auth-methods.ui \
+ src/connection-editor/gtk/menus.ui \
src/connection-editor/nm-connection-editor.ui \
src/connection-editor/nm-connection-list.ui \
src/connection-editor/ce.gresource.xml \
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d94165b5..f2e31720 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -46,6 +46,7 @@ src/connection-editor/ce-polkit.c
src/connection-editor/ce-polkit-button.c
[type: gettext/glade]src/connection-editor/ce-ppp-auth-methods.ui
src/connection-editor/connection-helpers.c
+[type: gettext/glade]src/connection-editor/gtk/menus.ui
src/connection-editor/ip4-routes-dialog.c
src/connection-editor/ip6-routes-dialog.c
src/connection-editor/nm-connection-editor.c
diff --git a/src/connection-editor/ce.gresource.xml b/src/connection-editor/ce.gresource.xml
index d404bc31..75e89d31 100644
--- a/src/connection-editor/ce.gresource.xml
+++ b/src/connection-editor/ce.gresource.xml
@@ -28,5 +28,6 @@
<file preprocess="xml-stripblanks">ce-page-wifi-security.ui</file>
<file preprocess="xml-stripblanks">ce-page-wifi.ui</file>
<file preprocess="xml-stripblanks">ce-ppp-auth-methods.ui</file>
+ <file preprocess="xml-stripblanks">gtk/menus.ui</file>
</gresource>
</gresources>
diff --git a/src/connection-editor/gtk/menus.ui b/src/connection-editor/gtk/menus.ui
new file mode 100644
index 00000000..8f9750aa
--- /dev/null
+++ b/src/connection-editor/gtk/menus.ui
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <menu id="app-menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Quit</attribute>
+ <attribute name="action">app.quit</attribute>
+ <attribute name="accel">&lt;Primary&gt;q</attribute>
+ </item>
+ </section>
+ </menu>
+</interface>
diff --git a/src/connection-editor/main.c b/src/connection-editor/main.c
index ec4587bb..3d743b6f 100644
--- a/src/connection-editor/main.c
+++ b/src/connection-editor/main.c
@@ -167,11 +167,27 @@ signal_handler (gpointer user_data)
}
static void
+quit_activated (GSimpleAction *action, GVariant *parameter, gpointer user_data)
+{
+ GApplication *application = G_APPLICATION (user_data);
+
+ g_application_quit (application);
+}
+
+static GActionEntry app_entries[] =
+{
+ { "quit", quit_activated, NULL, NULL, NULL },
+};
+
+static void
editor_startup (GApplication *application, gpointer user_data)
{
GtkApplication *app = GTK_APPLICATION (application);
NMConnectionList *list;
+ g_action_map_add_action_entries (G_ACTION_MAP (app), app_entries,
+ G_N_ELEMENTS (app_entries), app);
+
list = nm_connection_list_new ();
if (!list) {
g_warning ("Failed to initialize the UI, exiting...");
diff --git a/src/connection-editor/meson.build b/src/connection-editor/meson.build
index 004303e4..ef2657bb 100644
--- a/src/connection-editor/meson.build
+++ b/src/connection-editor/meson.build
@@ -62,6 +62,7 @@ resource_data = files(
'ce-page-wifi-security.ui',
'ce-page-wifi.ui',
'ce-ppp-auth-methods.ui',
+ 'gtk/menus.ui',
'nm-connection-editor.ui',
'nm-connection-list.ui'
)