Commit 54d771e64d9a33665bb14d0675f427265e29fe8b
1 parent
5fc33710
Exists in
master
and in
4 other branches
Working on gear menu.
Showing
6 changed files
with
66 additions
and
21 deletions
Show diff stats
src/objects/window/actions.c
| @@ -34,6 +34,13 @@ | @@ -34,6 +34,13 @@ | ||
| 34 | #include "private.h" | 34 | #include "private.h" |
| 35 | #include <pw3270/application.h> | 35 | #include <pw3270/application.h> |
| 36 | 36 | ||
| 37 | + void pw3270_application_generic_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | ||
| 38 | + | ||
| 39 | + debug("%s",__FUNCTION__); | ||
| 40 | + | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + | ||
| 37 | void pw3270_application_quit_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | 44 | void pw3270_application_quit_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { |
| 38 | 45 | ||
| 39 | g_print("Exiting application\n"); | 46 | g_print("Exiting application\n"); |
src/objects/window/application.c
| @@ -73,12 +73,6 @@ | @@ -73,12 +73,6 @@ | ||
| 73 | 73 | ||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | - static void action_activated(GSimpleAction * action, GVariant *parameter, gpointer application) { | ||
| 77 | - | ||
| 78 | - debug("%s",__FUNCTION__); | ||
| 79 | - | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | void startup(GApplication *application) { | 76 | void startup(GApplication *application) { |
| 83 | 77 | ||
| 84 | G_APPLICATION_CLASS(pw3270Application_parent_class)->startup(application); | 78 | G_APPLICATION_CLASS(pw3270Application_parent_class)->startup(application); |
| @@ -86,14 +80,14 @@ | @@ -86,14 +80,14 @@ | ||
| 86 | // | 80 | // |
| 87 | // Setup application default actions. | 81 | // Setup application default actions. |
| 88 | // | 82 | // |
| 89 | - static GActionEntry app_entries[] = { | 83 | + static GActionEntry actions[] = { |
| 90 | { | 84 | { |
| 91 | .name = "about", | 85 | .name = "about", |
| 92 | - .activate = action_activated, | 86 | + .activate = pw3270_application_generic_activated, |
| 93 | }, | 87 | }, |
| 94 | { | 88 | { |
| 95 | .name = "preferences", | 89 | .name = "preferences", |
| 96 | - .activate = action_activated, | 90 | + .activate = pw3270_application_generic_activated, |
| 97 | }, | 91 | }, |
| 98 | 92 | ||
| 99 | { | 93 | { |
| @@ -115,8 +109,8 @@ | @@ -115,8 +109,8 @@ | ||
| 115 | 109 | ||
| 116 | g_action_map_add_action_entries( | 110 | g_action_map_add_action_entries( |
| 117 | G_ACTION_MAP(application), | 111 | G_ACTION_MAP(application), |
| 118 | - app_entries, | ||
| 119 | - G_N_ELEMENTS(app_entries), | 112 | + actions, |
| 113 | + G_N_ELEMENTS(actions), | ||
| 120 | application | 114 | application |
| 121 | ); | 115 | ); |
| 122 | 116 |
src/objects/window/private.h
| @@ -62,6 +62,7 @@ | @@ -62,6 +62,7 @@ | ||
| 62 | }; | 62 | }; |
| 63 | 63 | ||
| 64 | // Actions | 64 | // Actions |
| 65 | + G_GNUC_INTERNAL void pw3270_application_generic_activated(GSimpleAction * action, GVariant *parameter, gpointer application); | ||
| 65 | G_GNUC_INTERNAL void pw3270_application_quit_activated(GSimpleAction * action, GVariant *parameter, gpointer application); | 66 | G_GNUC_INTERNAL void pw3270_application_quit_activated(GSimpleAction * action, GVariant *parameter, gpointer application); |
| 66 | G_GNUC_INTERNAL void pw3270_application_new_tab_activated(GSimpleAction * action, GVariant *parameter, gpointer application); | 67 | G_GNUC_INTERNAL void pw3270_application_new_tab_activated(GSimpleAction * action, GVariant *parameter, gpointer application); |
| 67 | G_GNUC_INTERNAL void pw3270_application_new_window_activated(GSimpleAction * action, GVariant *parameter, gpointer application); | 68 | G_GNUC_INTERNAL void pw3270_application_new_window_activated(GSimpleAction * action, GVariant *parameter, gpointer application); |
src/objects/window/ui/application.xml
| @@ -21,8 +21,8 @@ | @@ -21,8 +21,8 @@ | ||
| 21 | </item> | 21 | </item> |
| 22 | </section> | 22 | </section> |
| 23 | </menu> | 23 | </menu> |
| 24 | - <menu id='menubar'> | ||
| 25 | 24 | ||
| 25 | + <menu id='menubar'> | ||
| 26 | <submenu> | 26 | <submenu> |
| 27 | <attribute name='label' translatable='yes'>_Edit</attribute> | 27 | <attribute name='label' translatable='yes'>_Edit</attribute> |
| 28 | <section> | 28 | <section> |
src/objects/window/ui/window.xml
| @@ -3,17 +3,41 @@ | @@ -3,17 +3,41 @@ | ||
| 3 | <requires lib="gtk+" version="3.0"/> | 3 | <requires lib="gtk+" version="3.0"/> |
| 4 | <menu id="gear-menu"> | 4 | <menu id="gear-menu"> |
| 5 | <section> | 5 | <section> |
| 6 | - <item> | ||
| 7 | - <attribute name="label" translatable="yes">About PW3270</attribute> | ||
| 8 | - <attribute name="action">app.about</attribute> | ||
| 9 | - </item> | 6 | + |
| 7 | + <submenu> | ||
| 8 | + <attribute name="label" translatable="yes">New</attribute> | ||
| 9 | + <item> | ||
| 10 | + <attribute name="label" translatable="yes">Tab</attribute> | ||
| 11 | + <attribute name="action">app.new_tab</attribute> | ||
| 12 | + </item> | ||
| 13 | + <item> | ||
| 14 | + <attribute name="label" translatable="yes">Application Window</attribute> | ||
| 15 | + <attribute name="action">app.new_window</attribute> | ||
| 16 | + </item> | ||
| 17 | + </submenu> | ||
| 18 | + | ||
| 19 | + <submenu> | ||
| 20 | + <attribute name="label" translatable="yes">Open</attribute> | ||
| 21 | + <item> | ||
| 22 | + <attribute name="label" translatable="yes">File</attribute> | ||
| 23 | + <attribute name="action">app.open</attribute> | ||
| 24 | + </item> | ||
| 25 | + <item> | ||
| 26 | + <attribute name="label" translatable="yes">New tab</attribute> | ||
| 27 | + <attribute name="action">app.new_tab</attribute> | ||
| 28 | + </item> | ||
| 29 | + <item> | ||
| 30 | + <attribute name="label" translatable="yes">New window</attribute> | ||
| 31 | + <attribute name="action">app.new_window</attribute> | ||
| 32 | + </item> | ||
| 33 | + </submenu> | ||
| 34 | + | ||
| 35 | + </section> | ||
| 36 | + | ||
| 37 | + <section> | ||
| 10 | <item> | 38 | <item> |
| 11 | <attribute name="label" translatable="yes">Preferences</attribute> | 39 | <attribute name="label" translatable="yes">Preferences</attribute> |
| 12 | - <attribute name="action">app.help</attribute> | ||
| 13 | - </item> | ||
| 14 | - <item> | ||
| 15 | - <attribute name="label" translatable="yes">Quit PW3270</attribute> | ||
| 16 | - <attribute name="action">app.quit</attribute> | 40 | + <attribute name="action">win.preferences</attribute> |
| 17 | </item> | 41 | </item> |
| 18 | </section> | 42 | </section> |
| 19 | </menu> | 43 | </menu> |
src/objects/window/window.c
| @@ -68,6 +68,25 @@ | @@ -68,6 +68,25 @@ | ||
| 68 | gtk_widget_show_all(GTK_WIDGET(vBox)); | 68 | gtk_widget_show_all(GTK_WIDGET(vBox)); |
| 69 | gtk_container_add(GTK_CONTAINER(widget),GTK_WIDGET(vBox)); | 69 | gtk_container_add(GTK_CONTAINER(widget),GTK_WIDGET(vBox)); |
| 70 | 70 | ||
| 71 | + // | ||
| 72 | + // Setup Window actions. | ||
| 73 | + // | ||
| 74 | + static GActionEntry actions[] = { | ||
| 75 | + | ||
| 76 | + { | ||
| 77 | + .name = "preferences", | ||
| 78 | + .activate = pw3270_application_generic_activated, | ||
| 79 | + }, | ||
| 80 | + | ||
| 81 | + }; | ||
| 82 | + | ||
| 83 | + g_action_map_add_action_entries( | ||
| 84 | + G_ACTION_MAP(widget), | ||
| 85 | + actions, | ||
| 86 | + G_N_ELEMENTS(actions), | ||
| 87 | + widget | ||
| 88 | + ); | ||
| 89 | + | ||
| 71 | } | 90 | } |
| 72 | 91 | ||
| 73 | GtkWidget * pw3270_application_window_new(GtkApplication * application) { | 92 | GtkWidget * pw3270_application_window_new(GtkApplication * application) { |