diff options
author | Havoc Pennington <hp@pobox.com> | 2001-09-17 04:42:37 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2001-09-17 04:42:37 +0000 |
commit | 4c104e1cb712f267f17cd52ad7ed6f3f4023e1b9 (patch) | |
tree | ca76a40b41d5bc4f85da1c4a06d1d29aaad484e1 | |
parent | ecf75915c706f7739157266c15a3c1bcf852f6c5 (diff) | |
download | metacity-4c104e1cb712f267f17cd52ad7ed6f3f4023e1b9.tar.gz |
use the inline image data for default icon
2001-09-17 Havoc Pennington <hp@pobox.com>
* src/ui.c: use the inline image data for default icon
* src/common.h (META_MINI_ICON_HEIGHT): move icon size defines
here
* src/Makefile.am: Create an inlinepixbufs.h header with inline
images
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | configure.in | 8 | ||||
-rw-r--r-- | src/Makefile.am | 10 | ||||
-rw-r--r-- | src/common.h | 7 | ||||
-rw-r--r-- | src/default_icon.png | bin | 0 -> 424 bytes | |||
-rw-r--r-- | src/screen.h | 7 | ||||
-rw-r--r-- | src/ui.c | 54 |
7 files changed, 78 insertions, 18 deletions
@@ -1,3 +1,13 @@ +2001-09-17 Havoc Pennington <hp@pobox.com> + + * src/ui.c: use the inline image data for default icon + + * src/common.h (META_MINI_ICON_HEIGHT): move icon size defines + here + + * src/Makefile.am: Create an inlinepixbufs.h header with inline + images + 2001-09-16 Havoc Pennington <hp@pobox.com> * src/session.c (process_ice_messages): disconnect this callback diff --git a/configure.in b/configure.in index 13daceaa..8d4741da 100644 --- a/configure.in +++ b/configure.in @@ -67,6 +67,14 @@ AM_CONDITIONAL(HAVE_SM, test "$found_sm" = "true") HOST_ALIAS=$host_alias AC_SUBST(HOST_ALIAS) +AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no) + +if test x"$GDK_PIXBUF_CSOURCE" = xno; then + AC_MSG_ERROR([gdk-pixbuf-csource executable not found in your path - should be installed with GTK]) +fi + +AC_SUBST(GDK_PIXBUF_CSOURCE) + AC_OUTPUT([ Makefile src/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 25d93073..0b3f99ca 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -53,5 +53,13 @@ metacity_LDADD= @METACITY_LIBS@ desktopfilesdir=$(datadir)/gnome/wm-properties desktopfiles_DATA=metacity.desktop -EXTRA_DIST=$(desktopfiles_DATA) +IMAGES=default_icon.png +VARIABLES=default_icon_data default_icon.png +noinst_DATA = inlinepixbufs.h +CLEANFILES += $(noinst_DATA) + +inlinepixbufs.h: $(IMAGES) + $(GDK_PIXBUF_CSOURCE) --raw --build-list $(VARIABLES) >$(srcdir)/inlinepixbufs.h + +EXTRA_DIST=$(desktopfiles_DATA) $(IMAGES) diff --git a/src/common.h b/src/common.h index 0eb8634a..f9c75a38 100644 --- a/src/common.h +++ b/src/common.h @@ -122,6 +122,13 @@ typedef enum } MetaCursor; + +/* should investigate changing these to whatever most apps use */ +#define META_ICON_WIDTH 32 +#define META_ICON_HEIGHT 32 +#define META_MINI_ICON_WIDTH 16 +#define META_MINI_ICON_HEIGHT 16 + #endif diff --git a/src/default_icon.png b/src/default_icon.png Binary files differnew file mode 100644 index 00000000..86108e43 --- /dev/null +++ b/src/default_icon.png diff --git a/src/screen.h b/src/screen.h index e81abf60..688fb4a7 100644 --- a/src/screen.h +++ b/src/screen.h @@ -26,13 +26,6 @@ #include <X11/Xutil.h> #include "ui.h" - -/* should investigate changing these to whatever most apps use */ -#define META_ICON_WIDTH 32 -#define META_ICON_HEIGHT 32 -#define META_MINI_ICON_WIDTH 16 -#define META_MINI_ICON_HEIGHT 16 - typedef void (* MetaScreenWindowFunc) (MetaScreen *screen, MetaWindow *window, gpointer user_data); @@ -25,6 +25,8 @@ #include "menu.h" #include "core.h" +#include "inlinepixbufs.h" + struct _MetaUI { Display *xdisplay; @@ -422,21 +424,53 @@ meta_ui_pop_delay_exposes (MetaUI *ui) GdkPixbuf* meta_ui_get_default_window_icon (MetaUI *ui) { - /* FIXME */ - return gtk_widget_render_icon (GTK_WIDGET (ui->frames), - GTK_STOCK_NEW, - GTK_ICON_SIZE_LARGE_TOOLBAR, - NULL); + static GdkPixbuf *default_icon = NULL; + + if (default_icon == NULL) + { + GdkPixbuf *base; + + base = gdk_pixbuf_new_from_stream (-1, default_icon_data, + FALSE, + NULL); + + g_assert (base); + + default_icon = gdk_pixbuf_scale_simple (base, + META_ICON_WIDTH, + META_ICON_HEIGHT, + GDK_INTERP_BILINEAR); + + g_object_unref (G_OBJECT (base)); + } + + return default_icon; } GdkPixbuf* meta_ui_get_default_mini_icon (MetaUI *ui) { - /* FIXME */ - return gtk_widget_render_icon (GTK_WIDGET (ui->frames), - GTK_STOCK_NEW, - GTK_ICON_SIZE_MENU, - NULL); + static GdkPixbuf *default_icon = NULL; + + if (default_icon == NULL) + { + GdkPixbuf *base; + + base = gdk_pixbuf_new_from_stream (-1, default_icon_data, + FALSE, + NULL); + + g_assert (base); + + default_icon = gdk_pixbuf_scale_simple (base, + META_MINI_ICON_WIDTH, + META_MINI_ICON_HEIGHT, + GDK_INTERP_BILINEAR); + + g_object_unref (G_OBJECT (base)); + } + + return default_icon; } gboolean |