Move app menu to gtk/menus.ui
This way it gets automatically loaded, and the setup_menu() function can be removed from AgApp.
This commit is contained in:
		| @@ -7,7 +7,7 @@ src/ag-db.c | |||||||
| src/ag-display-theme.c | src/ag-display-theme.c | ||||||
| src/ag-window.c | src/ag-window.c | ||||||
| src/astrognome.c | src/astrognome.c | ||||||
| [type: gettext/glade]src/resources/ui/astrognome.ui | [type: gettext/glade]src/resources/gtk/menus.ui | ||||||
| [type: gettext/glade]src/resources/ui/ag-window.ui | [type: gettext/glade]src/resources/ui/ag-window.ui | ||||||
| [type: gettext/glade]src/resources/ui/ag-preferences.ui | [type: gettext/glade]src/resources/ui/ag-preferences.ui | ||||||
| [type: gettext/glade]src/resources/ui/ag-chart-edit.ui | [type: gettext/glade]src/resources/ui/ag-chart-edit.ui | ||||||
|   | |||||||
							
								
								
									
										24
									
								
								src/ag-app.c
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								src/ag-app.c
									
									
									
									
									
								
							| @@ -378,29 +378,6 @@ setup_accelerators(AgApp *app) | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| static void |  | ||||||
| setup_menu(AgApp *app) |  | ||||||
| { |  | ||||||
|     GtkBuilder *builder; |  | ||||||
|     GMenuModel *model; |  | ||||||
|     GError     *err = NULL; |  | ||||||
|  |  | ||||||
|     builder = gtk_builder_new(); |  | ||||||
|  |  | ||||||
|     if (!gtk_builder_add_from_resource( |  | ||||||
|                 builder, |  | ||||||
|                 "/eu/polonkai/gergely/Astrognome/ui/astrognome.ui", |  | ||||||
|                 &err |  | ||||||
|             )) { |  | ||||||
|         g_error("%s", (err) ? err->message : "unknown error"); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     model = G_MENU_MODEL(gtk_builder_get_object(builder, "app-menu")); |  | ||||||
|     gtk_application_set_app_menu(GTK_APPLICATION(app), model); |  | ||||||
|  |  | ||||||
|     g_object_unref(builder); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| static void | static void | ||||||
| startup(GApplication *gapp) | startup(GApplication *gapp) | ||||||
| { | { | ||||||
| @@ -409,7 +386,6 @@ startup(GApplication *gapp) | |||||||
|     G_APPLICATION_CLASS(ag_app_parent_class)->startup(gapp); |     G_APPLICATION_CLASS(ag_app_parent_class)->startup(gapp); | ||||||
|  |  | ||||||
|     setup_actions(app); |     setup_actions(app); | ||||||
|     setup_menu(app); |  | ||||||
|     setup_accelerators(app); |     setup_accelerators(app); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,8 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||||
| <gresources> | <gresources> | ||||||
|   <gresource prefix="/eu/polonkai/gergely/Astrognome"> |   <gresource prefix="/eu/polonkai/gergely/Astrognome"> | ||||||
|     <file>ui/astrognome.ui</file> |     <file>gtk/menus.ui</file> | ||||||
|  |  | ||||||
|     <file>ui/ag-window.ui</file> |     <file>ui/ag-window.ui</file> | ||||||
|     <file>ui/ag-preferences.ui</file> |     <file>ui/ag-preferences.ui</file> | ||||||
|     <file>ui/ag-chart-edit.ui</file> |     <file>ui/ag-chart-edit.ui</file> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user