Skip to content

Instantly share code, notes, and snippets.

@yurenju
Created August 13, 2009 07:53
Show Gist options
  • Save yurenju/167040 to your computer and use it in GitHub Desktop.
Save yurenju/167040 to your computer and use it in GitHub Desktop.
static void
set_event_box_background (GtkWidget *event_box)
{
GError *error = NULL;
const gchar *file_path = g_strjoin ("/", PKGDATADIR, "images", "slider_bg.png", NULL);
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (file_path, &error);
GdkPixmap *pixmap = NULL;
GdkPixmap *mask = NULL;
gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &mask, 255);
GtkStyle *orig_style = gtk_widget_get_style (event_box);
GtkStyle *style = gtk_style_copy (orig_style);
style->bg_pixmap[GTK_STATE_NORMAL] = pixmap;
gtk_widget_set_style (event_box, style);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment