* gnoemoe/gm-pixbuf.c: fixed save/close stock icon when there is no
save 24x24 theme icon
This commit is contained in:
parent
b07af52011
commit
b3d9357162
|
@ -1,3 +1,8 @@
|
||||||
|
2006-15-08 Jesse van den Kieboom <jesse@icecrew.nl>
|
||||||
|
|
||||||
|
* gnoemoe/gm-pixbuf.c: fixed save/close stock icon when there is no
|
||||||
|
save 24x24 theme icon
|
||||||
|
|
||||||
2006-15-08 Jesse van den Kieboom <jesse@icecrew.nl>
|
2006-15-08 Jesse van den Kieboom <jesse@icecrew.nl>
|
||||||
|
|
||||||
* data/gnoemoe.1: added manpage
|
* data/gnoemoe.1: added manpage
|
||||||
|
|
|
@ -74,12 +74,47 @@ gm_pixbuf_add_directory(const gchar *directory) {
|
||||||
g_list_prepend(gm_pixbuf_directories, g_strdup(directory));
|
g_list_prepend(gm_pixbuf_directories, g_strdup(directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GtkIconSource *
|
||||||
|
gm_pixbuf_create_stock24(GdkPixbuf *pixbuf) {
|
||||||
|
GtkIconSource *source;
|
||||||
|
GdkPixbuf *scaled;
|
||||||
|
gint w, h;
|
||||||
|
|
||||||
|
scaled = gdk_pixbuf_new(gdk_pixbuf_get_colorspace(pixbuf),
|
||||||
|
gdk_pixbuf_get_has_alpha(pixbuf),
|
||||||
|
gdk_pixbuf_get_bits_per_sample(pixbuf),
|
||||||
|
24,
|
||||||
|
24);
|
||||||
|
|
||||||
|
gdk_pixbuf_fill(scaled, 0xffffff00);
|
||||||
|
|
||||||
|
w = gdk_pixbuf_get_width(pixbuf);
|
||||||
|
h = gdk_pixbuf_get_height(pixbuf);
|
||||||
|
|
||||||
|
gdk_pixbuf_copy_area(pixbuf, 0, 0, w, h, scaled, (24 - w) / 2, (24 - h) / 2);
|
||||||
|
|
||||||
|
source = gtk_icon_source_new();
|
||||||
|
gtk_icon_source_set_pixbuf(source, scaled);
|
||||||
|
gtk_icon_source_set_size(source, GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||||
|
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gm_pixbuf_populate_factory() {
|
gm_pixbuf_populate_factory() {
|
||||||
GdkPixbuf *pixbuf = gm_pixbuf_create_save_close();
|
GdkPixbuf *pixbuf = gm_pixbuf_create_save_close();
|
||||||
GtkIconSet *set;
|
GtkIconSet *set;
|
||||||
|
GtkIconSource *source;
|
||||||
|
|
||||||
set = gtk_icon_set_new_from_pixbuf(pixbuf);
|
set = gtk_icon_set_new_from_pixbuf(pixbuf);
|
||||||
|
|
||||||
|
if (gdk_pixbuf_get_width(pixbuf) < 24) {
|
||||||
|
source = gm_pixbuf_create_stock24(pixbuf);
|
||||||
|
gtk_icon_set_add_source(set, source);
|
||||||
|
|
||||||
|
gtk_icon_source_free(source);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_icon_factory_add(factory, GM_STOCK_SAVE_CLOSE, set);
|
gtk_icon_factory_add(factory, GM_STOCK_SAVE_CLOSE, set);
|
||||||
g_object_unref(pixbuf);
|
g_object_unref(pixbuf);
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue