mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
gtk-demo: Replace logo with a transparent one
That way, we don't have to make it transparent in all the demos.
This commit is contained in:
parent
b3d1121d78
commit
bc473257c7
@ -126,7 +126,7 @@ RESOURCES= $(demos) \
|
||||
gnu-keys.png \
|
||||
gtk-logo-24.png \
|
||||
gtk-logo-48.png \
|
||||
gtk-logo-rgb.gif \
|
||||
gtk-logo-old.png \
|
||||
css_accordion.css \
|
||||
css_basics.css \
|
||||
css_multiplebgs.css \
|
||||
|
@ -80,7 +80,7 @@ static void
|
||||
about_cb (GtkAction *action,
|
||||
GtkWidget *window)
|
||||
{
|
||||
GdkPixbuf *pixbuf, *transparent;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
const gchar *authors[] = {
|
||||
"Peter Mattis",
|
||||
@ -98,11 +98,9 @@ about_cb (GtkAction *action,
|
||||
NULL
|
||||
};
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_resource ("/appwindow/gtk-logo-rgb.gif", NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_resource ("/appwindow/gtk-logo-old.png", NULL);
|
||||
/* We asser the existence of the pixbuf as we load it from a custom resource. */
|
||||
g_assert (pixbuf);
|
||||
transparent = gdk_pixbuf_add_alpha (pixbuf, TRUE, 0xff, 0xff, 0xff);
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
gtk_show_about_dialog (GTK_WINDOW (window),
|
||||
"program-name", "GTK+ Code Demos",
|
||||
@ -117,11 +115,11 @@ about_cb (GtkAction *action,
|
||||
"comments", "Program to demonstrate GTK+ functions.",
|
||||
"authors", authors,
|
||||
"documenters", documentors,
|
||||
"logo", transparent,
|
||||
"logo", pixbuf,
|
||||
"title", "About GTK+ Code Demos",
|
||||
NULL);
|
||||
|
||||
g_object_unref (transparent);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
@ -303,7 +301,6 @@ register_stock_icons (void)
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkIconFactory *factory;
|
||||
GtkIconSet *icon_set;
|
||||
GdkPixbuf *transparent;
|
||||
|
||||
static GtkStockItem items[] = {
|
||||
{ "demo-gtk-logo",
|
||||
@ -320,18 +317,14 @@ register_stock_icons (void)
|
||||
factory = gtk_icon_factory_new ();
|
||||
gtk_icon_factory_add_default (factory);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_resource ("/appwindow/gtk-logo-rgb.gif", NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_resource ("/appwindow/gtk-logo-old.png", NULL);
|
||||
/* We assert the existence of the pixbuf as we load it from a custom resource. */
|
||||
g_assert (pixbuf);
|
||||
|
||||
/* The gtk-logo-rgb icon has a white background, make it transparent */
|
||||
transparent = gdk_pixbuf_add_alpha (pixbuf, TRUE, 0xff, 0xff, 0xff);
|
||||
|
||||
icon_set = gtk_icon_set_new_from_pixbuf (transparent);
|
||||
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
|
||||
gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
|
||||
gtk_icon_set_unref (icon_set);
|
||||
g_object_unref (pixbuf);
|
||||
g_object_unref (transparent);
|
||||
|
||||
/* Drop our reference to the factory, GTK will hold a reference. */
|
||||
g_object_unref (factory);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/">
|
||||
<file>gtk-logo-rgb.gif</file>
|
||||
<file>gtk-logo-old.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/application">
|
||||
<file preprocess="to-pixdata">gtk-logo-24.png</file>
|
||||
@ -10,7 +10,7 @@
|
||||
<file preprocess="xml-stripblanks">menus.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/appwindow">
|
||||
<file preprocess="to-pixdata">gtk-logo-rgb.gif</file>
|
||||
<file preprocess="to-pixdata">gtk-logo-old.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/builder">
|
||||
<file>demo.ui</file>
|
||||
@ -58,7 +58,7 @@
|
||||
<gresource prefix="/images">
|
||||
<file>alphatest.png</file>
|
||||
<file>floppybuddy.gif</file>
|
||||
<file>gtk-logo-rgb.gif</file>
|
||||
<file>gtk-logo-old.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/pixbufs">
|
||||
<file>apple-red.png</file>
|
||||
@ -122,6 +122,6 @@
|
||||
</gresource>
|
||||
<gresource prefix="/textview">
|
||||
<file>floppybuddy.gif</file>
|
||||
<file>gtk-logo-rgb.gif</file>
|
||||
<file>gtk-logo-old.png</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
BIN
demos/gtk-demo/gtk-logo-old.png
Normal file
BIN
demos/gtk-demo/gtk-logo-old.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.3 KiB |
@ -361,7 +361,7 @@ do_images (GtkWidget *do_widget)
|
||||
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_resource ("/images/gtk-logo-rgb.gif", NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_resource ("/images/gtk-logo-old.png", NULL);
|
||||
/* The image loading must work, we ensure that the resources are valid. */
|
||||
g_assert (pixbuf);
|
||||
|
||||
|
@ -850,19 +850,15 @@ create_tree (void)
|
||||
static void
|
||||
setup_default_icon (void)
|
||||
{
|
||||
GdkPixbuf *pixbuf, *transparent;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_resource ("/gtk-logo-rgb.gif", NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_resource ("/gtk-logo-old.png", NULL);
|
||||
/* We load a resource, so we can guarantee that loading it is successful */
|
||||
g_assert (pixbuf);
|
||||
|
||||
/* The gtk-logo-rgb icon has a white background, make it transparent */
|
||||
transparent = gdk_pixbuf_add_alpha (pixbuf, TRUE, 0xff, 0xff, 0xff);
|
||||
|
||||
gtk_window_set_default_icon (transparent);
|
||||
gtk_window_set_default_icon (pixbuf);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
g_object_unref (transparent);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -131,7 +131,7 @@ insert_text (GtkTextBuffer *buffer)
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *scaled;
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_resource ("/textview/gtk-logo-rgb.gif", NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_resource ("/textview/gtk-logo-old.png", NULL);
|
||||
g_assert (pixbuf);
|
||||
|
||||
scaled = gdk_pixbuf_scale_simple (pixbuf, 32, 32, GDK_INTERP_BILINEAR);
|
||||
|
Loading…
Reference in New Issue
Block a user