[MPlayer-cvslog] r34568 - in trunk: 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/mpl...
ib
subversion at mplayerhq.hu
Sat Jan 14 17:08:16 CET 2012
Author: ib
Date: Sat Jan 14 17:08:16 2012
New Revision: 34568
Log:
Add differently sized, new icons for the GUI.
This closes Bugzilla #710.
In addition, icon themes are now supported.
Added:
trunk/etc/mplayer16x16.png (contents, props changed)
trunk/etc/mplayer22x22.png (contents, props changed)
trunk/etc/mplayer24x24.png (contents, props changed)
trunk/etc/mplayer256x256.png (contents, props changed)
trunk/etc/mplayer32x32.png (contents, props changed)
trunk/etc/mplayer48x48.png (contents, props changed)
Deleted:
trunk/etc/mplayer.png
trunk/gui/ui/pixmaps/mplayer.xpm
Modified:
trunk/Copyright
trunk/Makefile
trunk/debian/rules
trunk/etc/mplayer.ico
trunk/gui/ui/widgets.c
trunk/rpm/mplayer.spec
Modified: trunk/Copyright
==============================================================================
--- trunk/Copyright Sat Jan 14 17:02:37 2012 (r34567)
+++ trunk/Copyright Sat Jan 14 17:08:16 2012 (r34568)
@@ -178,3 +178,10 @@ Directory: libass/
Copyright: 2006 Evgeniy Stepanov <eugeni.stepanov at gmail.com>
2009 Grigori Goronzy <greg at geekmind.org>
License: GNU General Public License
+
+Name: Icons
+Version: 2012-01-07
+URL: http://www.andreasn.se
+Directory: etc/
+Copyright: Andreas Nilsson <andreas at andreasn.se>
+License: GNU General Public License
Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile Sat Jan 14 17:02:37 2012 (r34567)
+++ trunk/Makefile Sat Jan 14 17:08:16 2012 (r34568)
@@ -759,6 +759,9 @@ ADDSUFFIXES = $(foreach suf,$(1),$(a
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-dirs:
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-mplayer-man-en:
$(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-mplayer-man-$(lang):
$(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 @@ uninstall:
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)))
Modified: trunk/debian/rules
==============================================================================
--- trunk/debian/rules Sat Jan 14 17:02:37 2012 (r34567)
+++ trunk/debian/rules Sat Jan 14 17:08:16 2012 (r34568)
@@ -121,8 +121,18 @@ debian/mplayer-gui/usr/bin/gmplayer:
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
Modified: trunk/etc/mplayer.ico
==============================================================================
Binary file (source and/or target). No diff available.
Added: trunk/etc/mplayer16x16.png
==============================================================================
Binary file. No diff available.
Added: trunk/etc/mplayer22x22.png
==============================================================================
Binary file. No diff available.
Added: trunk/etc/mplayer24x24.png
==============================================================================
Binary file. No diff available.
Added: trunk/etc/mplayer256x256.png
==============================================================================
Binary file. No diff available.
Added: trunk/etc/mplayer32x32.png
==============================================================================
Binary file. No diff available.
Added: trunk/etc/mplayer48x48.png
==============================================================================
Binary file. No diff available.
Modified: trunk/gui/ui/widgets.c
==============================================================================
--- trunk/gui/ui/widgets.c Sat Jan 14 17:02:37 2012 (r34567)
+++ trunk/gui/ui/widgets.c Sat Jan 14 17:08:16 2012 (r34568)
@@ -64,7 +64,7 @@ int gtkInitialized = 0;
#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 @@ int gtkInitialized = 0;
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 @@ void gtkInit(void)
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));
-
- 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);
-
- 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");
+ theme = gtk_icon_theme_get_default();
- // start up GTK which realizes the pixmaps
- gtk_main_iteration_do(FALSE);
+ gtkLoadIcon(theme, 16, &gdkIcon, &gdkIconMask);
+ guiIcon.small = GDK_PIXMAP_XID(gdkIcon);
+ guiIcon.small_mask = GDK_PIXMAP_XID(gdkIconMask);
+ 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;
}
Modified: trunk/rpm/mplayer.spec
==============================================================================
--- trunk/rpm/mplayer.spec Sat Jan 14 17:02:37 2012 (r34567)
+++ trunk/rpm/mplayer.spec Sat Jan 14 17:08:16 2012 (r34568)
@@ -253,9 +253,24 @@ tar xjC $RPM_BUILD_ROOT%{_datadir}/mplay
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 @@ rm -rf $RPM_BUILD_ROOT
%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
More information about the MPlayer-cvslog
mailing list