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/about-me/Makefile.am | 21 +++++++++++---------- capplets/about-me/mate-about-me-fingerprint.c | 7 ++++++- capplets/about-me/mate-about-me-password.c | 11 ++++++++--- capplets/about-me/mate-about-me.c | 9 +++++++-- capplets/about-me/org.mate.mcc.am.gresource.xml | 24 ++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 capplets/about-me/org.mate.mcc.am.gresource.xml (limited to 'capplets/about-me') diff --git a/capplets/about-me/Makefile.am b/capplets/about-me/Makefile.am index 453474c0..aee23c53 100644 --- a/capplets/about-me/Makefile.am +++ b/capplets/about-me/Makefile.am @@ -4,6 +4,9 @@ cappletname = about-me ui_files = mate-about-me-dialog.ui mate-about-me-password.ui mate-about-me-fingerprint.ui Desktop_in_files = mate-about-me.desktop.in +BUILT_SOURCES = marshal.c marshal.h mate-about-me-resources.h mate-about-me-resources.c +nodist_mate_about_me_SOURCES = \ + $(BUILT_SOURCES) mate_about_me_SOURCES = \ mate-about-me-password.c \ mate-about-me-password.h \ @@ -11,17 +14,15 @@ mate_about_me_SOURCES = \ e-image-chooser.h \ mate-about-me-fingerprint.c \ mate-about-me-fingerprint.h \ - $(MARSHALFILES) \ fingerprint-strings.h \ mate-about-me.c -MARSHALFILES = marshal.c marshal.h -BUILT_SOURCES = $(MARSHALFILES) - marshal.h: fprintd-marshal.list @GLIB_GENMARSHAL@ --prefix=fprintd_marshal $< --header > $@ marshal.c: fprintd-marshal.list @GLIB_GENMARSHAL@ --prefix=fprintd_marshal $< --body --header > $@ +mate-about-me-resources.h mate-about-me-resources.c: org.mate.mcc.am.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/org.mate.mcc.am.gresource.xml) + $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name about_me $< bin_PROGRAMS = mate-about-me @@ -36,15 +37,11 @@ mate_about_me_LDFLAGS = -export-dynamic desktopdir = $(datadir)/applications desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) -uidir = $(pkgdatadir)/ui -ui_DATA = $(ui_files) - AM_CPPFLAGS = \ $(MATECC_CAPPLETS_CFLAGS) \ $(LIBEBOOK_CFLAGS) \ -DDATADIR="\"$(datadir)\"" \ -DMATECC_DATA_DIR="\"$(pkgdatadir)\"" \ - -DMATECC_UI_DIR="\"$(uidir)\"" \ -DMATECC_PIXMAP_DIR="\"$(pkgdatadir)/pixmaps\"" \ -DMATELOCALEDIR="\"$(datadir)/locale\"" @@ -53,7 +50,11 @@ AM_CPPFLAGS += \ $(ACCOUNTSSERVICE_CFLAGS) endif -CLEANFILES = $(MATECC_CAPPLETS_CLEANFILES) $(desktop_DATA) $(MARSHALFILES) -EXTRA_DIST = $(ui_files) fprintd-marshal.list $(Desktop_in_files) +CLEANFILES = $(MATECC_CAPPLETS_CLEANFILES) $(desktop_DATA) $(BUILT_SOURCES) +EXTRA_DIST = \ + $(ui_files) \ + fprintd-marshal.list \ + $(Desktop_in_files) \ + org.mate.mcc.am.gresource.xml -include $(top_srcdir)/git.mk diff --git a/capplets/about-me/mate-about-me-fingerprint.c b/capplets/about-me/mate-about-me-fingerprint.c index 095be8d2..9b30384e 100644 --- a/capplets/about-me/mate-about-me-fingerprint.c +++ b/capplets/about-me/mate-about-me-fingerprint.c @@ -506,6 +506,7 @@ enroll_fingerprints (GtkWindow *parent, GtkWidget *enable, GtkWidget *disable) EnrollData *data; GtkWidget *ass; char *msg; + GError *error = NULL; device = NULL; @@ -547,7 +548,11 @@ enroll_fingerprints (GtkWindow *parent, GtkWidget *enable, GtkWidget *disable) g_object_unref (p); dialog = gtk_builder_new (); - gtk_builder_add_from_file (dialog, MATECC_UI_DIR "/mate-about-me-fingerprint.ui", NULL); + if (gtk_builder_add_from_resource (dialog, "/org/mate/mcc/am/mate-about-me-fingerprint.ui", &error) == 0) + { + g_warning ("Could not parse UI definition: %s", error->message); + g_error_free (error); + } data->dialog = dialog; ass = WID ("assistant"); diff --git a/capplets/about-me/mate-about-me-password.c b/capplets/about-me/mate-about-me-password.c index c2e1242d..0f053f7f 100644 --- a/capplets/about-me/mate-about-me-password.c +++ b/capplets/about-me/mate-about-me-password.c @@ -1011,13 +1011,18 @@ passdlg_activate (GtkEntry *entry, GtkWidget *w) static void passdlg_init (PasswordDialog *pdialog, GtkWindow *parent) { - GtkBuilder *dialog; - GtkWidget *wpassdlg; + GtkBuilder *dialog; + GtkWidget *wpassdlg; GtkAccelGroup *group; + GError *error = NULL; /* Initialize dialog */ dialog = gtk_builder_new (); - gtk_builder_add_from_file (dialog, MATECC_UI_DIR "/mate-about-me-password.ui", NULL); + if (gtk_builder_add_from_resource (dialog, "/org/mate/mcc/am/mate-about-me-password.ui", &error) == 0) + { + g_warning ("Could not parse UI definition: %s", error->message); + g_error_free (error); + } pdialog->ui = dialog; wpassdlg = WID ("change-password"); diff --git a/capplets/about-me/mate-about-me.c b/capplets/about-me/mate-about-me.c index b66beb32..417dac3c 100644 --- a/capplets/about-me/mate-about-me.c +++ b/capplets/about-me/mate-about-me.c @@ -125,7 +125,7 @@ static void about_me_update_photo (MateAboutMe *me) { gchar *file; - GError *error; + GError *error = NULL; guchar *data; gsize length; @@ -428,6 +428,7 @@ about_me_setup_dialog (void) GtkWidget *main_dialog; GtkIconInfo *icon; GtkBuilder *dialog; + GError *error = NULL; gchar *str; #if HAVE_ACCOUNTSSERVICE ActUserManager* manager; @@ -437,7 +438,11 @@ about_me_setup_dialog (void) me->image = NULL; dialog = gtk_builder_new (); - gtk_builder_add_from_file (dialog, MATECC_UI_DIR "/mate-about-me-dialog.ui", NULL); + if (gtk_builder_add_from_resource (dialog, "/org/mate/mcc/am/mate-about-me-dialog.ui", &error) == 0) + { + g_warning ("Could not parse UI definition: %s", error->message); + g_error_free (error); + } me->image_chooser = e_image_chooser_new_with_size (MAX_WIDTH, MAX_HEIGHT); gtk_container_add (GTK_CONTAINER (WID ("button-image")), me->image_chooser); diff --git a/capplets/about-me/org.mate.mcc.am.gresource.xml b/capplets/about-me/org.mate.mcc.am.gresource.xml new file mode 100644 index 00000000..875df52d --- /dev/null +++ b/capplets/about-me/org.mate.mcc.am.gresource.xml @@ -0,0 +1,24 @@ + + + + + mate-about-me-dialog.ui + mate-about-me-fingerprint.ui + mate-about-me-password.ui + + -- cgit v1.2.1