[gnome-applets/wip/segeiger/window-picker/applet: 2/3] window-picker: Rename and move about logo to src dir and add to gresouce



commit de71e2cfef5c606c9cc8af6b7a8261d8fe1dffdb
Author: Sebastian Geiger <sbastig gmx net>
Date:   Tue Jul 14 15:36:01 2015 +0200

    window-picker: Rename and move about logo to src dir and add to gresouce
    
    We now use gresource to compile the png into the applet and load it as a resource
    when the dialog is created.

 windowpicker/data/Makefile.am                      |    6 ------
 windowpicker/src/Makefile.am                       |    1 +
 windowpicker/src/wp-about-dialog.c                 |   16 ++++++++++------
 .../wp-about-logo.png}                             |  Bin 46970 -> 46970 bytes
 windowpicker/src/wp-resources.gresource.xml        |    1 +
 5 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/windowpicker/data/Makefile.am b/windowpicker/data/Makefile.am
index ed5e2b7..fea57fa 100644
--- a/windowpicker/data/Makefile.am
+++ b/windowpicker/data/Makefile.am
@@ -4,17 +4,12 @@ applet_DATA     = $(applet_in_files:.panel-applet.in=.panel-applet)
 
 APPLET_LOCATION=$(pkglibdir)/$(LIBPANEL_APPLET_API_VERSION)/libwindow-picker-applet.so
 
-uidir = $(datadir)/$(PACKAGE)/ui
-ui_DATA = \
-       window-picker-about-logo.png
-
 $(applet_in_files): $(applet_in_files).in Makefile
        $(AM_V_GEN)sed \
        -e "s|\ APPLET_LOCATION\@|$(APPLET_LOCATION)|" \
        -e "s|\ VERSION\@|$(PACKAGE_VERSION)|" \
        $< > $@
 
-
 gsettings_file = org.gnome.gnome-applets.window-picker-applet.gschema.xml
 gsettings_SCHEMAS = $(gsettings_file)
 
@@ -30,7 +25,6 @@ $(gsettings_file).in: $(gsettings_file).in.in
 %.panel-applet: %.panel-applet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) 
$(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
 
 EXTRA_DIST = \
-       $(ui_DATA) \
        org.gnome.applets.WindowPicker.panel-applet.in.in \
        $(gsettings_file).in.in
 
diff --git a/windowpicker/src/Makefile.am b/windowpicker/src/Makefile.am
index 0656f60..c536b7c 100644
--- a/windowpicker/src/Makefile.am
+++ b/windowpicker/src/Makefile.am
@@ -46,6 +46,7 @@ libwindow_picker_applet_la_SOURCES = \
 
 EXTRA_DIST = \
        wp-menu.xml \
+       wp-about-logo.png \
        wp-resources.gresource.xml
 
 CLEANFILES = \
diff --git a/windowpicker/src/wp-about-dialog.c b/windowpicker/src/wp-about-dialog.c
index 9a2a4d6..7d588c5 100644
--- a/windowpicker/src/wp-about-dialog.c
+++ b/windowpicker/src/wp-about-dialog.c
@@ -27,6 +27,8 @@
 
 #include "wp-about-dialog.h"
 
+#define GRESOURCE "/org/gnome/gnome-applets/window-picker/"
+
 struct _WpAboutDialog
 {
   GtkAboutDialog  parent;
@@ -45,17 +47,19 @@ static void
 wp_about_dialog_constructed (GObject *object)
 {
   WpAboutDialog *dialog;
-  gchar *filename;
+  const gchar *resource;
 
   G_OBJECT_CLASS (wp_about_dialog_parent_class)->constructed (object);
 
   dialog = WP_ABOUT_DIALOG (object);
-  filename = g_build_filename (WINDOW_PICKER_MENU_UI_DIR,
-                               "window-picker-about-logo.png",
-                               NULL);
+  resource = GRESOURCE "wp-about-logo.png";
+
+  GError *error = NULL;
+  dialog->logo = gdk_pixbuf_new_from_resource (resource, &error);
 
-  dialog->logo = gdk_pixbuf_new_from_file (filename, NULL);
-  g_free (filename);
+  if (error) {
+    g_critical ("[wp-about-dialog] Could not load the about logo resouce.");
+  }
 
   if (dialog->logo)
     gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG (dialog), dialog->logo);
diff --git a/windowpicker/src/wp-resources.gresource.xml b/windowpicker/src/wp-resources.gresource.xml
index 729ac57..41c8f64 100644
--- a/windowpicker/src/wp-resources.gresource.xml
+++ b/windowpicker/src/wp-resources.gresource.xml
@@ -3,5 +3,6 @@
   <gresource prefix="/org/gnome/gnome-applets/window-picker">
     <file compressed="true">wp-preferences-dialog.ui</file>
     <file compressed="true">wp-menu.xml</file>
+    <file compressed="true">wp-about-logo.png</file>
   </gresource>
 </gresources>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]