[rhythmbox] initial gresources: just some icons



commit 63d5e8443938cfc7296968686bc7bf485918fc7a
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Jun 21 22:44:53 2016 +1000

    initial gresources: just some icons

 .gitignore                                  |    1 +
 configure.ac                                |    2 +-
 data/icons/hicolor/16x16/status/Makefile.am |   14 +----------
 data/icons/hicolor/48x48/status/Makefile.am |   11 +-------
 lib/Makefile.am                             |   16 +-----------
 lib/rb-stock-icons.c                        |   35 +-------------------------
 shell/Makefile.am                           |   14 ++++++++++-
 shell/rhythmbox.gresource.xml               |    9 +++++++
 8 files changed, 29 insertions(+), 73 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9eafac9..d850314 100644
--- a/.gitignore
+++ b/.gitignore
@@ -113,6 +113,7 @@ shell/rb-shell-player-glue.h
 shell/rb-playlist-manager-glue.h
 shell/rb-shell-binding.h
 shell/rb-shell-player-binding.h
+shell/rb-resources.c
 
 #
 tests/bench-rhythmdb-load
diff --git a/configure.ac b/configure.ac
index 5faa6fd..22dff98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -383,7 +383,7 @@ AC_SUBST(CFLAGS)
 AC_SUBST(LDFLAGS)
 
 AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
-AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource)
+AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
 
 AC_SUBST(RHYTHMBOX_CFLAGS)
 AC_SUBST(RHYTHMBOX_LIBS)
diff --git a/data/icons/hicolor/16x16/status/Makefile.am b/data/icons/hicolor/16x16/status/Makefile.am
index 0c19fee..17cdeb1 100644
--- a/data/icons/hicolor/16x16/status/Makefile.am
+++ b/data/icons/hicolor/16x16/status/Makefile.am
@@ -1,16 +1,4 @@
-themedir = $(pkgdatadir)/icons/hicolor
-size = 16x16
-context = status
-
-iconsdir = $(themedir)/$(size)/$(context)
-
-icons_DATA = \
+EXTRA_DIST = \
        rhythmbox-set-star.png          \
        rhythmbox-unset-star.png        \
        rhythmbox-no-star.png
-
-noinst_DATA =
-
-EXTRA_DIST = \
-       $(icons_DATA)   \
-       $(noinst_DATA)
diff --git a/data/icons/hicolor/48x48/status/Makefile.am b/data/icons/hicolor/48x48/status/Makefile.am
index 70f97fb..2e41b76 100644
--- a/data/icons/hicolor/48x48/status/Makefile.am
+++ b/data/icons/hicolor/48x48/status/Makefile.am
@@ -1,11 +1,2 @@
-themedir = $(datadir)/icons/hicolor
-size = 48x48
-context = status
-
-iconsdir = $(themedir)/$(size)/$(context)
-
-icons_DATA = \
-       rhythmbox-missing-artwork.png
-
 EXTRA_DIST = \
-       $(icons_DATA)
+       rhythmbox-missing-artwork.png
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 12e3e5f..0b8afee 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -62,23 +62,9 @@ rb-marshal.c: rb-marshal.list
 rb-marshal.h: rb-marshal.list
        @GLIB_GENMARSHAL@ --prefix=rb_marshal $(srcdir)/rb-marshal.list --header > rb-marshal.h
 
-# inline icons
-rhythmbox-set-star-inline.h: $(top_srcdir)/data/icons/hicolor/16x16/status/rhythmbox-set-star.png
-       @GDK_PIXBUF_CSOURCE@ --raw --name=rhythmbox_set_star_inline $< > $@
-
-rhythmbox-unset-star-inline.h: $(top_srcdir)/data/icons/hicolor/16x16/status/rhythmbox-unset-star.png
-       @GDK_PIXBUF_CSOURCE@ --raw --name=rhythmbox_unset_star_inline $< > $@
-
-rhythmbox-no-star-inline.h: $(top_srcdir)/data/icons/hicolor/16x16/status/rhythmbox-no-star.png
-       @GDK_PIXBUF_CSOURCE@ --raw --name=rhythmbox_no_star_inline $< > $@
-
-
 BUILT_SOURCES +=                               \
        rb-marshal.c                            \
-       rb-marshal.h                            \
-       rhythmbox-set-star-inline.h             \
-       rhythmbox-unset-star-inline.h           \
-       rhythmbox-no-star-inline.h
+       rb-marshal.h
 
 librb_la_SOURCES += $(BUILT_SOURCES)
 
diff --git a/lib/rb-stock-icons.c b/lib/rb-stock-icons.c
index abccde8..cf52c7a 100644
--- a/lib/rb-stock-icons.c
+++ b/lib/rb-stock-icons.c
@@ -37,28 +37,12 @@
 #include "rb-file-helpers.h"
 #include "rb-stock-icons.h"
 
-/* inline pixbuf data */
-#include "rhythmbox-set-star-inline.h"
-#include "rhythmbox-unset-star-inline.h"
-#include "rhythmbox-no-star-inline.h"
-
-typedef struct {
-       const guint8 *data;
-       const char *name;
-} RBInlineIconData;
-
 const char RB_APP_ICON[] = "rhythmbox";
 const char RB_STOCK_SET_STAR[] = "rhythmbox-set-star";
 const char RB_STOCK_UNSET_STAR[] = "rhythmbox-unset-star";
 const char RB_STOCK_NO_STAR[] = "rhythmbox-no-star";
 const char RB_STOCK_MISSING_ARTWORK[] = "rhythmbox-missing-artwork";
 
-static RBInlineIconData inline_icons[] = {
-       { rhythmbox_set_star_inline, RB_STOCK_SET_STAR },
-       { rhythmbox_unset_star_inline, RB_STOCK_UNSET_STAR },
-       { rhythmbox_no_star_inline, RB_STOCK_NO_STAR }
-};
-
 /**
  * rb_stock_icons_init:
  *
@@ -69,8 +53,6 @@ void
 rb_stock_icons_init (void)
 {
        GtkIconTheme *theme = gtk_icon_theme_get_default ();
-       int i;
-       int icon_size;
        char *dot_icon_dir;
 
        /* add our icon search paths */
@@ -83,21 +65,8 @@ rb_stock_icons_init (void)
        gtk_icon_theme_append_search_path (theme, SHARE_UNINSTALLED_DIR G_DIR_SEPARATOR_S "icons");
 #endif
 
-       /* add inline icons */
-       gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &icon_size, NULL);
-       for (i = 0; i < (int) G_N_ELEMENTS (inline_icons); i++) {
-               GdkPixbuf *pixbuf;
-
-               pixbuf = gdk_pixbuf_new_from_inline (-1,
-                                                    inline_icons[i].data,
-                                                    FALSE,
-                                                    NULL);
-               g_assert (pixbuf);
-
-               gtk_icon_theme_add_builtin_icon (inline_icons[i].name,
-                                                icon_size,
-                                                pixbuf);
-       }
+       /* add resource icons */
+       gtk_icon_theme_add_resource_path (theme, "/org/gnome/Rhythmbox/icons/hicolor");
 }
 
 /**
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 0844f5a..4365f32 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -87,6 +87,7 @@ librhythmbox_core_la_SOURCES =                                \
        rb-play-order-shuffle.h                         \
        rb-playlist-manager.c                           \
        rb-removable-media-manager.c                    \
+       rb-resources.c                                  \
        rb-shell.c                                      \
        rb-shell-clipboard.c                            \
        rb-shell-clipboard.h                            \
@@ -137,6 +138,17 @@ if ENABLE_PYTHON
 rhythmbox_LDADD += $(PYTHON_LIBS)
 endif
 
-BUILT_SOURCES += $(tab_files)
+rb_resource_deps = $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(top_srcdir)/data 
--sourcedir $(top_builddir)/data $(srcdir)/rhythmbox.gresource.xml)
+
+rb-resources.c: $(rb_resource_deps) $(srcdir)/rhythmbox.gresource.xml
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES)           \
+               --target="$@"                           \
+               --sourcedir="$(top_srcdir)/data"        \
+               --sourcedir="$(top_builddir)/data"      \
+               --generate-source "$(srcdir)/rhythmbox.gresource.xml"
+
+EXTRA_DIST += rhythmbox.gresource.xml
+
+BUILT_SOURCES += $(tab_files) rb-resources.c
 
 CLEANFILES += $(BUILT_SOURCES)
diff --git a/shell/rhythmbox.gresource.xml b/shell/rhythmbox.gresource.xml
new file mode 100644
index 0000000..124fb01
--- /dev/null
+++ b/shell/rhythmbox.gresource.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+       <gresource prefix="/org/gnome/Rhythmbox">
+               <file preprocess="to-pixdata">icons/hicolor/16x16/status/rhythmbox-set-star.png</file>
+               <file preprocess="to-pixdata">icons/hicolor/16x16/status/rhythmbox-unset-star.png</file>
+               <file preprocess="to-pixdata">icons/hicolor/16x16/status/rhythmbox-no-star.png</file>
+               <file preprocess="to-pixdata">icons/hicolor/48x48/status/rhythmbox-missing-artwork.png</file>
+       </gresource>
+</gresources>


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