[rhythmbox] audioscrobbler: Fix displaying icon for libre.fm



commit 97f99444c226aa043cefe8c9f0fbefc1fcae4885
Author: Iain Lane <laney ubuntu com>
Date:   Sun Sep 6 15:20:47 2015 +1000

    audioscrobbler: Fix displaying icon for libre.fm
    
    Use gtk_icon_theme_has_icon to check if a specific icon for the service
    exists, and if not use network-server-symbolic.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749015

 plugins/audioscrobbler/rb-audioscrobbler-plugin.c  |   24 ++++++++++----------
 .../rb-audioscrobbler-profile-page.c               |   14 +++++-----
 2 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-plugin.c 
b/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
index 98eacf9..cc882e3 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-plugin.c
@@ -121,18 +121,6 @@ impl_activate (PeasActivatable *bplugin)
 
        plugin = RB_AUDIOSCROBBLER_PLUGIN (bplugin);
 
-       g_signal_connect_object (plugin->lastfm_settings,
-                                "changed",
-                                G_CALLBACK (lastfm_settings_changed_cb),
-                                plugin, 0);
-       lastfm_settings_changed_cb (plugin->lastfm_settings, AUDIOSCROBBLER_SERVICE_ENABLED_KEY, plugin);
-
-       g_signal_connect_object (plugin->librefm_settings,
-                                "changed",
-                                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 ();
 
@@ -146,6 +134,18 @@ impl_activate (PeasActivatable *bplugin)
        gtk_icon_theme_append_search_path (theme, icondir);
        g_free (icondir);
 #endif
+
+       g_signal_connect_object (plugin->lastfm_settings,
+                                "changed",
+                                G_CALLBACK (lastfm_settings_changed_cb),
+                                plugin, 0);
+       lastfm_settings_changed_cb (plugin->lastfm_settings, AUDIOSCROBBLER_SERVICE_ENABLED_KEY, plugin);
+
+       g_signal_connect_object (plugin->librefm_settings,
+                                "changed",
+                                G_CALLBACK (librefm_settings_changed_cb),
+                                plugin, 0);
+       librefm_settings_changed_cb (plugin->librefm_settings, AUDIOSCROBBLER_SERVICE_ENABLED_KEY, plugin);
 }
 
 static void
diff --git a/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c 
b/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
index 10a68d5..9e6bca0 100644
--- a/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
+++ b/plugins/audioscrobbler/rb-audioscrobbler-profile-page.c
@@ -243,17 +243,17 @@ rb_audioscrobbler_profile_page_new (RBShell *shell, GObject *plugin, RBAudioscro
        RBDisplayPage *page;
        RhythmDB *db;
        char *name;
-       char *iconnames[] = {
-               NULL,
-               "network-server-symbolic",
-       };
+       gchar *icon_name;
        GIcon *icon;
 
        g_object_get (shell, "db", &db, NULL);
        g_object_get (service, "name", &name, NULL);
 
-       iconnames[0] = g_strconcat (rb_audioscrobbler_service_get_name (service), "-symbolic", NULL);
-       icon = g_themed_icon_new_from_names (iconnames, 1);
+       icon_name = g_strconcat (rb_audioscrobbler_service_get_name (service), "-symbolic", NULL);
+       if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), icon_name))
+               icon = g_themed_icon_new (icon_name);
+       else
+               icon = g_themed_icon_new ("network-server-symbolic");
 
        page = RB_DISPLAY_PAGE (g_object_new (RB_TYPE_AUDIOSCROBBLER_PROFILE_PAGE,
                                              "shell", shell,
@@ -265,7 +265,7 @@ rb_audioscrobbler_profile_page_new (RBShell *shell, GObject *plugin, RBAudioscro
 
        g_object_unref (db);
        g_free (name);
-       g_free (iconnames[0]);
+       g_free (icon_name);
        g_object_unref (icon);
 
        return page;


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