[rhythmbox] display-page-tree: use symbolic icons instead of pixbufs
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] display-page-tree: use symbolic icons instead of pixbufs
- Date: Mon, 1 Jul 2013 13:16:48 +0000 (UTC)
commit 4ab8c1bd45c186d71e86dcfd2abdce638ed197cc
Author: Jonathan Matthew <jonathan d14n org>
Date: Mon Jul 1 22:44:13 2013 +1000
display-page-tree: use symbolic icons instead of pixbufs
All sources and other pages now provide a GIcon instance instead
of a GdkPixbuf. Most of the icons are part of the GNOME icon
theme, except for custom icons for last.fm and magnatune.
plugins/audioscrobbler/Last.fm-icon.png | Bin 1014 -> 0 bytes
plugins/audioscrobbler/Last.fm-icon.svg | 79 --------------
plugins/audioscrobbler/Last.fm-symbolic.svg | 110 ++++++++++++++++++++
plugins/audioscrobbler/Libre.fm-icon.png | Bin 803 -> 0 bytes
plugins/audioscrobbler/Makefile.am | 6 +-
.../rb-audioscrobbler-profile-page.c | 16 ++--
plugins/daap/rb-daap-plugin.c | 110 +-------------------
plugins/daap/rb-daap-plugin.h | 2 +-
plugins/daap/rb-daap-source.c | 31 ++----
plugins/daap/rb-dacp-pairing-page.c | 13 +--
plugins/grilo/rb-grilo-plugin.c | 1 +
plugins/grilo/rb-grilo-source.c | 1 +
plugins/ipod/rb-ipod-source.c | 21 +----
plugins/iradio/rb-iradio-source.c | 17 +---
plugins/magnatune/Makefile.am | 11 +--
.../icons/hicolor/24x24/places/magnatune.png | Bin 1062 -> 0 bytes
plugins/magnatune/magnatune-symbolic.svg | 84 +++++++++++++++
plugins/magnatune/magnatune.py | 9 +--
plugins/mtpdevice/rb-mtp-source.c | 13 +--
plugins/visualizer/rb-visualizer-page.c | 14 +---
podcast/rb-podcast-main-source.c | 18 +---
podcast/rb-podcast-source.c | 18 +---
sources/rb-auto-playlist-source.c | 28 +-----
sources/rb-device-source.c | 50 ++--------
sources/rb-display-page-tree.c | 65 ++++++++----
sources/rb-display-page.c | 54 ++++++----
sources/rb-display-page.h | 4 +-
sources/rb-import-errors-source.c | 13 +--
sources/rb-library-source.c | 19 +---
sources/rb-missing-files-source.c | 13 +--
sources/rb-play-queue-source.c | 1 -
sources/rb-source.h | 2 -
sources/rb-static-playlist-source.c | 29 +-----
33 files changed, 331 insertions(+), 521 deletions(-)
---
diff --git a/plugins/audioscrobbler/Last.fm-symbolic.svg b/plugins/audioscrobbler/Last.fm-symbolic.svg
new file mode 100644
index 0000000..785009b
--- /dev/null
+++ b/plugins/audioscrobbler/Last.fm-symbolic.svg
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="256"
+ height="256"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="Last.fm-icon.svg">
+ <metadata
+ id="metadata22">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1023"
+ inkscape:window-height="623"
+ id="namedview20"
+ showgrid="false"
+ inkscape:zoom="1.147955"
+ inkscape:cx="5.64927"
+ inkscape:cy="128"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2" />
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient4845">
+ <stop
+ stop-color="#d01f3c"
+ id="stop4847"
+ offset="0" />
+ <stop
+ stop-color="#d01f3c"
+ id="stop4853"
+ offset="0.5" />
+ <stop
+ stop-color="#d32c48"
+ id="stop4855"
+ offset="0.5" />
+ <stop
+ stop-color="#eb9fab"
+ id="stop4849"
+ offset="1" />
+ </linearGradient>
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ xlink:href="#linearGradient4845"
+ id="linearGradient4851"
+ y2="119.94179"
+ x2="239.74998"
+ y1="263.20898"
+ x1="239.74998" />
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ xlink:href="#linearGradient4845"
+ id="linearGradient4862"
+ y2="119.94179"
+ x2="239.74998"
+ y1="263.20898"
+ x1="239.74998" />
+ <linearGradient
+ xlink:href="#linearGradient4845"
+ id="linearGradient1433"
+ y2="-0.003883"
+ x2="0.48083"
+ y1="0.828193"
+ x1="0.48083" />
+ </defs>
+ <g
+ id="g14"
+ style="fill:#000000;fill-opacity:1"
+ transform="matrix(1.252481,0,0,1.252481,-32.31757,-34.560638)">
+ <title
+ id="title16">Layer 1</title>
+ <g
+ display="inline"
+ id="layer1"
+ style="fill:#000000;fill-opacity:1;display:inline">
+ <path
+ id="path1952"
+ d="m 147.74242,158.95406 -2.13848,-4.94561 -18.38383,-43.738 C 121.1484,94.791222
106.01414,84.332604 88.955123,84.332604 c -23.083221,0 -41.808273,19.551186 -41.808273,43.679266 0,24.10559
18.725052,43.66802 41.808273,43.66802 16.114137,0 30.097307,-9.51625 37.080137,-23.44442 l 7.43277,17.89389 c
-10.54111,13.4345 -26.57776,21.99088 -44.512907,21.99088 -31.794575,0 -57.561203,-26.89397
-57.561203,-60.10837 0,-33.213148 25.766628,-60.132109 57.561203,-60.132109 23.991857,0 43.369327,13.371986
53.216777,37.087639 0.7349,1.84101 10.40238,25.43291 18.84252,45.51403 5.21182,12.41962 9.66122,20.67602
24.10934,21.18097 14.16063,0.50117 23.92186,-8.50014 23.92186,-19.90239 0,-11.13728 -7.44902,-13.81444
-19.97238,-18.16762 -22.50955,-7.74273 -34.15178,-15.52921 -34.15178,-34.179275 0,-18.193863
11.84221,-30.328514 31.11467,-30.328514 12.53586,0 21.60967,5.832977 27.89635,17.455208 L 201.5966,93.11019 c
-4.6244,-6.771614 -9.74873,-9.453751 -16.24788,-9.453751 -9.04879,0 -1
5.48545,6.571632 -15.48545,15.304253 0,12.400868 10.62361,14.266868 25.47164,19.348708 19.98488,6.79661
29.27117,14.56809 29.27117,33.95303 0,20.36484 -16.72281,35.20414 -38.56995,35.16664 -20.12236,-0.09
-30.86094,-10.36488 -38.29371,-28.47502"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+</svg>
diff --git a/plugins/audioscrobbler/Makefile.am b/plugins/audioscrobbler/Makefile.am
index ca332f1..a79f30b 100644
--- a/plugins/audioscrobbler/Makefile.am
+++ b/plugins/audioscrobbler/Makefile.am
@@ -73,15 +73,13 @@ plugin_DATA = \
$(NULL)
plugindata_DATA = \
- $(top_srcdir)/plugins/audioscrobbler/Last.fm-icon.png \
- $(top_srcdir)/plugins/audioscrobbler/Libre.fm-icon.png \
+ $(top_srcdir)/plugins/audioscrobbler/Last.fm-symbolic.svg \
$(NULL)
EXTRA_DIST = \
$(plugin_in_files) \
$(gtkbuilder_DATA) \
- $(top_srcdir)/plugins/audioscrobbler/Last.fm-icon.png \
- $(top_srcdir)/plugins/audioscrobbler/Libre.fm-icon.png \
+ $(top_srcdir)/plugins/audioscrobbler/Last.fm-symbolic.svg \
$(NULL)
CLEANFILES = \
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
b/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
index f00b9ea..28a190a 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
@@ -245,22 +245,24 @@ rb_audioscrobbler_profile_page_new (RBShell *shell, GObject *plugin, RBAudioscro
char *name;
gchar *icon_name;
gchar *icon_path;
- gint icon_size;
- GdkPixbuf *icon_pixbuf;
+ GIcon *icon;
g_object_get (shell, "db", &db, NULL);
g_object_get (service, "name", &name, NULL);
- icon_name = g_strconcat (rb_audioscrobbler_service_get_name (service), "-icon.png", NULL);
+ icon_name = g_strconcat (rb_audioscrobbler_service_get_name (service), "-symbolic.svg", NULL);
icon_path = rb_find_plugin_data_file (plugin, icon_name);
- gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &icon_size, NULL);
- icon_pixbuf = gdk_pixbuf_new_from_file_at_size (icon_path, icon_size, icon_size, NULL);
+ if (icon_path != NULL) {
+ icon = g_file_icon_new (g_file_new_for_path (icon_path));
+ } else {
+ icon = g_themed_icon_new ("network-server-symbolic");
+ }
page = RB_DISPLAY_PAGE (g_object_new (RB_TYPE_AUDIOSCROBBLER_PROFILE_PAGE,
"shell", shell,
"plugin", plugin,
"name", name,
- "pixbuf", icon_pixbuf,
+ "icon", icon,
"service", service,
NULL));
@@ -268,7 +270,7 @@ rb_audioscrobbler_profile_page_new (RBShell *shell, GObject *plugin, RBAudioscro
g_free (name);
g_free (icon_name);
g_free (icon_path);
- g_object_unref (icon_pixbuf);
+ g_object_unref (icon);
return page;
}
diff --git a/plugins/daap/rb-daap-plugin.c b/plugins/daap/rb-daap-plugin.c
index 599582a..b312f88 100644
--- a/plugins/daap/rb-daap-plugin.c
+++ b/plugins/daap/rb-daap-plugin.c
@@ -104,9 +104,6 @@ struct _RBDaapPlugin
GSettings *settings;
GSettings *dacp_settings;
- GdkPixbuf *daap_share_pixbuf;
- GdkPixbuf *daap_share_locked_pixbuf;
-
GDBusConnection *bus;
guint dbus_intf_id;
};
@@ -123,7 +120,6 @@ static void rb_daap_plugin_init (RBDaapPlugin *plugin);
static void new_share_action_cb (GSimpleAction *, GVariant *, gpointer);
-static void create_pixbufs (RBDaapPlugin *plugin);
static void start_browsing (RBDaapPlugin *plugin);
static void stop_browsing (RBDaapPlugin *plugin);
static void settings_changed_cb (GSettings *settings,
@@ -190,8 +186,6 @@ impl_activate (PeasActivatable *bplugin)
start_browsing (plugin);
}
- create_pixbufs (plugin);
-
app = g_application_get_default ();
plugin->new_share_action = g_simple_action_new ("daap-new-share", NULL);
g_signal_connect (plugin->new_share_action, "activate", G_CALLBACK (new_share_action_cb), plugin);
@@ -252,16 +246,6 @@ impl_deactivate (PeasActivatable *bplugin)
g_object_unref (plugin->dacp_share);
- if (plugin->daap_share_pixbuf != NULL) {
- g_object_unref (plugin->daap_share_pixbuf);
- plugin->daap_share_pixbuf = NULL;
- }
-
- if (plugin->daap_share_locked_pixbuf != NULL) {
- g_object_unref (plugin->daap_share_locked_pixbuf);
- plugin->daap_share_locked_pixbuf = NULL;
- }
-
if (plugin->preferences) {
gtk_widget_destroy (plugin->preferences);
plugin->preferences = NULL;
@@ -282,102 +266,16 @@ impl_deactivate (PeasActivatable *bplugin)
/* DAAP share icons */
-static GdkPixbuf *
-composite_icons (const GdkPixbuf *src1,
- const GdkPixbuf *src2)
-{
- GdkPixbuf *dest;
- GdkPixbuf *scaled;
- gint w1, w2, h1, h2;
- gint dest_x, dest_y;
- gboolean do_scale;
-
- if (! src1) {
- return NULL;
- }
-
- dest = gdk_pixbuf_copy (src1);
-
- if (! src2) {
- return dest;
- }
-
- w1 = gdk_pixbuf_get_width (src1);
- h1 = gdk_pixbuf_get_height (src1);
- w2 = gdk_pixbuf_get_width (src2);
- h2 = gdk_pixbuf_get_height (src2);
-
- do_scale = ((float)w1 * 0.8) < w2;
-
- /* scale the emblem down if it will obscure the entire bottom image */
- if (do_scale) {
- scaled = gdk_pixbuf_scale_simple (src2, w1 / 2, h1 / 2, GDK_INTERP_BILINEAR);
- } else {
- scaled = (GdkPixbuf *)src2;
- }
-
- w2 = gdk_pixbuf_get_width (scaled);
- h2 = gdk_pixbuf_get_height (scaled);
-
- dest_x = w1 - w2;
- dest_y = h1 - h2;
-
- gdk_pixbuf_composite (scaled, dest,
- dest_x, dest_y,
- w2, h2,
- dest_x, dest_y,
- 1.0, 1.0,
- GDK_INTERP_BILINEAR, 0xFF);
-
- if (do_scale) {
- g_object_unref (scaled);
- }
-
- return dest;
-}
-
-static void
-create_pixbufs (RBDaapPlugin *plugin)
-{
- GdkPixbuf *emblem;
- GtkIconTheme *theme;
- gint size;
-
- theme = gtk_icon_theme_get_default ();
-
- gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
- plugin->daap_share_pixbuf =
- gtk_icon_theme_load_icon (theme, "gnome-fs-network", size, 0, NULL);
-
- gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &size, NULL);
- emblem = gtk_icon_theme_load_icon (theme, "stock_lock", size, 0, NULL);
-
- plugin->daap_share_locked_pixbuf = composite_icons (plugin->daap_share_pixbuf, emblem);
-
- if (emblem != NULL) {
- g_object_unref (emblem);
- }
-}
-
-GdkPixbuf *
+GIcon *
rb_daap_plugin_get_icon (RBDaapPlugin *plugin,
gboolean password_protected,
gboolean connected)
{
- GdkPixbuf *icon;
-
- g_return_val_if_fail (plugin->daap_share_pixbuf != NULL, NULL);
- g_return_val_if_fail (plugin->daap_share_locked_pixbuf != NULL, NULL);
-
- if (password_protected == FALSE) {
- icon = g_object_ref (plugin->daap_share_pixbuf);
- } else if (connected) {
- icon = g_object_ref (plugin->daap_share_pixbuf);
+ if (connected || (password_protected == FALSE)) {
+ return g_themed_icon_new ("folder-remote-symbolic");
} else {
- icon = g_object_ref (plugin->daap_share_locked_pixbuf);
+ return g_themed_icon_new ("dialog-password-symbolic");
}
-
- return icon;
}
/* mDNS browsing */
diff --git a/plugins/daap/rb-daap-plugin.h b/plugins/daap/rb-daap-plugin.h
index a355ebc..77779d8 100644
--- a/plugins/daap/rb-daap-plugin.h
+++ b/plugins/daap/rb-daap-plugin.h
@@ -46,7 +46,7 @@ typedef struct _RBDaapPluginClass RBDaapPluginClass;
GType rb_daap_plugin_get_type (void);
-GdkPixbuf * rb_daap_plugin_get_icon (RBDaapPlugin *plugin,
+GIcon * rb_daap_plugin_get_icon (RBDaapPlugin *plugin,
gboolean password_protected,
gboolean connected);
diff --git a/plugins/daap/rb-daap-source.c b/plugins/daap/rb-daap-source.c
index 93b35e6..8ded5e8 100644
--- a/plugins/daap/rb-daap-source.c
+++ b/plugins/daap/rb-daap-source.c
@@ -42,7 +42,6 @@
#include "rhythmdb.h"
#include "rb-shell.h"
#include "rb-daap-source.h"
-#include "rb-stock-icons.h"
#include "rb-debug.h"
#include "rb-util.h"
#include "rb-file-helpers.h"
@@ -325,7 +324,7 @@ rb_daap_source_new (RBShell *shell,
{
RBSource *source;
RhythmDBEntryType *entry_type;
- GdkPixbuf *icon;
+ GIcon *icon;
RhythmDB *db;
char *entry_type_name;
GSettings *settings;
@@ -358,7 +357,7 @@ rb_daap_source_new (RBShell *shell,
"host", host,
"port", port,
"entry-type", entry_type,
- "pixbuf", icon,
+ "icon", icon,
"shell", shell,
"visibility", TRUE,
"password-protected", password_protected,
@@ -369,10 +368,7 @@ rb_daap_source_new (RBShell *shell,
NULL));
g_object_unref (settings);
g_object_unref (builder);
-
- if (icon != NULL) {
- g_object_unref (icon);
- }
+ g_object_unref (icon);
rb_shell_register_entry_type_for_source (shell, source, entry_type);
@@ -526,8 +522,8 @@ connection_connecting_cb (DMAPConnection *connection,
float progress,
RBDAAPSource *source)
{
- GdkPixbuf *icon;
- gboolean is_connected;
+ GIcon *icon;
+ gboolean is_connected;
GObject *plugin;
rb_debug ("DAAP connection status: %d/%f", state, progress);
@@ -564,11 +560,8 @@ connection_connecting_cb (DMAPConnection *connection,
icon = rb_daap_plugin_get_icon (RB_DAAP_PLUGIN (plugin),
source->priv->password_protected,
is_connected);
- g_object_set (source, "pixbuf", icon, NULL);
- if (icon != NULL) {
- g_object_unref (icon);
- }
-
+ g_object_set (source, "icon", icon, NULL);
+ g_clear_object (&icon);
g_object_unref (plugin);
}
@@ -576,8 +569,8 @@ static void
connection_disconnected_cb (DMAPConnection *connection,
RBDAAPSource *source)
{
- GdkPixbuf *icon;
- GObject *plugin;
+ GIcon *icon;
+ GObject *plugin;
rb_debug ("DAAP connection disconnected");
@@ -589,10 +582,8 @@ connection_disconnected_cb (DMAPConnection *connection,
icon = rb_daap_plugin_get_icon (RB_DAAP_PLUGIN (plugin),
source->priv->password_protected,
FALSE);
- g_object_set (source, "pixbuf", icon, NULL);
- if (icon != NULL) {
- g_object_unref (icon);
- }
+ g_object_set (source, "icon", icon, NULL);
+ g_clear_object (&icon);
}
g_object_unref (plugin);
diff --git a/plugins/daap/rb-dacp-pairing-page.c b/plugins/daap/rb-dacp-pairing-page.c
index c309fc1..9de6320 100644
--- a/plugins/daap/rb-dacp-pairing-page.c
+++ b/plugins/daap/rb-dacp-pairing-page.c
@@ -40,7 +40,6 @@
#include "rhythmdb.h"
#include "rb-shell.h"
#include "rb-display-page-group.h"
-#include "rb-stock-icons.h"
#include "rb-debug.h"
#include "rb-util.h"
#include "rb-file-helpers.h"
@@ -340,18 +339,11 @@ rb_dacp_pairing_page_new (GObject *plugin,
const char *service_name)
{
RBDACPPairingPage *page;
- char *icon_filename;
- int icon_size;
- GdkPixbuf *icon_pixbuf;
-
- icon_filename = rb_find_plugin_data_file (plugin, "remote-icon.png");
- gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &icon_size, NULL);
- icon_pixbuf = gdk_pixbuf_new_from_file_at_size (icon_filename, icon_size, icon_size, NULL);
page = RB_DACP_PAIRING_PAGE (g_object_new (RB_TYPE_DACP_PAIRING_PAGE,
"name", display_name,
"service-name", service_name,
- "pixbuf", icon_pixbuf,
+ "icon", g_themed_icon_new ("phone-symbolic"),
"shell", shell,
"plugin", plugin,
NULL));
@@ -361,9 +353,6 @@ rb_dacp_pairing_page_new (GObject *plugin,
/* Retrieve notifications when the remote is finished pairing */
g_signal_connect_object (dacp_share, "remote-paired", G_CALLBACK (remote_paired_cb), page, 0);
- g_free (icon_filename);
- g_object_unref (icon_pixbuf);
-
return page;
}
diff --git a/plugins/grilo/rb-grilo-plugin.c b/plugins/grilo/rb-grilo-plugin.c
index affb9ca..b1c4708 100644
--- a/plugins/grilo/rb-grilo-plugin.c
+++ b/plugins/grilo/rb-grilo-plugin.c
@@ -54,6 +54,7 @@ static const char *ignored_plugins[] = {
"grl-apple-trailers",
"grl-bliptv",
"grl-bookmarks",
+ "grl-dmap",
"grl-filesystem",
"grl-flickr",
"grl-optical-media",
diff --git a/plugins/grilo/rb-grilo-source.c b/plugins/grilo/rb-grilo-source.c
index 3928d41..404fc7b 100644
--- a/plugins/grilo/rb-grilo-source.c
+++ b/plugins/grilo/rb-grilo-source.c
@@ -440,6 +440,7 @@ rb_grilo_source_new (GObject *plugin, GrlSource *grilo_source)
"grilo-source", grilo_source,
NULL);
g_object_unref (settings);
+ rb_display_page_set_icon_name (RB_DISPLAY_PAGE (source), "network-server-symbolic");
rb_shell_register_entry_type_for_source (shell, RB_SOURCE (source), entry_type);
diff --git a/plugins/ipod/rb-ipod-source.c b/plugins/ipod/rb-ipod-source.c
index f0f6db7..974f05c 100644
--- a/plugins/ipod/rb-ipod-source.c
+++ b/plugins/ipod/rb-ipod-source.c
@@ -53,7 +53,6 @@
#include "rb-playlist-manager.h"
#include "rb-podcast-manager.h"
#include "rb-podcast-entry-types.h"
-#include "rb-stock-icons.h"
#include "rb-gst-media-types.h"
#include "rb-transfer-target.h"
#include "rb-ext-db.h"
@@ -679,24 +678,6 @@ ipod_path_to_uri (const char *mount_point, const char *ipod_path)
return uri;
}
-static void
-set_podcast_icon (RBIpodStaticPlaylistSource *source)
-{
- GdkPixbuf *pixbuf;
- gint size;
-
- gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- RB_STOCK_PODCAST,
- size,
- 0, NULL);
-
- if (pixbuf != NULL) {
- g_object_set (source, "pixbuf", pixbuf, NULL);
- g_object_unref (pixbuf);
- }
-}
-
static RBIpodStaticPlaylistSource *
add_rb_playlist (RBiPodSource *source, Itdb_Playlist *playlist)
{
@@ -745,7 +726,7 @@ add_rb_playlist (RBiPodSource *source, Itdb_Playlist *playlist)
if (itdb_playlist_is_podcasts(playlist)) {
priv->podcast_pl = playlist_source;
- set_podcast_icon (playlist_source);
+ rb_display_page_set_icon_name (RB_DISPLAY_PAGE (playlist_source),
"application-rss+xml-symbolic");
}
rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (playlist_source), RB_DISPLAY_PAGE (source));
g_object_unref (shell);
diff --git a/plugins/iradio/rb-iradio-source.c b/plugins/iradio/rb-iradio-source.c
index 5118201..90886e5 100644
--- a/plugins/iradio/rb-iradio-source.c
+++ b/plugins/iradio/rb-iradio-source.c
@@ -38,7 +38,6 @@
#include "rb-iradio-source-search.h"
#include "rhythmdb-query-model.h"
-#include "rb-stock-icons.h"
#include "rb-entry-view.h"
#include "rb-property-view.h"
#include "rb-util.h"
@@ -57,10 +56,6 @@
#include "rb-builder-helpers.h"
#include "rb-application.h"
-/* icon names */
-#define IRADIO_SOURCE_ICON "library-internet-radio"
-#define IRADIO_NEW_STATION_ICON "internet-radio-new"
-
typedef struct _RhythmDBEntryType RBIRadioEntryType;
typedef struct _RhythmDBEntryTypeClass RBIRadioEntryTypeClass;
@@ -273,8 +268,6 @@ rb_iradio_source_constructed (GObject *object)
GtkAccelGroup *accel_group;
GtkWidget *grid;
GtkWidget *paned;
- gint size;
- GdkPixbuf *pixbuf;
GActionEntry actions[] = {
{ "iradio-new-station", new_station_action_cb },
};
@@ -292,15 +285,7 @@ rb_iradio_source_constructed (GObject *object)
NULL);
g_object_unref (shell);
- gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- IRADIO_SOURCE_ICON,
- size,
- 0, NULL);
- g_object_set (source, "pixbuf", pixbuf, NULL);
- if (pixbuf != NULL) {
- g_object_unref (pixbuf);
- }
+ rb_display_page_set_icon_name (RB_DISPLAY_PAGE (source), "network-server-symbolic");
settings = g_settings_new ("org.gnome.rhythmbox.plugins.iradio");
if (g_settings_get_boolean (settings, "initial-stations-loaded") == FALSE) {
diff --git a/plugins/magnatune/Makefile.am b/plugins/magnatune/Makefile.am
index 50b348b..53e62b6 100644
--- a/plugins/magnatune/Makefile.am
+++ b/plugins/magnatune/Makefile.am
@@ -21,14 +21,9 @@ gtkbuilder_DATA = \
magnatune-prefs.ui \
magnatune-toolbar.ui \
magnatune_logo_color_small.png \
- magnatune_logo_color_tiny.png
+ magnatune_logo_color_tiny.png \
+ magnatune-symbolic.svg
-themedir = $(pkgdatadir)/icons/hicolor
-size = 24x24
-context = places
-icondir = $(themedir)/$(size)/$(context)
-icon_DATA = icons/hicolor/$(size)/$(context)/magnatune.png
-
-EXTRA_DIST = $(plugin_in_files) $(gtkbuilder_DATA) $(icon_DATA)
+EXTRA_DIST = $(plugin_in_files) $(gtkbuilder_DATA)
CLEANFILES = $(plugin_DATA)
DISTCLEANFILES = $(plugin_DATA)
diff --git a/plugins/magnatune/magnatune-symbolic.svg b/plugins/magnatune/magnatune-symbolic.svg
new file mode 100644
index 0000000..2134ce1
--- /dev/null
+++ b/plugins/magnatune/magnatune-symbolic.svg
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ width="65"
+ height="67"
+ sodipodi:docname="magnatune-icon.svg">
+ <metadata
+ id="metadata8">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs6" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1280"
+ inkscape:window-height="746"
+ id="namedview4"
+ showgrid="false"
+ inkscape:zoom="6.1757813"
+ inkscape:cx="5.5214775"
+ inkscape:cy="32.825251"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg2" />
+ <rect
+ style="fill-opacity:1;stroke:none"
+ id="rect5207"
+ width="6.6503477"
+ height="20.48934"
+ x="18.777695"
+ y="27.631033"
+ rx="1.1780093"
+ ry="1.144017" />
+ <rect
+ style="fill-opacity:1;stroke:none"
+ id="rect5209"
+ width="6.6503477"
+ height="32.081989"
+ x="29.950281"
+ y="16.03838"
+ rx="1.1780093"
+ ry="1.144017" />
+ <rect
+ style="fill-opacity:1;stroke:none"
+ id="rect5211"
+ width="6.6503477"
+ height="20.48934"
+ x="40.324821"
+ y="27.631033"
+ rx="1.1780093"
+ ry="1.144017" />
+ <path
+
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:5.5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
+ d="m 32.505554,1.207602 c -17.889667,0 -32.45987484,14.570208 -32.45987484,32.459875 0,17.889666
14.57020784,32.459874 32.45987484,32.459874 17.827626,0 32.323394,-14.475792 32.423967,-32.28034 a
3.1601268,3.1601268 0 0 0 0.03591,-0.251348 3.1601268,3.1601268 0 0 0 0,-0.07181 3.1601268,3.1601268 0 0 0
0,-0.215442 C 64.770655,15.557474 50.257556,1.207602 32.505554,1.207602 z m 0,6.3196216 c 14.361144,0
25.982684,11.4927174 26.140253,25.8529974 a 3.1601268,3.1601268 0 0 0 0,0.07181 3.1601268,3.1601268 0 0 0
0,0.215442 c 0,14.47429 -11.665963,26.140253 -26.140253,26.140253 -14.474291,0 -26.1402532,-11.665963
-26.1402532,-26.140253 0,-14.474291 11.6659622,-26.1402534 26.1402532,-26.1402534 z"
+ id="path2986"
+ inkscape:connector-curvature="0" />
+</svg>
diff --git a/plugins/magnatune/magnatune.py b/plugins/magnatune/magnatune.py
index a8d482f..4dd4ff1 100644
--- a/plugins/magnatune/magnatune.py
+++ b/plugins/magnatune/magnatune.py
@@ -95,12 +95,6 @@ class Magnatune(GObject.GObject, Peas.Activatable):
self.settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")
- theme = Gtk.IconTheme.get_default()
- rb.append_plugin_source_path(theme, "/icons")
-
- what, width, height = Gtk.icon_size_lookup(Gtk.IconSize.LARGE_TOOLBAR)
- icon = rb.try_load_icon(theme, "magnatune", width, 0)
-
app = Gio.Application.get_default()
action = Gio.SimpleAction(name="magnatune-album-download")
action.connect("activate", self.download_album_action_cb)
@@ -117,10 +111,11 @@ class Magnatune(GObject.GObject, Peas.Activatable):
group = RB.DisplayPageGroup.get_by_id ("stores")
settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune")
+ iconfile = Gio.File.new_for_path(rb.find_plugin_file(self, "magnatune-symbolic.svg"))
self.source = GObject.new(MagnatuneSource,
shell=shell,
entry_type=self.entry_type,
- pixbuf=icon,
+ icon=Gio.FileIcon.new(iconfile),
plugin=self,
settings=settings.get_child("source"),
name=_("Magnatune"),
diff --git a/plugins/mtpdevice/rb-mtp-source.c b/plugins/mtpdevice/rb-mtp-source.c
index ca0bd36..a07ddb0 100644
--- a/plugins/mtpdevice/rb-mtp-source.c
+++ b/plugins/mtpdevice/rb-mtp-source.c
@@ -374,10 +374,6 @@ rb_mtp_source_constructed (GObject *object)
RBShell *shell;
RBShellPlayer *shell_player;
GObject *player_backend;
- GtkIconTheme *theme;
- GdkPixbuf *pixbuf;
- gint size;
-
RB_CHAIN_GOBJECT_METHOD (rb_mtp_source_parent_class, constructed, object);
source = RB_MTP_SOURCE (object);
@@ -409,14 +405,7 @@ rb_mtp_source_constructed (GObject *object)
G_CALLBACK (prepare_encoder_sink_cb),
source, 0);
- /* icon */
- theme = gtk_icon_theme_get_default ();
- gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &size, NULL);
- pixbuf = gtk_icon_theme_load_icon (theme, "multimedia-player", size, 0, NULL);
-
- g_object_set (source, "pixbuf", pixbuf, NULL);
- g_object_unref (pixbuf);
-
+ rb_display_page_set_icon_name (RB_DISPLAY_PAGE (source), "multimedia-player-symbolic");
}
static void
diff --git a/plugins/visualizer/rb-visualizer-page.c b/plugins/visualizer/rb-visualizer-page.c
index 98639a5..4179843 100644
--- a/plugins/visualizer/rb-visualizer-page.c
+++ b/plugins/visualizer/rb-visualizer-page.c
@@ -63,26 +63,14 @@ RBVisualizerPage *
rb_visualizer_page_new (GObject *plugin, RBShell *shell, GSimpleAction *fullscreen, GMenuModel *popup)
{
GObject *page;
- GdkPixbuf *pixbuf;
- gint size;
-
- gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- "visualization",
- size,
- 0, NULL);
-
page = g_object_new (RB_TYPE_VISUALIZER_PAGE,
"plugin", plugin,
"shell", shell,
"name", _("Visual Effects"),
- "pixbuf", pixbuf,
"fullscreen-action", fullscreen,
"popup", popup,
NULL);
- if (pixbuf != NULL) {
- g_object_unref (pixbuf);
- }
+ rb_display_page_set_icon_name (RB_DISPLAY_PAGE (page), "video-display-symbolic");
return RB_VISUALIZER_PAGE (page);
}
diff --git a/podcast/rb-podcast-main-source.c b/podcast/rb-podcast-main-source.c
index ec573a4..b583087 100644
--- a/podcast/rb-podcast-main-source.c
+++ b/podcast/rb-podcast-main-source.c
@@ -38,7 +38,6 @@
#include "rb-builder-helpers.h"
#include "rb-file-helpers.h"
#include "rb-util.h"
-#include "rb-stock-icons.h"
#include "rb-application.h"
struct _RBPodcastMainSourcePrivate
@@ -124,7 +123,7 @@ rb_podcast_main_source_add_subsources (RBPodcastMainSource *source)
podcast_mgr,
query,
_("New Episodes"),
- RB_STOCK_AUTO_PLAYLIST);
+ "document-open-recent-symbolic");
rhythmdb_query_free (query);
rb_source_set_hidden_when_empty (podcast_subsource, TRUE);
rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (podcast_subsource), RB_DISPLAY_PAGE (source));
@@ -142,7 +141,7 @@ rb_podcast_main_source_add_subsources (RBPodcastMainSource *source)
podcast_mgr,
query,
_("New Downloads"), /* better name? */
- RB_STOCK_AUTO_PLAYLIST);
+ "folder-download-symbolic");
rhythmdb_query_free (query);
rb_source_set_hidden_when_empty (podcast_subsource, TRUE);
rb_shell_append_display_page (shell, RB_DISPLAY_PAGE (podcast_subsource), RB_DISPLAY_PAGE (source));
@@ -359,8 +358,6 @@ impl_constructed (GObject *object)
{
RBPodcastMainSource *source;
RBPodcastManager *podcast_mgr;
- GdkPixbuf *pixbuf;
- gint size;
RB_CHAIN_GOBJECT_METHOD (rb_podcast_main_source_parent_class, constructed, object);
source = RB_PODCAST_MAIN_SOURCE (object);
@@ -387,16 +384,7 @@ impl_constructed (GObject *object)
G_CALLBACK (feed_error_cb),
source, 0);
- gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- RB_STOCK_PODCAST,
- size,
- 0, NULL);
-
- if (pixbuf != NULL) {
- g_object_set (source, "pixbuf", pixbuf, NULL);
- g_object_unref (pixbuf);
- }
+ rb_display_page_set_icon_name (RB_DISPLAY_PAGE (source), "application-rss+xml-symbolic");
}
static void
diff --git a/podcast/rb-podcast-source.c b/podcast/rb-podcast-source.c
index b178b21..52c2513 100644
--- a/podcast/rb-podcast-source.c
+++ b/podcast/rb-podcast-source.c
@@ -49,7 +49,6 @@
#include "rhythmdb.h"
#include "rhythmdb-query-model.h"
#include "rb-shell-player.h"
-#include "rb-stock-icons.h"
#include "rb-entry-view.h"
#include "rb-property-view.h"
#include "rb-util.h"
@@ -1026,25 +1025,10 @@ rb_podcast_source_new (RBShell *shell,
"settings", g_settings_get_child (settings, "source"),
"toolbar-menu", toolbar,
NULL));
+ rb_display_page_set_icon_name (RB_DISPLAY_PAGE (source), icon_name);
g_object_unref (settings);
g_object_unref (builder);
- if (icon_name != NULL) {
- GdkPixbuf *pixbuf;
- gint size;
-
- gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- icon_name,
- size,
- 0, NULL);
-
- if (pixbuf != NULL) {
- g_object_set (source, "pixbuf", pixbuf, NULL);
- g_object_unref (pixbuf);
- }
- }
-
return source;
}
diff --git a/sources/rb-auto-playlist-source.c b/sources/rb-auto-playlist-source.c
index 95396bb..acd59e7 100644
--- a/sources/rb-auto-playlist-source.c
+++ b/sources/rb-auto-playlist-source.c
@@ -38,7 +38,6 @@
#include "rb-library-browser.h"
#include "rb-util.h"
#include "rb-debug.h"
-#include "rb-stock-icons.h"
#include "rb-playlist-xml.h"
#include "rb-source-search-basic.h"
#include "rb-source-toolbar.h"
@@ -129,8 +128,6 @@ struct _RBAutoPlaylistSourcePrivate
GAction *search_action;
};
-static gpointer playlist_pixbuf = NULL;
-
G_DEFINE_TYPE (RBAutoPlaylistSource, rb_auto_playlist_source, RB_TYPE_PLAYLIST_SOURCE)
#define GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), RB_TYPE_AUTO_PLAYLIST_SOURCE,
RBAutoPlaylistSourcePrivate))
@@ -165,29 +162,6 @@ rb_auto_playlist_source_class_init (RBAutoPlaylistSourceClass *klass)
}
static void
-set_playlist_pixbuf (RBAutoPlaylistSource *source)
-{
- if (playlist_pixbuf == NULL) {
- gint size;
-
- gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
- playlist_pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- RB_STOCK_AUTO_PLAYLIST,
- size,
- 0, NULL);
- if (playlist_pixbuf) {
- g_object_add_weak_pointer (playlist_pixbuf,
- (gpointer *) &playlist_pixbuf);
-
- g_object_set (source, "pixbuf", playlist_pixbuf, NULL);
- g_object_unref (playlist_pixbuf);
- }
- } else {
- g_object_set (source, "pixbuf", playlist_pixbuf, NULL);
- }
-}
-
-static void
rb_auto_playlist_source_init (RBAutoPlaylistSource *source)
{
}
@@ -245,7 +219,7 @@ rb_auto_playlist_source_constructed (GObject *object)
priv->paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
- set_playlist_pixbuf (source);
+ rb_display_page_set_icon_name (RB_DISPLAY_PAGE (source), "folder-saved-search-symbolic");
g_object_get (RB_PLAYLIST_SOURCE (source), "entry-type", &entry_type, NULL);
priv->browser = rb_library_browser_new (rb_playlist_source_get_db (RB_PLAYLIST_SOURCE (source)),
diff --git a/sources/rb-device-source.c b/sources/rb-device-source.c
index ced3a75..577a2de 100644
--- a/sources/rb-device-source.c
+++ b/sources/rb-device-source.c
@@ -332,7 +332,6 @@ rb_device_source_set_display_details (RBDeviceSource *source)
GVolume *volume = NULL;
GIcon *icon = NULL;
char *display_name;
- GdkPixbuf *pixbuf = NULL;
if (g_object_class_find_property (G_OBJECT_GET_CLASS (source), "volume")) {
g_object_get (source, "volume", &volume, NULL);
@@ -352,58 +351,23 @@ rb_device_source_set_display_details (RBDeviceSource *source)
if (mount != NULL) {
display_name = g_mount_get_name (mount);
- icon = g_mount_get_icon (mount);
+ icon = g_mount_get_symbolic_icon (mount);
rb_debug ("details from mount: display name = %s, icon = %p", display_name, icon);
} else if (volume != NULL) {
display_name = g_volume_get_name (volume);
- icon = g_volume_get_icon (volume);
+ icon = g_volume_get_symbolic_icon (volume);
rb_debug ("details from volume: display name = %s, icon = %p", display_name, icon);
} else {
display_name = g_strdup ("Unknown Device");
- icon = g_themed_icon_new ("multimedia-player");
+ icon = g_themed_icon_new ("multimedia-player-symbolic");
}
- g_object_set (source, "name", display_name, NULL);
+ g_object_set (source, "name", display_name, "icon", icon, NULL);
g_free (display_name);
- if (icon == NULL) {
- rb_debug ("no icon set");
- pixbuf = NULL;
- } else if (G_IS_THEMED_ICON (icon)) {
- GtkIconTheme *theme;
- const char * const *names;
- gint size;
- int i;
-
- theme = gtk_icon_theme_get_default ();
- gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
-
- i = 0;
- names = g_themed_icon_get_names (G_THEMED_ICON (icon));
- while (names[i] != NULL && pixbuf == NULL) {
- rb_debug ("looking up themed icon: %s", names[i]);
- pixbuf = gtk_icon_theme_load_icon (theme, names[i], size, 0, NULL);
- i++;
- }
-
- } else if (G_IS_LOADABLE_ICON (icon)) {
- rb_debug ("loading of GLoadableIcons is not implemented yet");
- pixbuf = NULL;
- }
-
- if (pixbuf != NULL) {
- g_object_set (source, "pixbuf", pixbuf, NULL);
- g_object_unref (pixbuf);
- }
- if (mount != NULL) {
- g_object_unref (mount);
- }
- if (volume != NULL) {
- g_object_unref (volume);
- }
- if (icon != NULL) {
- g_object_unref (icon);
- }
+ g_clear_object (&mount);
+ g_clear_object (&volume);
+ g_clear_object (&icon);
}
static void
diff --git a/sources/rb-display-page-tree.c b/sources/rb-display-page-tree.c
index c5466bc..c8b3cd3 100644
--- a/sources/rb-display-page-tree.c
+++ b/sources/rb-display-page-tree.c
@@ -99,6 +99,8 @@ struct _RBDisplayPageTreePrivate
GSimpleAction *remove_action;
GSimpleAction *eject_action;
+
+ GdkPixbuf *blank_pixbuf;
};
@@ -276,27 +278,36 @@ pixbuf_cell_data_func (GtkTreeViewColumn *tree_column,
RBDisplayPageTree *display_page_tree)
{
RBDisplayPage *page;
- GdkPixbuf *pixbuf;
+ GtkTreePath *path;
+ GIcon *icon = NULL;
+ path = gtk_tree_model_get_path (model, iter);
gtk_tree_model_get (model, iter,
RB_DISPLAY_PAGE_MODEL_COLUMN_PAGE, &page,
-1);
- g_object_get (page, "pixbuf", &pixbuf, NULL);
- if (pixbuf == NULL) {
- g_object_set (cell,
- "visible", FALSE,
- "pixbuf", NULL,
- NULL);
- } else {
- g_object_set (cell,
- "visible", TRUE,
- "pixbuf", pixbuf,
- NULL);
- g_object_unref (pixbuf);
+ switch (gtk_tree_path_get_depth (path)) {
+ case 1:
+ g_object_set (cell, "visible", FALSE, NULL);
+ break;
+
+ case 2:
+ case 3:
+ g_object_get (page, "icon", &icon, NULL);
+ if (icon == NULL) {
+ g_object_set (cell, "visible", TRUE, "pixbuf", display_page_tree->priv->blank_pixbuf,
NULL);
+ } else {
+ g_object_set (cell, "visible", TRUE, "gicon", icon, NULL);
+ g_object_unref (icon);
+ }
+ break;
+
+ default:
+ g_object_set (cell, "visible", TRUE, "pixbuf", display_page_tree->priv->blank_pixbuf, NULL);
+ break;
}
- set_cell_background (display_page_tree, cell, RB_IS_DISPLAY_PAGE_GROUP (page), FALSE);
+ gtk_tree_path_free (path);
g_object_unref (page);
}
@@ -849,6 +860,16 @@ impl_get_property (GObject *object,
}
static void
+impl_dispose (GObject *object)
+{
+ RBDisplayPageTree *display_page_tree = RB_DISPLAY_PAGE_TREE (object);
+
+ g_clear_object (&display_page_tree->priv->blank_pixbuf);
+
+ G_OBJECT_CLASS (rb_display_page_tree_parent_class)->dispose (object);
+}
+
+static void
impl_finalize (GObject *object)
{
RBDisplayPageTree *display_page_tree = RB_DISPLAY_PAGE_TREE (object);
@@ -881,6 +902,7 @@ impl_constructed (GObject *object)
GtkBuilder *builder;
GApplication *app;
GtkAccelGroup *accel_group;
+ int pixbuf_width, pixbuf_height;
GActionEntry actions[] = {
{ "display-page-remove", remove_action_cb },
@@ -953,7 +975,11 @@ impl_constructed (GObject *object)
gtk_tree_view_append_column (GTK_TREE_VIEW (display_page_tree->priv->treeview),
display_page_tree->priv->main_column);
- /* Set up the indent level1 column */
+ gtk_icon_size_lookup (RB_DISPLAY_PAGE_ICON_SIZE, &pixbuf_width, &pixbuf_height);
+ display_page_tree->priv->blank_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, pixbuf_width,
pixbuf_height);
+ gdk_pixbuf_fill (display_page_tree->priv->blank_pixbuf, 0);
+
+ /* headings */
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (display_page_tree->priv->main_column, renderer, FALSE);
gtk_tree_view_column_set_cell_data_func (display_page_tree->priv->main_column,
@@ -987,13 +1013,7 @@ impl_constructed (GObject *object)
(GtkTreeCellDataFunc) pixbuf_cell_data_func,
display_page_tree,
NULL);
-
- g_object_set (renderer,
- "xpad", 8,
- "ypad", 1,
- "visible", FALSE,
- NULL);
-
+ g_object_set (renderer, "follow-state", TRUE, NULL);
/* Set up the name column */
renderer = gtk_cell_renderer_text_new ();
@@ -1120,6 +1140,7 @@ rb_display_page_tree_class_init (RBDisplayPageTreeClass *class)
o_class = (GObjectClass *) class;
o_class->constructed = impl_constructed;
+ o_class->dispose = impl_dispose;
o_class->finalize = impl_finalize;
o_class->set_property = impl_set_property;
o_class->get_property = impl_get_property;
diff --git a/sources/rb-display-page.c b/sources/rb-display-page.c
index da5cb4f..f5c465d 100644
--- a/sources/rb-display-page.c
+++ b/sources/rb-display-page.c
@@ -45,7 +45,7 @@ G_DEFINE_ABSTRACT_TYPE (RBDisplayPage, rb_display_page, GTK_TYPE_HBOX)
* display pages too.
*
* The display page object itself is the widget shown in the main display area.
- * The pixbuf and name properties control its appearance in the display page
+ * The icon and name properties control its appearance in the display page
* tree, and its location is determined by its parent display page, the sorting
* rules for its source group (if any), and insertion order. The visibility property
* controls whether the display page is actually shown in the display page tree at all.
@@ -56,7 +56,7 @@ struct _RBDisplayPagePrivate
char *name;
gboolean visible;
gboolean selected;
- GdkPixbuf *pixbuf;
+ GIcon *icon;
RBDisplayPage *parent;
GObject *plugin;
@@ -72,7 +72,7 @@ enum
PROP_0,
PROP_SHELL,
PROP_NAME,
- PROP_PIXBUF,
+ PROP_ICON,
PROP_VISIBLE,
PROP_PARENT,
PROP_PLUGIN,
@@ -437,6 +437,23 @@ _rb_add_display_page_actions (GActionMap *map, GObject *shell, const GActionEntr
}
}
+/**
+ * rb_display_page_set_icon_name:
+ * @page: a #RBDisplayPage
+ * @icon_name: icon name to use
+ *
+ * Sets the icon for the page to the specified icon name.
+ */
+void
+rb_display_page_set_icon_name (RBDisplayPage *page, const char *icon_name)
+{
+ GIcon *icon;
+
+ icon = g_themed_icon_new (icon_name);
+ g_object_set (page, "icon", icon, NULL);
+ g_object_unref (icon);
+}
+
static void
impl_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
@@ -449,8 +466,8 @@ impl_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *ps
case PROP_NAME:
g_value_set_string (value, page->priv->name);
break;
- case PROP_PIXBUF:
- g_value_set_object (value, page->priv->pixbuf);
+ case PROP_ICON:
+ g_value_set_object (value, page->priv->icon);
break;
case PROP_VISIBLE:
g_value_set_boolean (value, page->priv->visible);
@@ -483,11 +500,9 @@ impl_set_property (GObject *object, guint prop_id, const GValue *value, GParamSp
g_free (page->priv->name);
page->priv->name = g_value_dup_string (value);
break;
- case PROP_PIXBUF:
- if (page->priv->pixbuf) {
- g_object_unref (page->priv->pixbuf);
- }
- page->priv->pixbuf = g_value_dup_object (value);
+ case PROP_ICON:
+ g_clear_object (&page->priv->icon);
+ page->priv->icon = g_value_dup_object (value);
break;
case PROP_VISIBLE:
page->priv->visible = g_value_get_boolean (value);
@@ -529,10 +544,7 @@ impl_dispose (GObject *object)
page = RB_DISPLAY_PAGE (object);
rb_debug ("Disposing page %s", page->priv->name);
- if (page->priv->pixbuf != NULL) {
- g_object_unref (page->priv->pixbuf);
- page->priv->pixbuf = NULL;
- }
+ g_clear_object (&page->priv->icon);
G_OBJECT_CLASS (rb_display_page_parent_class)->dispose (object);
}
@@ -601,16 +613,16 @@ rb_display_page_class_init (RBDisplayPageClass *klass)
NULL,
G_PARAM_READWRITE));
/**
- * RBDisplayPage:pixbuf:
+ * RBDisplayPage:icon:
*
- * Pixbuf to display in the page tree
+ * Icon to display in the page tree
*/
g_object_class_install_property (object_class,
- PROP_PIXBUF,
- g_param_spec_object ("pixbuf",
- "Pixbuf",
- "Page pixbuf",
- GDK_TYPE_PIXBUF,
+ PROP_ICON,
+ g_param_spec_object ("icon",
+ "Icon",
+ "Page icon",
+ G_TYPE_ICON,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
/**
* RBDisplayPage:visibility:
diff --git a/sources/rb-display-page.h b/sources/rb-display-page.h
index fb5be4d..e00692f 100644
--- a/sources/rb-display-page.h
+++ b/sources/rb-display-page.h
@@ -45,7 +45,7 @@ typedef struct _RBDisplayPagePrivate RBDisplayPagePrivate;
#define RB_IS_DISPLAY_PAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_DISPLAY_PAGE))
#define RB_DISPLAY_PAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_DISPLAY_PAGE,
RBDisplayPageClass))
-#define RB_DISPLAY_PAGE_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
+#define RB_DISPLAY_PAGE_ICON_SIZE GTK_ICON_SIZE_MENU
struct _RBDisplayPage
{
@@ -95,6 +95,8 @@ void rb_display_page_delete_thyself (RBDisplayPage *page);
gboolean rb_display_page_can_remove (RBDisplayPage *page);
void rb_display_page_remove (RBDisplayPage *page);
+void rb_display_page_set_icon_name (RBDisplayPage *page, const char *icon_name);
+
/* things for display page implementations */
void rb_display_page_notify_status_changed (RBDisplayPage *page);
diff --git a/sources/rb-import-errors-source.c b/sources/rb-import-errors-source.c
index ac70a76..8beae22 100644
--- a/sources/rb-import-errors-source.c
+++ b/sources/rb-import-errors-source.c
@@ -156,20 +156,9 @@ rb_import_errors_source_class_init (RBImportErrorsSourceClass *klass)
static void
rb_import_errors_source_init (RBImportErrorsSource *source)
{
- gint size;
- GdkPixbuf *pixbuf;
-
source->priv = G_TYPE_INSTANCE_GET_PRIVATE (source, RB_TYPE_IMPORT_ERRORS_SOURCE,
RBImportErrorsSourcePrivate);
- gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- "dialog-error",
- size,
- 0, NULL);
- g_object_set (source, "pixbuf", pixbuf, NULL);
- if (pixbuf != NULL) {
- g_object_unref (pixbuf);
- }
+ rb_display_page_set_icon_name (RB_DISPLAY_PAGE (source), "dialog-error-symbolic");
}
static void
diff --git a/sources/rb-library-source.c b/sources/rb-library-source.c
index e4f403b..9ebd4a3 100644
--- a/sources/rb-library-source.c
+++ b/sources/rb-library-source.c
@@ -423,17 +423,9 @@ RBSource *
rb_library_source_new (RBShell *shell)
{
RBSource *source;
- GdkPixbuf *icon;
GSettings *settings;
GtkBuilder *builder;
GMenu *toolbar;
- gint size;
-
- gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
- icon = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- "audio-x-generic",
- size,
- 0, NULL);
settings = g_settings_new ("org.gnome.rhythmbox.library");
builder = rb_builder_load ("library-toolbar.ui", NULL);
@@ -444,14 +436,11 @@ rb_library_source_new (RBShell *shell)
"name", _("Music"),
"entry-type", RHYTHMDB_ENTRY_TYPE_SONG,
"shell", shell,
- "pixbuf", icon,
"populate", FALSE, /* wait until the database is loaded
*/
"toolbar-menu", toolbar,
"settings", g_settings_get_child (settings, "source"),
NULL));
- if (icon != NULL) {
- g_object_unref (icon);
- }
+ rb_display_page_set_icon_name (RB_DISPLAY_PAGE (source), "folder-music-symbolic");
g_object_unref (settings);
g_object_unref (builder);
@@ -1899,7 +1888,7 @@ rb_library_source_add_child_source (const char *path, RBLibrarySource *library_s
GPtrArray *query;
RBShell *shell;
char *name;
- GdkPixbuf *icon;
+ GIcon *icon;
RhythmDBEntryType *entry_type;
char *sort_column;
int sort_order;
@@ -1910,7 +1899,7 @@ rb_library_source_add_child_source (const char *path, RBLibrarySource *library_s
"shell", &shell,
"entry-type", &entry_type,
"playlist-menu", &playlist_menu,
- "pixbuf", &icon,
+ "icon", &icon,
NULL);
file = g_file_new_for_uri (path);
@@ -1932,7 +1921,7 @@ rb_library_source_add_child_source (const char *path, RBLibrarySource *library_s
g_free (sort_column);
g_object_set (source,
- "pixbuf", icon,
+ "icon", icon,
"playlist-menu", playlist_menu,
NULL);
diff --git a/sources/rb-missing-files-source.c b/sources/rb-missing-files-source.c
index 86b3a1f..4837e74 100644
--- a/sources/rb-missing-files-source.c
+++ b/sources/rb-missing-files-source.c
@@ -122,20 +122,9 @@ rb_missing_files_source_class_init (RBMissingFilesSourceClass *klass)
static void
rb_missing_files_source_init (RBMissingFilesSource *source)
{
- gint size;
- GdkPixbuf *pixbuf;
-
source->priv = G_TYPE_INSTANCE_GET_PRIVATE (source, RB_TYPE_MISSING_FILES_SOURCE,
RBMissingFilesSourcePrivate);
- gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- "dialog-warning",
- size,
- 0, NULL);
- g_object_set (source, "pixbuf", pixbuf, NULL);
- if (pixbuf != NULL) {
- g_object_unref (pixbuf);
- }
+ rb_display_page_set_icon_name (RB_DISPLAY_PAGE (source), "dialog-warning-symbolic");
}
static void
diff --git a/sources/rb-play-queue-source.c b/sources/rb-play-queue-source.c
index e607b27..e5508a7 100644
--- a/sources/rb-play-queue-source.c
+++ b/sources/rb-play-queue-source.c
@@ -36,7 +36,6 @@
#include "rb-play-queue-source.h"
#include "rb-playlist-xml.h"
#include "rb-song-info.h"
-#include "rb-stock-icons.h"
#include "rb-util.h"
#include "rb-debug.h"
#include "rb-play-order-queue.h"
diff --git a/sources/rb-source.h b/sources/rb-source.h
index 6e52587..30ff1f3 100644
--- a/sources/rb-source.h
+++ b/sources/rb-source.h
@@ -71,8 +71,6 @@ GType rb_source_load_status_get_type (void);
#define RB_IS_SOURCE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_SOURCE))
#define RB_SOURCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_SOURCE, RBSourceClass))
-#define RB_SOURCE_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
-
typedef gboolean (*RBSourceFeatureFunc) (RBSource *source);
typedef const char * (*RBSourceStringFunc) (RBSource *source);
typedef void (*RBSourceAddCallback) (RBSource *source, const char *uri, gpointer data);
diff --git a/sources/rb-static-playlist-source.c b/sources/rb-static-playlist-source.c
index 24be111..ac81fe6 100644
--- a/sources/rb-static-playlist-source.c
+++ b/sources/rb-static-playlist-source.c
@@ -54,7 +54,6 @@
#include "rb-library-browser.h"
#include "rb-util.h"
#include "rb-debug.h"
-#include "rb-stock-icons.h"
#include "rb-file-helpers.h"
#include "rb-playlist-xml.h"
#include "rb-source-search-basic.h"
@@ -147,8 +146,6 @@ typedef struct
} RBStaticPlaylistSourcePrivate;
-static gpointer playlist_pixbuf = NULL;
-
static void
rb_static_playlist_source_class_init (RBStaticPlaylistSourceClass *klass)
{
@@ -189,30 +186,6 @@ rb_static_playlist_source_class_init (RBStaticPlaylistSourceClass *klass)
}
static void
-set_playlist_pixbuf (RBStaticPlaylistSource *source)
-{
- if (playlist_pixbuf == NULL) {
- gint size;
- gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL);
- playlist_pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- RB_STOCK_PLAYLIST,
- size,
- 0, NULL);
- if (playlist_pixbuf) {
- g_object_add_weak_pointer (playlist_pixbuf,
- (gpointer *) &playlist_pixbuf);
-
- g_object_set (source, "pixbuf", playlist_pixbuf, NULL);
-
- /* drop the initial reference to the icon */
- g_object_unref (playlist_pixbuf);
- }
- } else {
- g_object_set (source, "pixbuf", playlist_pixbuf, NULL);
- }
-}
-
-static void
rb_static_playlist_source_init (RBStaticPlaylistSource *source)
{
}
@@ -269,7 +242,7 @@ rb_static_playlist_source_constructed (GObject *object)
priv = RB_STATIC_PLAYLIST_SOURCE_GET_PRIVATE (source);
psource = RB_PLAYLIST_SOURCE (source);
- set_playlist_pixbuf (source);
+ rb_display_page_set_icon_name (RB_DISPLAY_PAGE (source), "folder-documents-symbolic");
priv->base_model = rb_playlist_source_get_query_model (RB_PLAYLIST_SOURCE (psource));
g_object_set (priv->base_model, "show-hidden", TRUE, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]