From eafb5fddf84324ebf6b0cc90422f10ee314b5b28 Mon Sep 17 00:00:00 2001 From: rbuj Date: Tue, 7 May 2019 00:05:26 +0200 Subject: capplets: Use gresources for UI files --- capplets/keyboard/Makefile.am | 27 +++++++++++++--------- capplets/keyboard/mate-keyboard-properties-a11y.c | 8 +++---- .../keyboard/mate-keyboard-properties-xkbltadd.c | 6 ++--- capplets/keyboard/mate-keyboard-properties-xkbmc.c | 10 ++++---- capplets/keyboard/mate-keyboard-properties-xkbot.c | 6 ++--- capplets/keyboard/mate-keyboard-properties.c | 3 +-- .../keyboard/org.mate.mcc.keyboard.gresource.xml | 26 +++++++++++++++++++++ 7 files changed, 58 insertions(+), 28 deletions(-) create mode 100644 capplets/keyboard/org.mate.mcc.keyboard.gresource.xml (limited to 'capplets/keyboard') diff --git a/capplets/keyboard/Makefile.am b/capplets/keyboard/Makefile.am index b1a7c5af..30c77705 100644 --- a/capplets/keyboard/Makefile.am +++ b/capplets/keyboard/Makefile.am @@ -3,6 +3,9 @@ cappletname = keyboard bin_PROGRAMS = mate-keyboard-properties +BUILT_SOURCES = mate-keyboard-properties-resources.h mate-keyboard-properties-resources.c +nodist_mate_keyboard_properties_SOURCES = \ + $(BUILT_SOURCES) mate_keyboard_properties_SOURCES = \ mate-keyboard-properties.c \ mate-keyboard-properties-a11y.c \ @@ -19,24 +22,26 @@ mate_keyboard_properties_LDADD = $(MATECC_CAPPLETS_LIBS) $(LIBMATEKBDUI_LIBS) @INTLTOOL_DESKTOP_RULE@ -uidir = $(pkgdatadir)/ui -dist_ui_DATA = mate-keyboard-properties-a11y-notifications.ui \ - mate-keyboard-properties-dialog.ui \ - mate-keyboard-properties-layout-chooser.ui \ - mate-keyboard-properties-model-chooser.ui \ - mate-keyboard-properties-options-dialog.ui - desktopdir = $(datadir)/applications Desktop_in_files = mate-keyboard.desktop.in desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) +mate-keyboard-properties-resources.h mate-keyboard-properties-resources.c: org.mate.mcc.keyboard.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/org.mate.mcc.keyboard.gresource.xml) + $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name keyboard $< + AM_CPPFLAGS = \ $(MATECC_CAPPLETS_CFLAGS) \ $(LIBMATEKBDUI_CFLAGS) \ -DMATELOCALEDIR="\"$(datadir)/locale\"" \ - -DMATECC_DATA_DIR="\"$(pkgdatadir)\"" \ - -DMATECC_UI_DIR="\"$(uidir)\"" -CLEANFILES = $(MATECC_CAPPLETS_CLEANFILES) $(desktop_DATA) -EXTRA_DIST = $(ui_DATA) $(Desktop_in_files) + -DMATECC_DATA_DIR="\"$(pkgdatadir)\"" +CLEANFILES = $(MATECC_CAPPLETS_CLEANFILES) $(desktop_DATA) $(BUILT_SOURCES) +EXTRA_DIST = \ + mate-keyboard-properties-a11y-notifications.ui \ + mate-keyboard-properties-dialog.ui \ + mate-keyboard-properties-layout-chooser.ui \ + mate-keyboard-properties-model-chooser.ui \ + mate-keyboard-properties-options-dialog.ui \ + $(Desktop_in_files) \ + org.mate.mcc.keyboard.gresource.xml -include $(top_srcdir)/git.mk diff --git a/capplets/keyboard/mate-keyboard-properties-a11y.c b/capplets/keyboard/mate-keyboard-properties-a11y.c index 9a9779a1..301b1ee1 100644 --- a/capplets/keyboard/mate-keyboard-properties-a11y.c +++ b/capplets/keyboard/mate-keyboard-properties-a11y.c @@ -134,10 +134,10 @@ notifications_button_clicked_cb (GtkWidget *button, GtkBuilder *dialog) { GtkWidget *w; - notifications_dialog = gtk_builder_new (); - gtk_builder_add_from_file (notifications_dialog, MATECC_UI_DIR - "/mate-keyboard-properties-a11y-notifications.ui", - NULL); + notifications_dialog = gtk_builder_new (); + gtk_builder_add_from_resource (notifications_dialog, + "/org/mate/mcc/keyboard/mate-keyboard-properties-a11y-notifications.ui", + NULL); stickykeys_enable_toggled_cb (WID ("stickykeys_enable"), dialog); slowkeys_enable_toggled_cb (WID ("slowkeys_enable"), dialog); diff --git a/capplets/keyboard/mate-keyboard-properties-xkbltadd.c b/capplets/keyboard/mate-keyboard-properties-xkbltadd.c index 7ec09919..6b54fff2 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkbltadd.c +++ b/capplets/keyboard/mate-keyboard-properties-xkbltadd.c @@ -474,9 +474,9 @@ xkb_layout_choose (GtkBuilder * dialog) GtkBuilder *chooser_dialog; chooser_dialog = gtk_builder_new (); - gtk_builder_add_from_file (chooser_dialog, MATECC_UI_DIR - "/mate-keyboard-properties-layout-chooser.ui", - NULL); + gtk_builder_add_from_resource (chooser_dialog, + "/org/mate/mcc/keyboard/mate-keyboard-properties-layout-chooser.ui", + NULL); GtkWidget *chooser = CWID ("xkb_layout_chooser"); GtkWidget *lang_chooser = CWID ("xkb_languages_available"); GtkWidget *notebook = CWID ("choosers_nb"); diff --git a/capplets/keyboard/mate-keyboard-properties-xkbmc.c b/capplets/keyboard/mate-keyboard-properties-xkbmc.c index e6ae7eb7..6ffc69e6 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkbmc.c +++ b/capplets/keyboard/mate-keyboard-properties-xkbmc.c @@ -312,12 +312,12 @@ void choose_model (GtkBuilder * dialog) { GtkBuilder *chooser_dialog; - GtkWidget *chooser; + GtkWidget *chooser; - chooser_dialog = gtk_builder_new (); - gtk_builder_add_from_file (chooser_dialog, MATECC_UI_DIR - "/mate-keyboard-properties-model-chooser.ui", - NULL); + chooser_dialog = gtk_builder_new (); + gtk_builder_add_from_resource (chooser_dialog, + "/org/mate/mcc/keyboard/mate-keyboard-properties-model-chooser.ui", + NULL); chooser = CWID ("xkb_model_chooser"); gtk_window_set_transient_for (GTK_WINDOW (chooser), GTK_WINDOW (WID diff --git a/capplets/keyboard/mate-keyboard-properties-xkbot.c b/capplets/keyboard/mate-keyboard-properties-xkbot.c index 5be80c2e..e67fcf86 100644 --- a/capplets/keyboard/mate-keyboard-properties-xkbot.c +++ b/capplets/keyboard/mate-keyboard-properties-xkbot.c @@ -448,9 +448,9 @@ xkb_options_popup_dialog (GtkBuilder * dialog) GtkWidget *chooser; chooser_dialog = gtk_builder_new (); - gtk_builder_add_from_file (chooser_dialog, MATECC_UI_DIR - "/mate-keyboard-properties-options-dialog.ui", - NULL); + gtk_builder_add_from_resource (chooser_dialog, + "/org/mate/mcc/keyboard/mate-keyboard-properties-options-dialog.ui", + NULL); chooser = CWID ("xkb_options_dialog"); gtk_window_set_transient_for (GTK_WINDOW (chooser), diff --git a/capplets/keyboard/mate-keyboard-properties.c b/capplets/keyboard/mate-keyboard-properties.c index 4cf0f4c9..a5da8f0d 100644 --- a/capplets/keyboard/mate-keyboard-properties.c +++ b/capplets/keyboard/mate-keyboard-properties.c @@ -58,10 +58,9 @@ create_dialog (void) GtkSizeGroup *size_group; GtkWidget *image; GError *error = NULL; - static const gchar *uifile = MATECC_UI_DIR "/mate-keyboard-properties-dialog.ui"; dialog = gtk_builder_new (); - if (gtk_builder_add_from_file (dialog, uifile, &error) == 0) { + if (gtk_builder_add_from_resource (dialog, "/org/mate/mcc/keyboard/mate-keyboard-properties-dialog.ui", &error) == 0) { g_warning ("Could not load UI: %s", error->message); g_error_free (error); g_object_unref (dialog); diff --git a/capplets/keyboard/org.mate.mcc.keyboard.gresource.xml b/capplets/keyboard/org.mate.mcc.keyboard.gresource.xml new file mode 100644 index 00000000..1bcb8c9c --- /dev/null +++ b/capplets/keyboard/org.mate.mcc.keyboard.gresource.xml @@ -0,0 +1,26 @@ + + + + + mate-keyboard-properties-a11y-notifications.ui + mate-keyboard-properties-dialog.ui + mate-keyboard-properties-layout-chooser.ui + mate-keyboard-properties-model-chooser.ui + mate-keyboard-properties-options-dialog.ui + + -- cgit v1.2.1