[rhythmbox] audioscrobbler: move last.fm icon to a proper theme directory
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] audioscrobbler: move last.fm icon to a proper theme directory
- Date: Mon, 23 Feb 2015 12:18:28 +0000 (UTC)
commit 99646e8fd72715fd571b69f44dc722c1d6c7d8e9
Author: Jonathan Matthew <jonathan d14n org>
Date: Mon Feb 23 20:49:16 2015 +1000
audioscrobbler: move last.fm icon to a proper theme directory
plugins/audioscrobbler/Makefile.am | 8 ++++----
.../hicolor/scalable/places}/Last.fm-symbolic.svg | 0
plugins/audioscrobbler/rb-audioscrobbler-plugin.c | 17 +++++++++++++++++
.../rb-audioscrobbler-profile-page.c | 18 +++++++-----------
4 files changed, 28 insertions(+), 15 deletions(-)
---
diff --git a/plugins/audioscrobbler/Makefile.am b/plugins/audioscrobbler/Makefile.am
index a8d2fad..90d92c3 100644
--- a/plugins/audioscrobbler/Makefile.am
+++ b/plugins/audioscrobbler/Makefile.am
@@ -2,6 +2,8 @@ NULL =
plugindir = $(PLUGINDIR)/audioscrobbler
plugindatadir = $(PLUGINDATADIR)/audioscrobbler
+icondir = $(plugindatadir)/icons/hicolor/scalable/places
+
plugin_LTLIBRARIES = libaudioscrobbler.la
libaudioscrobbler_la_SOURCES = \
@@ -71,14 +73,12 @@ plugin_DATA = \
$(BUILT_SOURCES) \
$(NULL)
-plugindata_DATA = \
- $(top_srcdir)/plugins/audioscrobbler/Last.fm-symbolic.svg \
- $(NULL)
+icon_DATA = icons/hicolor/scalable/places/Last.fm-symbolic.svg
EXTRA_DIST = \
$(plugin_in_files) \
$(gtkbuilder_DATA) \
- $(top_srcdir)/plugins/audioscrobbler/Last.fm-symbolic.svg \
+ $(icon_DATA) \
$(NULL)
CLEANFILES = \
diff --git a/plugins/audioscrobbler/Last.fm-symbolic.svg
b/plugins/audioscrobbler/icons/hicolor/scalable/places/Last.fm-symbolic.svg
similarity index 100%
rename from plugins/audioscrobbler/Last.fm-symbolic.svg
rename to plugins/audioscrobbler/icons/hicolor/scalable/places/Last.fm-symbolic.svg
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
b/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
index 110f447..16a7305 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
@@ -115,6 +115,9 @@ static void
impl_activate (PeasActivatable *bplugin)
{
RBAudioscrobblerPlugin *plugin;
+ PeasPluginInfo *plugin_info;
+ GtkIconTheme *theme;
+ char *icondir;
plugin = RB_AUDIOSCROBBLER_PLUGIN (bplugin);
@@ -129,6 +132,20 @@ impl_activate (PeasActivatable *bplugin)
G_CALLBACK (librefm_settings_changed_cb),
plugin, 0);
librefm_settings_changed_cb (plugin->librefm_settings, AUDIOSCROBBLER_SERVICE_ENABLED_KEY, plugin);
+
+ g_object_get (plugin, "plugin-info", &plugin_info, NULL);
+ theme = gtk_icon_theme_get_default ();
+
+ /* installed icon dir */
+ icondir = g_build_filename (peas_plugin_info_get_data_dir (plugin_info), "icons", NULL);
+ gtk_icon_theme_append_search_path (theme, icondir);
+ g_free (icondir);
+
+#if defined(USE_UNINSTALLED_DIRS)
+ icondir = g_build_filename (peas_plugin_info_get_module_dir (plugin_info), "icons", NULL);
+ gtk_icon_theme_append_search_path (theme, icondir);
+ g_free (icondir);
+#endif
}
static void
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
b/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
index 6e9da54..2effccd 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
@@ -243,20 +243,17 @@ rb_audioscrobbler_profile_page_new (RBShell *shell, GObject *plugin, RBAudioscro
RBDisplayPage *page;
RhythmDB *db;
char *name;
- gchar *icon_name;
- gchar *icon_path;
+ char *iconnames[] = {
+ NULL,
+ "network-server-symbolic",
+ };
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), "-symbolic.svg", NULL);
- icon_path = rb_find_plugin_data_file (plugin, icon_name);
- 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");
- }
+ iconnames[0] = g_strconcat (rb_audioscrobbler_service_get_name (service), "-symbolic", NULL);
+ icon = g_themed_icon_new_from_names (iconnames, 1);
page = RB_DISPLAY_PAGE (g_object_new (RB_TYPE_AUDIOSCROBBLER_PROFILE_PAGE,
"shell", shell,
@@ -268,8 +265,7 @@ rb_audioscrobbler_profile_page_new (RBShell *shell, GObject *plugin, RBAudioscro
g_object_unref (db);
g_free (name);
- g_free (icon_name);
- g_free (icon_path);
+ g_free (iconnames[0]);
g_object_unref (icon);
return page;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]