aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2018-04-21 22:31:32 +0200
committerThomas White <taw@bitwiz.me.uk>2018-04-22 23:21:12 +0200
commit3f0ef3ba6d8389a6aaeef7183c2a41b57ba36a8d (patch)
tree615a8dde8a2c49241b8c33e5e9737d939de2321a /src
parent77adb62d654f88ef46b45f521ca7ceb0ee11a607 (diff)
Put all menu definitions into one resource
Diffstat (limited to 'src')
-rw-r--r--src/colloquium.c17
-rw-r--r--src/colloquium.h3
2 files changed, 12 insertions, 8 deletions
diff --git a/src/colloquium.c b/src/colloquium.c
index 11ac241..3b1caa3 100644
--- a/src/colloquium.c
+++ b/src/colloquium.c
@@ -42,6 +42,7 @@
struct _colloquium
{
GtkApplication parent_instance;
+ GtkBuilder *builder;
char *mydir;
int first_run;
char *imagestore;
@@ -319,10 +320,15 @@ int colloquium_get_hidepointer(Colloquium *app)
}
+GtkBuilder *colloquium_get_uibuilder(Colloquium *app)
+{
+ return app->builder;
+}
+
+
static void colloquium_startup(GApplication *papp)
{
Colloquium *app = COLLOQUIUM(papp);
- GtkBuilder *builder;
const char *configdir;
char *tmp;
@@ -331,10 +337,9 @@ static void colloquium_startup(GApplication *papp)
g_action_map_add_action_entries(G_ACTION_MAP(app), app_entries,
G_N_ELEMENTS(app_entries), app);
- builder = gtk_builder_new_from_resource("/uk/me/bitwiz/Colloquium/menu-bar.ui");
+ app->builder = gtk_builder_new_from_resource("/uk/me/bitwiz/Colloquium/menus.ui");
gtk_application_set_menubar(GTK_APPLICATION(app),
- G_MENU_MODEL(gtk_builder_get_object(builder, "menubar")));
- g_object_unref(builder);
+ G_MENU_MODEL(gtk_builder_get_object(app->builder, "menubar")));
if ( gtk_application_prefers_app_menu(GTK_APPLICATION(app)) ) {
/* Set the application menu only if it will be shown by the
@@ -342,10 +347,8 @@ static void colloquium_startup(GApplication *papp)
* normal menus, so don't let GTK create a fallback menu in the
* menu bar. */
printf(_("Using app menu\n"));
- builder = gtk_builder_new_from_resource("/uk/me/bitwiz/Colloquium/app-menu.ui");
- GMenuModel *mmodel = G_MENU_MODEL(gtk_builder_get_object(builder, "app-menu"));
+ GMenuModel *mmodel = G_MENU_MODEL(gtk_builder_get_object(app->builder, "app-menu"));
gtk_application_set_app_menu(GTK_APPLICATION(app), mmodel);
- g_object_unref(builder);
}
configdir = g_get_user_config_dir();
diff --git a/src/colloquium.h b/src/colloquium.h
index 71bae1c..4c8133f 100644
--- a/src/colloquium.h
+++ b/src/colloquium.h
@@ -37,8 +37,9 @@ typedef struct _colloquium Colloquium;
extern const char *colloquium_get_imagestore(Colloquium *app);
-
extern int colloquium_get_hidepointer(Colloquium *app);
+extern GtkBuilder *colloquium_get_uibuilder(Colloquium *app);
+
extern void open_about_dialog(GtkWidget *parent);