changeset 34480:6c6fb701fa8e

Add differently sized, new icons for the GUI. This closes Bugzilla #710. In addition, icon themes are now supported.
author ib
date Sat, 14 Jan 2012 16:08:16 +0000
parents 70c63fd20b4b
children 887c198b5b78
files Copyright Makefile debian/rules etc/mplayer.ico etc/mplayer.png etc/mplayer16x16.png etc/mplayer22x22.png etc/mplayer24x24.png etc/mplayer256x256.png etc/mplayer32x32.png etc/mplayer48x48.png gui/ui/pixmaps/mplayer.xpm gui/ui/widgets.c rpm/mplayer.spec
diffstat 14 files changed, 103 insertions(+), 222 deletions(-) [+]
line wrap: on
line diff
--- a/Copyright	Sat Jan 14 16:02:37 2012 +0000
+++ b/Copyright	Sat Jan 14 16:08:16 2012 +0000
@@ -178,3 +178,10 @@
 Copyright:  2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
             2009 Grigori Goronzy <greg@geekmind.org>
 License:    GNU General Public License
+
+Name:       Icons
+Version:    2012-01-07
+URL:        http://www.andreasn.se
+Directory:  etc/
+Copyright:  Andreas Nilsson <andreas@andreasn.se>
+License:    GNU General Public License
--- a/Makefile	Sat Jan 14 16:02:37 2012 +0000
+++ b/Makefile	Sat Jan 14 16:08:16 2012 +0000
@@ -759,6 +759,9 @@
 ADD_ALL_DIRS    = $(call ADDSUFFIXES,$(1),$(ALL_DIRS))
 ADD_ALL_EXESUFS = $(1) $(call ADDSUFFIXES,$(EXESUFS_ALL),$(1))
 
+GUI_ICONSIZES = 16x16 22x22 24x24 32x32 48x48 256x256
+
+
 
 ###### generic rules #######
 
@@ -905,12 +908,12 @@
 install-%: %$(EXESUF) install-dirs
 	$(INSTALL) -m 755 $(INSTALLSTRIP) $< $(BINDIR)
 
-install-gui: install-mplayer
+install-gui: install-mplayer install-gui-icons
 	-ln -sf mplayer$(EXESUF) $(BINDIR)/gmplayer$(EXESUF)
-	$(INSTALL) -d $(DATADIR)/skins $(prefix)/share/pixmaps $(prefix)/share/applications
-	$(INSTALL) -m 644 etc/mplayer.png $(prefix)/share/pixmaps/
+	$(INSTALL) -d $(DATADIR)/skins $(prefix)/share/applications
 	$(INSTALL) -m 644 etc/mplayer.desktop $(prefix)/share/applications/
 
+install-gui-icons:    $(foreach size,$(GUI_ICONSIZES),install-gui-icon-$(size))
 install-gui-man:      $(foreach lang,$(MAN_LANGS),install-gui-man-$(lang))
 install-mencoder-man: $(foreach lang,$(MAN_LANGS),install-mencoder-man-$(lang))
 install-mplayer-man:  $(foreach lang,$(MAN_LANGS),install-mplayer-man-$(lang))
@@ -925,6 +928,12 @@
 	$(INSTALL) -d $(MANDIR)/man1
 	$(INSTALL) -m 644 DOCS/man/en/mplayer.1 $(MANDIR)/man1/
 
+define GUI_ICON_RULE
+install-gui-icon-$(size):
+	$(INSTALL) -d $(prefix)/share/icons/hicolor/$(size)/apps
+	$(INSTALL) -m 644 etc/mplayer$(size).png $(prefix)/share/icons/hicolor/$(size)/apps/mplayer.png
+endef
+
 define GUI_MAN_RULE
 install-gui-man-$(lang): install-mplayer-man-$(lang)
 	cd $(MANDIR)/$(lang)/man1/ && ln -sf mplayer.1 gmplayer.1
@@ -941,6 +950,7 @@
 	$(INSTALL) -m 644 DOCS/man/$(lang)/mplayer.1 $(MANDIR)/$(lang)/man1/
 endef
 
+$(foreach size,$(GUI_ICONSIZES),$(eval $(GUI_ICON_RULE)))
 $(foreach lang,$(filter-out en,$(MAN_LANG_ALL)),$(eval $(GUI_MAN_RULE)))
 $(foreach lang,$(filter-out en,$(MAN_LANG_ALL)),$(eval $(MENCODER_MAN_RULE)))
 $(foreach lang,$(filter-out en,$(MAN_LANG_ALL)),$(eval $(MPLAYER_MAN_RULE)))
@@ -949,7 +959,7 @@
 	rm -f $(BINDIR)/mplayer$(EXESUF) $(BINDIR)/gmplayer$(EXESUF)
 	rm -f $(BINDIR)/mencoder$(EXESUF)
 	rm -f $(MANDIR)/man1/mencoder.1 $(MANDIR)/man1/mplayer.1
-	rm -f $(prefix)/share/pixmaps/mplayer.png
+	rm -f $(foreach size,$(GUI_ICONSIZES),$(prefix)/share/icons/hicolor/$(size)/apps/mplayer.png)
 	rm -f $(prefix)/share/applications/mplayer.desktop
 	rm -f $(MANDIR)/man1/mplayer.1 $(MANDIR)/man1/mencoder.1
 	rm -f $(foreach lang,$(MAN_LANGS),$(foreach man,mplayer.1 mencoder.1,$(MANDIR)/$(lang)/man1/$(man)))
--- a/debian/rules	Sat Jan 14 16:02:37 2012 +0000
+++ b/debian/rules	Sat Jan 14 16:08:16 2012 +0000
@@ -121,8 +121,18 @@
 	install -D -m 755 mplayer $(CURDIR)/debian/mplayer-gui/usr/bin/gmplayer
 	install -D -m 644 etc/mplayer.desktop \
 	                  $(CURDIR)/debian/mplayer-gui/usr/share/applications/mplayer.desktop
-	install -D -m 644 etc/mplayer.png \
-	                  $(CURDIR)/debian/mplayer-gui/usr/share/pixmaps/mplayer.png
+	install -D -m 644 etc/mplayer16x16.png \
+	                  $(CURDIR)/debian/mplayer-gui/usr/share/icons/hicolor/16x16/apps/mplayer.png
+	install -D -m 644 etc/mplayer22x22.png \
+	                  $(CURDIR)/debian/mplayer-gui/usr/share/icons/hicolor/22x22/apps/mplayer.png
+	install -D -m 644 etc/mplayer24x24.png \
+	                  $(CURDIR)/debian/mplayer-gui/usr/share/icons/hicolor/24x24/apps/mplayer.png
+	install -D -m 644 etc/mplayer32x32.png \
+	                  $(CURDIR)/debian/mplayer-gui/usr/share/icons/hicolor/32x32/apps/mplayer.png
+	install -D -m 644 etc/mplayer48x48.png \
+	                  $(CURDIR)/debian/mplayer-gui/usr/share/icons/hicolor/48x48/apps/mplayer.png
+	install -D -m 644 etc/mplayer256x256.png \
+	                  $(CURDIR)/debian/mplayer-gui/usr/share/icons/hicolor/256x256/apps/mplayer.png
 
 
 # binaries already installed via build rules as we have to build several flavors
Binary file etc/mplayer.ico has changed
Binary file etc/mplayer.png has changed
Binary file etc/mplayer16x16.png has changed
Binary file etc/mplayer22x22.png has changed
Binary file etc/mplayer24x24.png has changed
Binary file etc/mplayer256x256.png has changed
Binary file etc/mplayer32x32.png has changed
Binary file etc/mplayer48x48.png has changed
--- a/gui/ui/pixmaps/mplayer.xpm	Sat Jan 14 16:02:37 2012 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-/* XPM */
-static const char * const mplayer_xpm[] = {
-/* columns rows colors chars-per-pixel */
-"48 48 132 2",
-"   c #000000",
-".  c #0C0C0C",
-"X  c #121212",
-"o  c #1A1A1A",
-"O  c #242424",
-"+  c #2D2D2D",
-"@  c #333333",
-"#  c #3B3B3B",
-"$  c #2E2374",
-"%  c #2E2F7E",
-"&  c #322374",
-"*  c #362877",
-"=  c #372978",
-"-  c #3A2C79",
-";  c #3F317D",
-":  c #40327D",
-">  c #444444",
-",  c #4A4A4A",
-"<  c #515151",
-"1  c #5C5C5C",
-"2  c #626262",
-"3  c #6B6B6B",
-"4  c #737373",
-"5  c #7B7B7B",
-"6  c #433580",
-"7  c #453881",
-"8  c #4A3D85",
-"9  c #4D4087",
-"0  c #4F4288",
-"q  c #504489",
-"w  c #55498C",
-"e  c #5A4E8F",
-"r  c #5B4F90",
-"t  c #5D5291",
-"y  c #615594",
-"u  c #655A97",
-"i  c #665B98",
-"p  c #6A5F9A",
-"a  c #6C619B",
-"s  c #70669E",
-"d  c #72689F",
-"f  c #6D72A8",
-"g  c #7369A0",
-"h  c #786EA3",
-"j  c #7B71A5",
-"k  c #7E75A8",
-"l  c #08A7E6",
-"z  c #0AA8E6",
-"x  c #13ABE7",
-"c  c #1DAEE8",
-"v  c #23B1E9",
-"b  c #2AB3E9",
-"n  c #31B6EA",
-"m  c #3EBAEB",
-"M  c #4BBFED",
-"N  c #4DC0ED",
-"B  c #5AC4EE",
-"V  c #69C9F0",
-"C  c #75CEF1",
-"Z  c #79CFF1",
-"A  c #7ED1F2",
-"S  c #8076A9",
-"D  c #847BAB",
-"F  c #887FAE",
-"G  c #838383",
-"H  c #8A8A8A",
-"J  c #929292",
-"K  c #9B9B9B",
-"L  c #8780AF",
-"P  c #8980AF",
-"I  c #8C84B1",
-"U  c #938BB6",
-"Y  c #968EB8",
-"T  c #9A93BB",
-"R  c #9F98BE",
-"E  c #A09ABF",
-"W  c #A2A2A2",
-"Q  c #AAAAAA",
-"!  c #BBBBBB",
-"~  c #A49DC1",
-"^  c #A7A0C3",
-"/  c #AAA4C5",
-"(  c #AEA8C8",
-")  c #B2ACCA",
-"_  c #B6B0CD",
-"`  c #B8B3CF",
-"'  c #BAB5D0",
-"]  c #BEB9D3",
-"[  c #84D3F3",
-"{  c #8AD5F3",
-"}  c #90D7F4",
-"|  c #95D9F4",
-" . c #9CDCF5",
-".. c #A5DEF5",
-"X. c #ABE1F6",
-"o. c #B2E3F7",
-"O. c #B4E4F8",
-"+. c #BAE6F8",
-"@. c #C1BDD5",
-"#. c #C3C3C3",
-"$. c #CBCBCB",
-"%. c #C4C0D7",
-"&. c #C6C2D8",
-"*. c #CDCADD",
-"=. c #D3D3D3",
-"-. c #DBDBDB",
-";. c #D1CEE0",
-":. c #D4D1E2",
-">. c #D9D6E5",
-",. c #DCDAE7",
-"<. c #DDDBE8",
-"1. c #C3EAF9",
-"2. c #CAEDFA",
-"3. c #D2EFFA",
-"4. c #D8E3F0",
-"5. c #D6F0FB",
-"6. c #DBF2FB",
-"7. c #E2E2E2",
-"8. c #E4E1EC",
-"9. c #E8E6EF",
-"0. c #ECECEC",
-"q. c #E8E7F0",
-"w. c #ECEAF2",
-"e. c #E6F6FC",
-"r. c #E9F7FD",
-"t. c #ECF8FD",
-"y. c #F4F3F5",
-"u. c #F6F5F9",
-"i. c #F3FBFD",
-"p. c #F8F7FA",
-"a. c #FEFEFE",
-"s. c None",
-/* pixels */
-"s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.",
-"s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.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.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.d t a.a.#     2 7.a.a.T & % s.",
-"s.s.] :.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.p.8 U a.a.#       . G p.*.& & s.",
-"s.s.s.* e s d d g d d g d d g h j D D I T R ^ / ` ] &.*.*.;.,.<.:.* T a.a.@           > ;.& & s.",
-"s.s.s.s.& & * : 7 0 w y a h D I Y T ~ ~ / ( ) ] ` ] ' R F s.s.s.& & D a.a.#       o J u.] & & s.",
-"s.s.s.s.s.& & a T R ^ ^ ( ( ^ ( / I w s.s.s.s.s.s.s.s.s.s.s.s.s.s.& 7 y.a.#   . G 0.a.a.d & & s.",
-"s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.& & D a.# 3 7.a.a.a.] & & s.s.",
-"s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.& & S -.a.a.a.p.~ = & & s.s.",
-"s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.$ & & ; s P j 9 & & & s.s.s.",
-"s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.$ & & & & & & & s.s.s.s.",
-"s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.",
-"s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.",
-"s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.",
-"s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.",
-"s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s."
-};
--- a/gui/ui/widgets.c	Sat Jan 14 16:02:37 2012 +0000
+++ b/gui/ui/widgets.c	Sat Jan 14 16:08:16 2012 +0000
@@ -64,7 +64,7 @@
 #include "gtk/url.h"
 #include "gtk/equalizer.h"
 
-#include "pixmaps/mplayer.xpm"
+#define GUI_ICON_NAME "mplayer"
 
 #define THRESHOLD 128   // transparency values equal to or above this will become
                         // opaque, all values below this will become transparent
@@ -73,14 +73,51 @@
 
 guiIcon_t guiIcon;
 
+static void gtkLoadIcon(GtkIconTheme *theme, gint size, GdkPixmap **gdkIcon, GdkBitmap **gdkIconMask)
+{
+    GdkPixbuf *pixbuf;
+    guchar *data;
+    int csize, i;
+
+    pixbuf = gtk_icon_theme_load_icon(theme, GUI_ICON_NAME, size, 0, NULL);
+
+    if (pixbuf)
+        gdk_pixbuf_render_pixmap_and_mask_for_colormap(pixbuf, gdk_colormap_get_system(), gdkIcon, gdkIconMask, THRESHOLD);
+
+    if (pixbuf &&
+        gdk_pixbuf_get_colorspace(pixbuf) == GDK_COLORSPACE_RGB &&
+        gdk_pixbuf_get_n_channels(pixbuf) == 4 &&
+        gdk_pixbuf_get_bits_per_sample(pixbuf) == 8) {
+        csize = guiIcon.collection_size;
+        guiIcon.collection_size += 2 + gdk_pixbuf_get_width(pixbuf) * gdk_pixbuf_get_height(pixbuf);
+
+        guiIcon.collection = realloc(guiIcon.collection, guiIcon.collection_size * sizeof(*guiIcon.collection));
+
+        if (guiIcon.collection) {
+            guiIcon.collection[csize++] = gdk_pixbuf_get_width(pixbuf);
+            guiIcon.collection[csize++] = gdk_pixbuf_get_height(pixbuf);
+
+            data = gdk_pixbuf_get_pixels(pixbuf);
+
+            for (i = csize; i < guiIcon.collection_size; data += 4, i++)
+                guiIcon.collection[i] = (data[3] << 24) | AV_RB24(data);  // RGBA -> ARGB
+        }
+
+        g_object_unref(pixbuf);
+    } else
+        mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_ICONERROR, GUI_ICON_NAME);
+
+    // start up GTK which realizes the pixmaps
+    gtk_main_iteration_do(FALSE);
+}
+
 void gtkInit(void)
 {
-    int argc = 0, i;
+    int argc = 0;
     char *arg[3], **argv = arg;
-    GdkPixbuf *pixbuf;
+    GtkIconTheme *theme;
     GdkPixmap *gdkIcon;
     GdkBitmap *gdkIconMask;
-    guchar *data;
 
     mp_msg(MSGT_GPLAYER, MSGL_V, "GTK init.\n");
 
@@ -97,35 +134,18 @@
 
     gtk_init(&argc, &argv);
 
-    pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)mplayer_xpm);
-
-    gdk_pixbuf_render_pixmap_and_mask_for_colormap(pixbuf, gdk_colormap_get_system(), &gdkIcon, &gdkIconMask, THRESHOLD);
-
-    if (gdk_pixbuf_get_colorspace(pixbuf) == GDK_COLORSPACE_RGB &&
-        gdk_pixbuf_get_n_channels(pixbuf) == 4 &&
-        gdk_pixbuf_get_bits_per_sample(pixbuf) == 8) {
-        guiIcon.collection_size = 2 + gdk_pixbuf_get_width(pixbuf) * gdk_pixbuf_get_height(pixbuf);
-
-        guiIcon.collection = malloc(guiIcon.collection_size * sizeof(*guiIcon.collection));
+    theme = gtk_icon_theme_get_default();
 
-        if (guiIcon.collection) {
-            guiIcon.collection[0] = gdk_pixbuf_get_width(pixbuf);
-            guiIcon.collection[1] = gdk_pixbuf_get_height(pixbuf);
-
-            data = gdk_pixbuf_get_pixels(pixbuf);
+    gtkLoadIcon(theme, 16, &gdkIcon, &gdkIconMask);
+    guiIcon.small      = GDK_PIXMAP_XID(gdkIcon);
+    guiIcon.small_mask = GDK_PIXMAP_XID(gdkIconMask);
 
-            for (i = 2; i < guiIcon.collection_size; data += 4, i++)
-                guiIcon.collection[i] = (data[3] << 24) | AV_RB24(data);  // RGBA -> ARGB
-        }
-    } else
-        mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_ICONERROR, "mplayer");
-
-    // start up GTK which realizes the pixmaps
-    gtk_main_iteration_do(FALSE);
-
+    gtkLoadIcon(theme, 32, &gdkIcon, &gdkIconMask);
     guiIcon.normal      = GDK_PIXMAP_XID(gdkIcon);
     guiIcon.normal_mask = GDK_PIXMAP_XID(gdkIconMask);
 
+    gtkLoadIcon(theme, 48, &gdkIcon, &gdkIconMask);
+
     gtkInitialized = 1;
 }
 
--- a/rpm/mplayer.spec	Sat Jan 14 16:02:37 2012 +0000
+++ b/rpm/mplayer.spec	Sat Jan 14 16:08:16 2012 +0000
@@ -253,9 +253,24 @@
 ln -s Blue $RPM_BUILD_ROOT%{_datadir}/mplayer/skins/default
 
 # Icons
+install -dm 755 $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps
+install -pm 644 etc/mplayer16x16.png \
+    $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/mplayer.png
+install -dm 755 $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/22x22/apps
+install -pm 644 etc/mplayer22x22.png \
+    $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/22x22/apps/mplayer.png
+install -dm 755 $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/24x24/apps
+install -pm 644 etc/mplayer24x24.png \
+    $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/24x24/apps/mplayer.png
+install -dm 755 $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps
+install -pm 644 etc/mplayer32x32.png \
+    $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/mplayer.png
 install -dm 755 $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps
-install -pm 644 etc/mplayer.png \
-    $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps
+install -pm 644 etc/mplayer48x48.png \
+    $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/mplayer.png
+install -dm 755 $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/256x256/apps
+install -pm 644 etc/mplayer256x256.png \
+    $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/256x256/apps/mplayer.png
 
 # Desktop file
 desktop-file-install \
@@ -306,7 +321,12 @@
 %defattr(-, root, root, -)
 %{_bindir}/gmplayer
 %{_datadir}/applications/*mplayer.desktop
+%{_datadir}/icons/hicolor/16x16/apps/mplayer.png
+%{_datadir}/icons/hicolor/22x22/apps/mplayer.png
+%{_datadir}/icons/hicolor/24x24/apps/mplayer.png
+%{_datadir}/icons/hicolor/32x32/apps/mplayer.png
 %{_datadir}/icons/hicolor/48x48/apps/mplayer.png
+%{_datadir}/icons/hicolor/256x256/apps/mplayer.png
 %{_datadir}/mplayer/skins/
 
 %files -n mencoder