# HG changeset patch # User Guido Berhoerster # Date 1528913160 -7200 # Node ID 7172a0db97af36a3b79b914ed7022cae60726548 # Parent 2f04ec9e050611b69a9eb26ff6b780810e8ebee5 Use GtkBuilder for all widgets diff -r 2f04ec9e0506 -r 7172a0db97af Makefile --- a/Makefile Fri Jun 08 08:38:42 2018 +0200 +++ b/Makefile Wed Jun 13 20:06:00 2018 +0200 @@ -103,7 +103,8 @@ pui-backend.o \ pui-get-updates.o \ pui-settings.o \ - pui-types.o + pui-types.o \ + pui-resources.o $(PACKAGE)-prefs_OBJS = package-update-indicator-prefs.o \ pui-prefs-application.o \ diff -r 2f04ec9e0506 -r 7172a0db97af po/POTFILES.in --- a/po/POTFILES.in Fri Jun 08 08:38:42 2018 +0200 +++ b/po/POTFILES.in Wed Jun 13 20:06:00 2018 +0200 @@ -3,9 +3,11 @@ org.guido-berhoerster.code.package-update-indicator.preferences.desktop.in package-update-indicator-prefs.c package-update-indicator.c +pui-about-dialog.ui pui-application.c pui-backend.c pui-get-updates.c +pui-menu.ui pui-prefs-application.c pui-prefs-window.ui pui-settings.c diff -r 2f04ec9e0506 -r 7172a0db97af pui-about-dialog.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pui-about-dialog.ui Wed Jun 13 20:06:00 2018 +0200 @@ -0,0 +1,41 @@ + + + + + + False + About Package Update Indicator + system-software-update + dialog + Package Update Indicator + Copyright © 2018 Guido Berhörster + Notify about available software updates + http://code.guido-berhoerster.org/projects/package-update-indicator/ + Guido Berhörster + Translator + system-software-update + True + mit-x11 + + + False + vertical + 2 + + + False + end + + + False + False + 0 + + + + + + + + + diff -r 2f04ec9e0506 -r 7172a0db97af pui-application.c --- a/pui-application.c Fri Jun 08 08:38:42 2018 +0200 +++ b/pui-application.c Wed Jun 13 20:06:00 2018 +0200 @@ -111,27 +111,18 @@ gpointer user_data) { PuiApplication *self = user_data; - const gchar *translators; + GtkBuilder *builder; if (self->about_dialog == NULL) { - translators = _("Translators"); - if (strcmp(translators, "Translators") == 0) { - translators = NULL; - } + /* get dialog from builder */ + builder = gtk_builder_new_from_resource("/org" + "/guido-berhoerster/code/package-update-indicator" + "/pui-about-dialog.ui"); - self->about_dialog = gtk_about_dialog_new(); - g_object_set(G_OBJECT(self->about_dialog), - "authors", (gchar *[]){ "Guido Berhoerster", NULL }, - "comments", _("Notify about available software updates"), - "copyright", "Copyright \xc2\xa9 2018 Guido Berhoerster", - "license-type", GTK_LICENSE_MIT_X11, - "logo-icon-name", "system-software-update", - "translator-credits", translators, - "version", VERSION, - "website", "https://code.guido-berhoerster.org/projects/" - "package-update-indicator/", - "wrap-license", TRUE, - NULL); + self->about_dialog = GTK_WIDGET(gtk_builder_get_object(builder, + "about-dialog")); + + g_object_unref(builder); } gtk_dialog_run(GTK_DIALOG(self->about_dialog)); @@ -405,8 +396,8 @@ { PuiApplication *self = PUI_APPLICATION(application); gsize i; + GtkBuilder *builder; GtkWidget *menu; - GtkWidget *menu_item; G_APPLICATION_CLASS(pui_application_parent_class)->startup(application); @@ -433,22 +424,11 @@ "system-software-update", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - /* build menu */ - menu = gtk_menu_new(); - gtk_widget_insert_action_group(GTK_WIDGET(menu), "app", - G_ACTION_GROUP(self)); - - menu_item = gtk_menu_item_new_with_label(_("Install " - "Updates\342\200\246")); - gtk_actionable_set_action_name(GTK_ACTIONABLE(menu_item), - "app.install-updates"); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); - - menu_item = gtk_menu_item_new_with_label(_("About\342\200\246")); - gtk_actionable_set_action_name(GTK_ACTIONABLE(menu_item), - "app.about"); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); - + /* get menu from builder and add it to the indicator */ + builder = gtk_builder_new_from_resource("/org/guido-berhoerster/code/" + "package-update-indicator/pui-menu.ui"); + menu = GTK_WIDGET(gtk_builder_get_object(builder, "menu")); + gtk_widget_insert_action_group(menu, "app", G_ACTION_GROUP(self)); gtk_widget_show_all(menu); app_indicator_set_menu(self->indicator, GTK_MENU(menu)); @@ -456,6 +436,8 @@ /* keep GApplication running */ g_application_hold(application); + + g_object_unref(builder); } static void diff -r 2f04ec9e0506 -r 7172a0db97af pui-menu.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pui-menu.ui Wed Jun 13 20:06:00 2018 +0200 @@ -0,0 +1,27 @@ + + + + + + True + False + + + True + False + app.install-updates + _Install updates + True + + + + + True + False + app.about + _About… + True + + + + diff -r 2f04ec9e0506 -r 7172a0db97af pui.gresource.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pui.gresource.xml Wed Jun 13 20:06:00 2018 +0200 @@ -0,0 +1,7 @@ + + + + pui-menu.ui + pui-about-dialog.ui + +