Commit a64f9b817ae50384862a963fa0d3b10320a3fb1e
1 parent
cb9e7b30
Exists in
master
and in
4 other branches
Working wiht GMenuBar.
Showing
5 changed files
with
40 additions
and
7 deletions
Show diff stats
src/objects/actions/lib3270/action.c
... | ... | @@ -139,7 +139,7 @@ |
139 | 139 | } |
140 | 140 | |
141 | 141 | static gboolean bg_notify_enabled(GAction *action) { |
142 | - debug("Action %s was notified (%s)",g_action_get_name(action),g_action_get_enabled(action) ? "Enabled" : "Disabled"); | |
142 | +// debug("Action %s was notified (%s)",g_action_get_name(action),g_action_get_enabled(action) ? "Enabled" : "Disabled"); | |
143 | 143 | pw3270_action_notify_enabled(action); |
144 | 144 | return FALSE; |
145 | 145 | } | ... | ... |
src/objects/window/actions.c
... | ... | @@ -45,6 +45,7 @@ |
45 | 45 | |
46 | 46 | g_print("Exiting application\n"); |
47 | 47 | |
48 | + /* | |
48 | 49 | GList *list = gtk_application_get_windows(GTK_APPLICATION(application)); |
49 | 50 | |
50 | 51 | while(list) { |
... | ... | @@ -55,6 +56,9 @@ |
55 | 56 | gtk_widget_destroy(window); |
56 | 57 | |
57 | 58 | } |
59 | + */ | |
60 | + | |
61 | + g_application_quit(G_APPLICATION(application)); | |
58 | 62 | |
59 | 63 | } |
60 | 64 | ... | ... |
src/objects/window/application.c
... | ... | @@ -131,6 +131,9 @@ |
131 | 131 | #endif // _WIN32 |
132 | 132 | |
133 | 133 | // Get settings |
134 | + g_autofree gchar * path = g_strconcat("/apps/" PACKAGE_NAME "/", g_get_application_name(),"/",NULL); | |
135 | + debug("path=%s",path); | |
136 | + | |
134 | 137 | { |
135 | 138 | #ifdef DEBUG |
136 | 139 | GError * error = NULL; |
... | ... | @@ -152,14 +155,11 @@ |
152 | 155 | |
153 | 156 | g_settings_schema_source_unref(source); |
154 | 157 | |
155 | - g_autofree gchar * path = g_strconcat("/apps/" PACKAGE_NAME "/", g_get_application_name(),"/",NULL); | |
156 | - | |
157 | - debug("path=%s",path); | |
158 | 158 | app->settings = g_settings_new_full(schema, NULL, path); |
159 | 159 | |
160 | 160 | #else |
161 | 161 | |
162 | - #error TODO! | |
162 | + app->settings = g_settings_new_with_path("br.com.bb." PACKAGE_NAME, path); | |
163 | 163 | |
164 | 164 | #endif // DEBUG |
165 | 165 | |
... | ... | @@ -257,7 +257,9 @@ |
257 | 257 | // Setup application menus |
258 | 258 | // |
259 | 259 | GtkBuilder * builder = gtk_builder_new_from_file("ui/application.xml"); |
260 | - gtk_application_set_app_menu(GTK_APPLICATION (application), G_MENU_MODEL(gtk_builder_get_object (builder, "app-menu"))); | |
260 | + | |
261 | + if(gtk_application_prefers_app_menu(GTK_APPLICATION(application))) | |
262 | + gtk_application_set_app_menu(GTK_APPLICATION (application), G_MENU_MODEL(gtk_builder_get_object (builder, "app-menu"))); | |
261 | 263 | |
262 | 264 | if(pw3270_application_get_ui_style(application) == PW3270_UI_STYLE_CLASSICAL) |
263 | 265 | gtk_application_set_menubar(GTK_APPLICATION (application), G_MENU_MODEL(gtk_builder_get_object (builder, "menubar"))); |
... | ... | @@ -270,12 +272,19 @@ |
270 | 272 | |
271 | 273 | GtkWidget * window = pw3270_application_window_new(GTK_APPLICATION(application)); |
272 | 274 | |
275 | + debug("%s","************************************************"); | |
276 | + debug("Action win.copy is %p",g_action_map_lookup_action(G_ACTION_MAP(window),"win.copy")); | |
277 | + debug("Action app.copy is %p",g_action_map_lookup_action(G_ACTION_MAP(window),"app.copy")); | |
278 | + debug("Action win.copy is %p",g_action_map_lookup_action(G_ACTION_MAP(application),"win.copy")); | |
279 | + debug("Action copy is %p",g_action_map_lookup_action(G_ACTION_MAP(application),"copy")); | |
280 | + debug("%s","************************************************"); | |
281 | + | |
273 | 282 | // Create terminal widget |
274 | 283 | pw3270_terminal_new(window); |
284 | + pw3270_window_set_current_page(window,0); | |
275 | 285 | |
276 | 286 | // Present the new window |
277 | 287 | gtk_window_present(GTK_WINDOW(window)); |
278 | - pw3270_window_set_current_page(window,0); | |
279 | 288 | |
280 | 289 | } |
281 | 290 | ... | ... |
src/objects/window/window.c
... | ... | @@ -148,6 +148,11 @@ |
148 | 148 | } |
149 | 149 | |
150 | 150 | |
151 | + debug("%s","************************************************"); | |
152 | + debug("Action win.copy is %p",g_action_map_lookup_action(G_ACTION_MAP(widget),"win.copy")); | |
153 | + debug("%s","************************************************"); | |
154 | + | |
155 | + | |
151 | 156 | } |
152 | 157 | |
153 | 158 | GtkWidget * pw3270_application_window_new(GtkApplication * application) { | ... | ... |
ui/application.xml
... | ... | @@ -50,6 +50,20 @@ |
50 | 50 | |
51 | 51 | <submenu> |
52 | 52 | |
53 | + <attribute name='label' translatable='yes'>_Edit</attribute> | |
54 | + | |
55 | + <item> | |
56 | + <attribute name="label" translatable="yes">Copy</attribute> | |
57 | + <attribute name="action">win.copy</attribute> | |
58 | + | |
59 | + </item> | |
60 | + | |
61 | + </submenu> | |
62 | + | |
63 | + <!-- | |
64 | + | |
65 | + <submenu> | |
66 | + | |
53 | 67 | <attribute name='label' translatable='yes'>_File</attribute> |
54 | 68 | |
55 | 69 | <section> |
... | ... | @@ -245,6 +259,7 @@ |
245 | 259 | </item> |
246 | 260 | |
247 | 261 | </submenu> |
262 | + --> | |
248 | 263 | |
249 | 264 | <!-- |
250 | 265 | ... | ... |