[SCM] gnome-mplayer/experimental: Fallback to non-symbolic icons if necessary

sramacher at users.alioth.debian.org sramacher at users.alioth.debian.org
Sat Nov 17 20:24:59 UTC 2012


The following commit has been merged in the experimental branch:
commit ba0924da9e844a802362ad351cd1e5b2f707e2ac
Author: Sebastian Ramacher <sramacher at debian.org>
Date:   Sat Nov 17 21:24:34 2012 +0100

    Fallback to non-symbolic icons if necessary

diff --git a/debian/changelog b/debian/changelog
index f8d6486..cb93dd3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ gnome-mplayer (1.0.7-1) UNRELEASED; urgency=low
       supported mime types. mplayer doesn't support midi files, so
       gnome-mplayer doesn't either. (Closes: #686762) (LP: #1005861)
     - fix-errors-with-hardening-flags.patch: Removed, merged upstream.
+    - fallback-to-nonsymbolic-icons.patch: If the icon theme doesn't support
+      symbolic icons, fallback to hicolor icons.
   * debian/control:
     - Bump Build-Dep on libgmtk-dev to >= 1.0.7.
     - Don't Build-Dep on libgpod-dev on hurd-i386. It's not available there.
diff --git a/debian/patches/fallback-to-nonsymbolic-icons.patch b/debian/patches/fallback-to-nonsymbolic-icons.patch
new file mode 100644
index 0000000..66b5178
--- /dev/null
+++ b/debian/patches/fallback-to-nonsymbolic-icons.patch
@@ -0,0 +1,193 @@
+Description: Fall back to non-symbolic icons if necessary
+ If the icon theme doesn't support symoblic icons, fallback to the hicolor
+ icons.
+Author: Sebastian Ramacher <sramacher at debian.org>
+Last-Update: 2012-11-17
+Forwarded: https://code.google.com/p/gnome-mplayer/issues/detail?id=656
+
+--- a/src/gui.c
++++ b/src/gui.c
+@@ -185,6 +185,19 @@
+ 
+ static gboolean in_button;
+ 
++#ifdef GTK3_ENABLED
++static GIcon *icon_play = NULL;
++static GIcon *icon_pause = NULL;
++static GIcon *icon_stop = NULL;
++static GIcon *icon_ff = NULL;
++static GIcon *icon_rew = NULL;
++static GIcon *icon_next = NULL;
++static GIcon *icon_prev = NULL;
++static GIcon *icon_menu = NULL;
++static GIcon *icon_fs = NULL;
++static GIcon *icon_restore = NULL;
++#endif
++
+ static GtkWidget *image_play;
+ static GtkWidget *image_pause;
+ static GtkWidget *image_stop;
+@@ -1188,7 +1201,7 @@
+     if (lastguistate != guistate) {
+         if (guistate == PLAYING) {
+ #ifdef GTK3_ENABLED
+-            gtk_image_set_from_icon_name(GTK_IMAGE(image_play), "media-playback-pause-symbolic", button_size);
++            gtk_image_set_from_gicon(GTK_IMAGE(image_play), icon_pause, button_size);
+ #else
+             gtk_image_set_from_stock(GTK_IMAGE(image_play), GTK_STOCK_MEDIA_PAUSE, button_size);
+ #endif
+@@ -1214,7 +1227,7 @@
+ 
+         if (guistate == PAUSED) {
+ #ifdef GTK3_ENABLED
+-            gtk_image_set_from_icon_name(GTK_IMAGE(image_play), "media-playback-start-symbolic", button_size);
++            gtk_image_set_from_gicon(GTK_IMAGE(image_play), icon_play, button_size);
+ #else
+             gtk_image_set_from_stock(GTK_IMAGE(image_play), GTK_STOCK_MEDIA_PLAY, button_size);
+ #endif
+@@ -1239,7 +1252,7 @@
+ 
+         if (guistate == STOPPED) {
+ #ifdef GTK3_ENABLED
+-            gtk_image_set_from_icon_name(GTK_IMAGE(image_play), "media-playback-start-symbolic", button_size);
++            gtk_image_set_from_gicon(GTK_IMAGE(image_play), icon_play, button_size);
+ #else
+             gtk_image_set_from_stock(GTK_IMAGE(image_play), GTK_STOCK_MEDIA_PLAY, button_size);
+ #endif
+@@ -1847,6 +1860,19 @@
+ 
+ static void destroy_callback(GtkWidget * widget, gpointer data)
+ {
++#ifdef GTK3_ENABLED
++    g_object_unref(icon_play);
++    g_object_unref(icon_stop);
++    g_object_unref(icon_pause);
++    g_object_unref(icon_ff);
++    g_object_unref(icon_rew);
++    g_object_unref(icon_prev);
++    g_object_unref(icon_next);
++    g_object_unref(icon_menu);
++    g_object_unref(icon_fs);
++    g_object_unref(icon_restore);
++#endif
++
+     gtk_main_quit();
+ }
+ 
+@@ -2585,7 +2611,7 @@
+         gmtk_media_tracker_set_percentage(tracker, 0.0);
+         gtk_widget_set_sensitive(play_event_box, TRUE);
+ #ifdef GTK3_ENABLED
+-        gtk_image_set_from_icon_name(GTK_IMAGE(image_play), "media-playback-start-symbolic", button_size);
++        gtk_image_set_from_gicon(GTK_IMAGE(image_play), icon_play, button_size);
+ #else
+         gtk_image_set_from_stock(GTK_IMAGE(image_play), GTK_STOCK_MEDIA_PLAY, button_size);
+ #endif
+@@ -2599,7 +2625,7 @@
+     if (gmtk_media_player_get_media_state(GMTK_MEDIA_PLAYER(media)) == MEDIA_STATE_QUIT) {
+         gmtk_media_tracker_set_percentage(tracker, 0.0);
+ #ifdef GTK3_ENABLED
+-        gtk_image_set_from_icon_name(GTK_IMAGE(image_play), "media-playback-start-symbolic", button_size);
++        gtk_image_set_from_gicon(GTK_IMAGE(image_play), icon_play, button_size);
+ #else
+         gtk_image_set_from_stock(GTK_IMAGE(image_play), GTK_STOCK_MEDIA_PLAY, button_size);
+ #endif
+@@ -2706,7 +2732,7 @@
+             autopause = FALSE;
+             gtk_widget_set_sensitive(play_event_box, TRUE);
+ #ifdef GTK3_ENABLED
+-            gtk_image_set_from_icon_name(GTK_IMAGE(image_play), "media-playback-start-symbolic", button_size);
++            gtk_image_set_from_gicon(GTK_IMAGE(image_play), icon_play, button_size);
+ #else
+             gtk_image_set_from_stock(GTK_IMAGE(image_play), GTK_STOCK_MEDIA_PLAY, button_size);
+ #endif
+@@ -2756,7 +2782,7 @@
+             autopause = FALSE;
+             gtk_widget_set_sensitive(play_event_box, TRUE);
+ #ifdef GTK3_ENABLED
+-            gtk_image_set_from_icon_name(GTK_IMAGE(image_play), "media-playback-start-symbolic", button_size);
++            gtk_image_set_from_gicon(GTK_IMAGE(image_play), icon_play, button_size);
+ #else
+             gtk_image_set_from_stock(GTK_IMAGE(image_play), GTK_STOCK_MEDIA_PLAY, button_size);
+ #endif
+@@ -6774,7 +6800,7 @@
+         // break purposely not put here, so gui is properly updated
+     case MEDIA_STATE_STOP:
+ #ifdef GTK3_ENABLED
+-        gtk_image_set_from_icon_name(GTK_IMAGE(image_play), "media-playback-start-symbolic", button_size);
++        gtk_image_set_from_gicon(GTK_IMAGE(image_play), icon_play, button_size);
+ #else
+         gtk_image_set_from_stock(GTK_IMAGE(image_play), GTK_STOCK_MEDIA_PLAY, button_size);
+ #endif
+@@ -6810,7 +6836,7 @@
+         if (idledata->mapped_af_export == NULL)
+             map_af_export_file(idledata);
+ #ifdef GTK3_ENABLED
+-        gtk_image_set_from_icon_name(GTK_IMAGE(image_play), "media-playback-pause-symbolic", button_size);
++        gtk_image_set_from_gicon(GTK_IMAGE(image_play), icon_pause, button_size);
+ #else
+         gtk_image_set_from_stock(GTK_IMAGE(image_play), GTK_STOCK_MEDIA_PAUSE, button_size);
+ #endif
+@@ -6855,7 +6881,7 @@
+         break;
+     case MEDIA_STATE_PAUSE:
+ #ifdef GTK3_ENABLED
+-        gtk_image_set_from_icon_name(GTK_IMAGE(image_play), "media-playback-start-symbolic", button_size);
++        gtk_image_set_from_gicon(GTK_IMAGE(image_play), icon_play, button_size);
+ #else
+         gtk_image_set_from_stock(GTK_IMAGE(image_play), GTK_STOCK_MEDIA_PLAY, button_size);
+ #endif
+@@ -7726,15 +7752,26 @@
+     gtk_container_add(GTK_CONTAINER(window), vbox_master);
+     icon_theme = gtk_icon_theme_get_default();
+ #ifdef GTK3_ENABLED
+-    image_play = gtk_image_new_from_icon_name("media-playback-start-symbolic", button_size);
+-    image_stop = gtk_image_new_from_icon_name("media-playback-stop-symbolic", button_size);
+-    image_pause = gtk_image_new_from_icon_name("media-playback-pause-symbolic", button_size);
+-    image_ff = gtk_image_new_from_icon_name("media-seek-forward-symbolic", button_size);
+-    image_rew = gtk_image_new_from_icon_name("media-seek-backward-symbolic", button_size);
+-    image_prev = gtk_image_new_from_icon_name("media-skip-backward-symbolic", button_size);
+-    image_next = gtk_image_new_from_icon_name("media-skip-forward-symbolic", button_size);
+-    image_menu = gtk_image_new_from_icon_name("view-sidebar-symbolic", button_size);
+-    image_fs = gtk_image_new_from_icon_name("view-fullscreen-symbolic", button_size);
++    icon_play = g_themed_icon_new_with_default_fallbacks("media-playback-start-symbolic");
++    icon_stop = g_themed_icon_new_with_default_fallbacks("media-playback-stop-symbolic");
++    icon_pause = g_themed_icon_new_with_default_fallbacks("media-playback-pause-symbolic");
++    icon_ff = g_themed_icon_new_with_default_fallbacks("media-seek-forward-symbolic");
++    icon_rew = g_themed_icon_new_with_default_fallbacks("media-seek-backward-symbolic");
++    icon_prev = g_themed_icon_new_with_default_fallbacks("media-skip-backward-symbolic");
++    icon_next = g_themed_icon_new_with_default_fallbacks("media-skip-forward-symbolic");
++    icon_menu = g_themed_icon_new_with_default_fallbacks("view-sidebar-symbolic");
++    icon_fs = g_themed_icon_new_with_default_fallbacks("view-fullscreen-symbolic");
++    icon_restore = g_themed_icon_new_with_default_fallbacks("view-restore-symbolic");
++
++    image_play = gtk_image_new_from_gicon(icon_play, button_size);
++    image_stop = gtk_image_new_from_gicon(icon_stop, button_size);
++    image_pause = gtk_image_new_from_gicon(icon_pause, button_size);
++    image_ff = gtk_image_new_from_gicon(icon_ff, button_size);
++    image_rew = gtk_image_new_from_gicon(icon_rew, button_size);
++    image_prev = gtk_image_new_from_gicon(icon_prev, button_size);
++    image_next = gtk_image_new_from_gicon(icon_next, button_size);
++    image_menu = gtk_image_new_from_gicon(icon_menu, button_size);
++    image_fs = gtk_image_new_from_gicon(icon_fs, button_size);
+ #else
+     image_play = gtk_image_new_from_stock(GTK_STOCK_MEDIA_PLAY, button_size);
+     image_stop = gtk_image_new_from_stock(GTK_STOCK_MEDIA_STOP, button_size);
+@@ -8398,7 +8435,7 @@
+         g_signal_connect(G_OBJECT(fs_controls), "leave_notify_event", G_CALLBACK(fs_controls_left), NULL);
+         g_object_ref(hbox);
+ #ifdef GTK3_ENABLED
+-        gtk_image_set_from_icon_name(GTK_IMAGE(image_fs), "view-restore-symbolic", button_size);
++        gtk_image_set_from_gicon(GTK_IMAGE(image_fs), icon_restore, button_size);
+ #else
+         gtk_image_set_from_stock(GTK_IMAGE(image_fs), GTK_STOCK_LEAVE_FULLSCREEN, button_size);
+ #endif
+@@ -8432,7 +8469,7 @@
+     if (fs_controls != NULL) {
+         g_object_ref(hbox);
+ #ifdef GTK3_ENABLED
+-        gtk_image_set_from_icon_name(GTK_IMAGE(image_fs), "view-fullscreen-symbolic", button_size);
++        gtk_image_set_from_gicon(GTK_IMAGE(image_fs), icon_fs, button_size);
+ #else
+         gtk_image_set_from_stock(GTK_IMAGE(image_fs), GTK_STOCK_FULLSCREEN, button_size);
+ #endif
diff --git a/debian/patches/remove-audio-midi-from-desktop.patch b/debian/patches/remove-audio-midi-from-desktop.patch
index bd45b47..1e1b639 100644
--- a/debian/patches/remove-audio-midi-from-desktop.patch
+++ b/debian/patches/remove-audio-midi-from-desktop.patch
@@ -1,8 +1,8 @@
 Description: Don't claim to support audio/midi.
  mplayer shipped by Debian doesn't support midi files so gnome-mplayer doesn't
  support them.
-Author: Sebastian Ramacher <s.ramacher at gmx.at>
-Last-Update: 2012-00-05
+Author: Sebastian Ramacher <sramacher at debian.org>
+Last-Update: 2012-11-07
 Forwarded: no
 
 diff --git a/gnome-mplayer.desktop b/gnome-mplayer.desktop
diff --git a/debian/patches/series b/debian/patches/series
index c53c2a3..42c172e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 remove-audio-midi-from-desktop.patch
+fallback-to-nonsymbolic-icons.patch

-- 
gnome-mplayer packaging



More information about the pkg-multimedia-commits mailing list