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,7 +139,7 @@ | ||
139 | } | 139 | } |
140 | 140 | ||
141 | static gboolean bg_notify_enabled(GAction *action) { | 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 | pw3270_action_notify_enabled(action); | 143 | pw3270_action_notify_enabled(action); |
144 | return FALSE; | 144 | return FALSE; |
145 | } | 145 | } |
src/objects/window/actions.c
@@ -45,6 +45,7 @@ | @@ -45,6 +45,7 @@ | ||
45 | 45 | ||
46 | g_print("Exiting application\n"); | 46 | g_print("Exiting application\n"); |
47 | 47 | ||
48 | + /* | ||
48 | GList *list = gtk_application_get_windows(GTK_APPLICATION(application)); | 49 | GList *list = gtk_application_get_windows(GTK_APPLICATION(application)); |
49 | 50 | ||
50 | while(list) { | 51 | while(list) { |
@@ -55,6 +56,9 @@ | @@ -55,6 +56,9 @@ | ||
55 | gtk_widget_destroy(window); | 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,6 +131,9 @@ | ||
131 | #endif // _WIN32 | 131 | #endif // _WIN32 |
132 | 132 | ||
133 | // Get settings | 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 | #ifdef DEBUG | 138 | #ifdef DEBUG |
136 | GError * error = NULL; | 139 | GError * error = NULL; |
@@ -152,14 +155,11 @@ | @@ -152,14 +155,11 @@ | ||
152 | 155 | ||
153 | g_settings_schema_source_unref(source); | 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 | app->settings = g_settings_new_full(schema, NULL, path); | 158 | app->settings = g_settings_new_full(schema, NULL, path); |
159 | 159 | ||
160 | #else | 160 | #else |
161 | 161 | ||
162 | - #error TODO! | 162 | + app->settings = g_settings_new_with_path("br.com.bb." PACKAGE_NAME, path); |
163 | 163 | ||
164 | #endif // DEBUG | 164 | #endif // DEBUG |
165 | 165 | ||
@@ -257,7 +257,9 @@ | @@ -257,7 +257,9 @@ | ||
257 | // Setup application menus | 257 | // Setup application menus |
258 | // | 258 | // |
259 | GtkBuilder * builder = gtk_builder_new_from_file("ui/application.xml"); | 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 | if(pw3270_application_get_ui_style(application) == PW3270_UI_STYLE_CLASSICAL) | 264 | if(pw3270_application_get_ui_style(application) == PW3270_UI_STYLE_CLASSICAL) |
263 | gtk_application_set_menubar(GTK_APPLICATION (application), G_MENU_MODEL(gtk_builder_get_object (builder, "menubar"))); | 265 | gtk_application_set_menubar(GTK_APPLICATION (application), G_MENU_MODEL(gtk_builder_get_object (builder, "menubar"))); |
@@ -270,12 +272,19 @@ | @@ -270,12 +272,19 @@ | ||
270 | 272 | ||
271 | GtkWidget * window = pw3270_application_window_new(GTK_APPLICATION(application)); | 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 | // Create terminal widget | 282 | // Create terminal widget |
274 | pw3270_terminal_new(window); | 283 | pw3270_terminal_new(window); |
284 | + pw3270_window_set_current_page(window,0); | ||
275 | 285 | ||
276 | // Present the new window | 286 | // Present the new window |
277 | gtk_window_present(GTK_WINDOW(window)); | 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,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 | GtkWidget * pw3270_application_window_new(GtkApplication * application) { | 158 | GtkWidget * pw3270_application_window_new(GtkApplication * application) { |
ui/application.xml
@@ -50,6 +50,20 @@ | @@ -50,6 +50,20 @@ | ||
50 | 50 | ||
51 | <submenu> | 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 | <attribute name='label' translatable='yes'>_File</attribute> | 67 | <attribute name='label' translatable='yes'>_File</attribute> |
54 | 68 | ||
55 | <section> | 69 | <section> |
@@ -245,6 +259,7 @@ | @@ -245,6 +259,7 @@ | ||
245 | </item> | 259 | </item> |
246 | 260 | ||
247 | </submenu> | 261 | </submenu> |
262 | + --> | ||
248 | 263 | ||
249 | <!-- | 264 | <!-- |
250 | 265 |