[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 01/01: Fix icon rendering in preferences dialog
noreply at xfce.org
noreply at xfce.org
Sun Mar 29 03:15:21 CEST 2020
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-pulseaudio-plugin.
commit 4d1d21208bd4d6fe69aebb380812ef95a56f1278
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Sat Mar 28 21:15:16 2020 -0400
Fix icon rendering in preferences dialog
---
panel-plugin/pulseaudio-dialog.c | 25 ++++++++++++++++++++++++-
panel-plugin/pulseaudio-dialog.glade | 8 ++++----
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/panel-plugin/pulseaudio-dialog.c b/panel-plugin/pulseaudio-dialog.c
index 8e2fe37..9223995 100644
--- a/panel-plugin/pulseaudio-dialog.c
+++ b/panel-plugin/pulseaudio-dialog.c
@@ -44,6 +44,8 @@
#include "pulseaudio-dialog_ui.h"
#include "pulseaudio-mpris.h"
+#include <exo/exo.h>
+
#define PLUGIN_WEBSITE "https://docs.xfce.org/apps/pulseaudio-plugin/start"
#ifdef LIBXFCE4UI_CHECK_VERSION
@@ -298,11 +300,32 @@ pulseaudio_dialog_build (PulseaudioDialog *dialog)
gchar *name = NULL;
gchar *icon_name = NULL;
gchar *full_path = NULL;
+ GdkPixbuf *buf = NULL;
if (pulseaudio_mpris_get_player_summary (players[i], &name, &icon_name, &full_path)) {
+ if (g_file_test (icon_name, G_FILE_TEST_EXISTS) && !g_file_test (icon_name, G_FILE_TEST_IS_DIR)) {
+ buf = exo_gdk_pixbuf_new_from_file_at_max_size (icon_name, 16, 16, TRUE, NULL);
+ }
+
+ if (!buf) {
+ GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
+ buf = gtk_icon_theme_load_icon (icon_theme,
+ icon_name,
+ 16,
+ GTK_ICON_LOOKUP_FORCE_SIZE,
+ NULL);
+ if (!buf) {
+ buf = gtk_icon_theme_load_icon (icon_theme,
+ "audio-player",
+ 16,
+ GTK_ICON_LOOKUP_FORCE_SIZE,
+ NULL);
+ }
+ }
+
gtk_list_store_append(liststore, &iter);
gtk_list_store_set(liststore, &iter,
- 0, icon_name,
+ 0, buf,
1, players[i],
2, name,
3, pulseaudio_config_player_blacklist_lookup(dialog->config, players[i]),
diff --git a/panel-plugin/pulseaudio-dialog.glade b/panel-plugin/pulseaudio-dialog.glade
index 20eecea..019dcbc 100644
--- a/panel-plugin/pulseaudio-dialog.glade
+++ b/panel-plugin/pulseaudio-dialog.glade
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.22.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<requires lib="libxfce4ui-2" version="4.11"/>
@@ -15,8 +15,8 @@
</object>
<object class="GtkListStore" id="liststore1">
<columns>
- <!-- column-name icon_name -->
- <column type="gchararray"/>
+ <!-- column-name pixbuf -->
+ <column type="GdkPixbuf"/>
<!-- column-name player -->
<column type="gchararray"/>
<!-- column-name label -->
@@ -414,7 +414,7 @@
<child>
<object class="GtkCellRendererPixbuf" id="col_icon_renderer"/>
<attributes>
- <attribute name="icon-name">0</attribute>
+ <attribute name="pixbuf">0</attribute>
</attributes>
</child>
</object>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list