[Xfce4-commits] [panel-plugins/xfce4-pulseaudio-plugin] 01/01: Add support for MPRIS players with filenames as icons

noreply at xfce.org noreply at xfce.org
Sat Mar 28 22:05:04 CET 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 c0ee99f46b8a8e46fc35191f64fd944dfbaa2ae7
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sat Mar 28 17:04:58 2020 -0400

    Add support for MPRIS players with filenames as icons
---
 configure.ac.in              |  2 +-
 panel-plugin/Makefile.am     |  2 ++
 panel-plugin/mprismenuitem.c | 12 +++++++++++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 5a1e148..f7c1f54 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -78,7 +78,7 @@ AC_SUBST([LIBXFCE4PANEL_VERSION_API])
 XDT_CHECK_PACKAGE([PULSEAUDIO], [libpulse-mainloop-glib], [0.9.19])
 XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.42.0])
 XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.20.0])
-dnl XDT_CHECK_PACKAGE([EXO], [exo-1], [0.6.0])
+XDT_CHECK_PACKAGE([EXO], [exo-2], [0.11.0])
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.9.0])
 XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.11.0])
 XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-${LIBXFCE4PANEL_VERSION_API}], [4.11.0])
diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am
index 9289f18..44b92b6 100644
--- a/panel-plugin/Makefile.am
+++ b/panel-plugin/Makefile.am
@@ -60,6 +60,7 @@ libpulseaudio_plugin_la_CFLAGS = \
 	$(KEYBINDER_CFLAGS) \
 	$(LIBNOTIFY_CFLAGS) \
 	$(MPRIS2_CFLAGS) \
+	$(EXO_CFLAGS) \
 	$(WNCK_CFLAGS) \
 	$(PLATFORM_CFLAGS)
 
@@ -81,6 +82,7 @@ libpulseaudio_plugin_la_LIBADD = \
 	$(KEYBINDER_LIBS) \
 	$(LIBNOTIFY_LIBS) \
 	$(MPRIS2_LIBS) \
+	$(EXO_LIBS) \
 	$(WNCK_LIBS) \
 	$(LIBM)
 
diff --git a/panel-plugin/mprismenuitem.c b/panel-plugin/mprismenuitem.c
index e193f67..df5b6ab 100644
--- a/panel-plugin/mprismenuitem.c
+++ b/panel-plugin/mprismenuitem.c
@@ -35,6 +35,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <gio/gdesktopappinfo.h>
 
+#include <exo/exo.h>
 
 
 /* for DBG/TRACE */
@@ -145,7 +146,16 @@ mpris_menu_item_new_with_player (const gchar *player,
 
   gtk_widget_add_events (GTK_WIDGET(menu_item), GDK_SCROLL_MASK|GDK_POINTER_MOTION_MASK|GDK_BUTTON_MOTION_MASK);
 
-  gtk_image_set_from_icon_name (GTK_IMAGE (priv->image), icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
+  if (g_file_test (icon_name, G_FILE_TEST_EXISTS) && !g_file_test (icon_name, G_FILE_TEST_IS_DIR)) {
+    GdkPixbuf *buf = exo_gdk_pixbuf_new_from_file_at_max_size (icon_name, 24, 24, TRUE, NULL);
+    if (buf != NULL) {
+      gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), buf);
+    } else {
+      gtk_image_set_from_icon_name (GTK_IMAGE (priv->image), "audio-player", GTK_ICON_SIZE_LARGE_TOOLBAR);
+    }
+  } else {
+    gtk_image_set_from_icon_name (GTK_IMAGE (priv->image), icon_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
+  }
 
   return GTK_WIDGET(menu_item);
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list