Mercurial > geeqie
comparison src/main.c @ 91:d063f97503b7
Wed Nov 1 11:39:48 2006 John Ellis <johne@verizon.net>
* gqview.h, main.c (window_set_icon): Change to use inline pixbufs
instead of xpms.
* collect.c, img-view.c, layout.c, preferences.c: Use new icons.
* pixbuf_util.[ch]: Add new icons.
* icons/Makefile.am: Update generated inline pixbufs.
* icons/collect.xpm, icons/config.xpm, icons/icon.xpm, icons/tools.xpm,
icons/view.xpm: Remove old xpm icons.
* icons/gqview_icon.png, icons/icon_book.png, icons/icon_config.png,
icons/icon_tools.png, icons/icon_view.png: The new icons in png format.
* icons/svg/*.svg: Add svg sources for icons, they are not used or
anything, but this way I can not misplace them again.
author | gqview |
---|---|
date | Wed, 01 Nov 2006 17:47:14 +0000 |
parents | 0ef72a64930b |
children | 55166d93498d |
comparison
equal
deleted
inserted
replaced
90:dc3c77d027e6 | 91:d063f97503b7 |
---|---|
20 #include "filelist.h" | 20 #include "filelist.h" |
21 #include "img-view.h" | 21 #include "img-view.h" |
22 #include "layout.h" | 22 #include "layout.h" |
23 #include "layout_image.h" | 23 #include "layout_image.h" |
24 #include "menu.h" | 24 #include "menu.h" |
25 #include "pixbuf_util.h" | |
25 #include "preferences.h" | 26 #include "preferences.h" |
26 #include "rcfile.h" | 27 #include "rcfile.h" |
27 #include "remote.h" | 28 #include "remote.h" |
28 #include "similar.h" | 29 #include "similar.h" |
29 #include "slideshow.h" | 30 #include "slideshow.h" |
34 #include "ui_tabcomp.h" | 35 #include "ui_tabcomp.h" |
35 #include "ui_utildlg.h" | 36 #include "ui_utildlg.h" |
36 | 37 |
37 #include <gdk/gdkkeysyms.h> /* for keyboard values */ | 38 #include <gdk/gdkkeysyms.h> /* for keyboard values */ |
38 | 39 |
39 #include "icons/icon.xpm" | |
40 | |
41 | 40 |
42 #include <math.h> | 41 #include <math.h> |
43 | 42 |
44 | 43 |
45 static RemoteConnection *gqview_remote = NULL; | 44 static RemoteConnection *gqview_remote = NULL; |
50 *----------------------------------------------------------------------------- | 49 *----------------------------------------------------------------------------- |
51 * misc (public) | 50 * misc (public) |
52 *----------------------------------------------------------------------------- | 51 *----------------------------------------------------------------------------- |
53 */ | 52 */ |
54 | 53 |
55 typedef struct _WindowIconData WindowIconData; | 54 void window_set_icon(GtkWidget *window, const gchar *icon, const gchar *file) |
56 struct _WindowIconData | 55 { |
57 { | 56 if (!icon && !file) icon = PIXBUF_INLINE_ICON; |
58 const char **icon; | 57 |
59 gchar *path; | 58 if (icon) |
60 }; | 59 { |
61 | 60 GdkPixbuf *pixbuf; |
62 static void window_set_icon_cb(GtkWidget *widget, gpointer data) | 61 |
63 { | 62 pixbuf = pixbuf_inline(icon); |
64 WindowIconData *wid = data; | 63 if (pixbuf) |
65 GdkPixbuf *pb; | 64 { |
66 GdkPixmap *pixmap; | 65 gtk_window_set_icon(GTK_WINDOW(window), pixbuf); |
67 GdkBitmap *mask; | 66 g_object_unref(pixbuf); |
68 | 67 } |
69 if (wid->icon) | |
70 { | |
71 pb = gdk_pixbuf_new_from_xpm_data(wid->icon); | |
72 } | 68 } |
73 else | 69 else |
74 { | 70 { |
75 pb = gdk_pixbuf_new_from_file(wid->path, NULL); | 71 gtk_window_set_icon_from_file(GTK_WINDOW(window), file, NULL); |
76 } | 72 } |
77 | |
78 g_free(wid->path); | |
79 g_free(wid); | |
80 | |
81 if (!pb) return; | |
82 | |
83 gdk_pixbuf_render_pixmap_and_mask(pb, &pixmap, &mask, 128); | |
84 gdk_pixbuf_unref(pb); | |
85 | |
86 gdk_window_set_icon(widget->window, NULL, pixmap, mask); | |
87 /* apparently, gdk_window_set_icon does not ref the pixmap and mask, so don't unref it (leak?) */ | |
88 } | |
89 | |
90 void window_set_icon(GtkWidget *window, const char **icon, const gchar *file) | |
91 { | |
92 WindowIconData *wid; | |
93 | |
94 if (!icon && !file) icon = (const char **)icon_xpm; | |
95 | |
96 wid = g_new0(WindowIconData, 1); | |
97 wid->icon = icon; | |
98 wid->path = g_strdup(file); | |
99 | |
100 g_signal_connect(G_OBJECT(window), "realize", | |
101 G_CALLBACK(window_set_icon_cb), wid); | |
102 } | 73 } |
103 | 74 |
104 gint window_maximized(GtkWidget *window) | 75 gint window_maximized(GtkWidget *window) |
105 { | 76 { |
106 GdkWindowState state; | 77 GdkWindowState state; |