void snippets_fill_tree_item_from_node(GtkTreeIter *iter, xmlNodePtr node) { gchar *title; gboolean recursive=FALSE; GdkPixbuf* pixmap=NULL; DEBUG_MSG("snippets_fill_tree_item_from_node, got node with type %s\n",node->name); title = (gchar *)xmlGetProp(node, (const xmlChar *)"title"); DEBUG_MSG("snippets_fill_tree_item_from_node, node has title %s\n",title); if ((xmlStrEqual(node->name, (const xmlChar *)"branch"))) { pixmap = NULL; recursive = TRUE; } else /*if ((xmlStrEqual(cur->name, (const xmlChar *)"leaf")))*/ { xmlChar *type; type = xmlGetProp(node, (const xmlChar *)"type"); if (xmlStrEqual(type, (const xmlChar *)"insert")) { pixmap = gdk_pixbuf_new_from_inline(-1, pixmap_insert, FALSE, NULL); } else if (xmlStrEqual(type, (const xmlChar *)"snr")) { pixmap = gdk_pixbuf_new_from_inline(-1, pixmap_snr, FALSE, NULL); } xmlFree(type); } gtk_tree_store_set(snippets_v.store, iter, PIXMAP_COLUMN, pixmap, TITLE_COLUMN, title,NODE_COLUMN, node,-1); if (pixmap) { g_object_unref(pixmap); } xmlFree(title); if (recursive) { walk_tree(node, iter); } }
void icon_init() { icon_idle = gdk_pixbuf_new_from_inline(-1, irssi, FALSE, NULL); icon_alert = gdk_pixbuf_new_from_inline(-1, irssi_alert, FALSE, NULL); status_icon = gtk_status_icon_new_from_pixbuf(icon_idle); g_signal_connect(G_OBJECT(status_icon), "activate", G_CALLBACK(icon_reset), NULL); }
void pixmaps_init (void) { pix_book = gdk_pixbuf_new_from_inline (-1, bookpng, FALSE, 0); /* used in About window, tray icon and WindowManager icon. */ LOADPIX (pix_xchat, xchatpng, "xchat"EXT); /* userlist icons, with inlined defaults */ LOADPIX (pix_hop, hoppng, "hop"EXT); LOADPIX (pix_purple, purplepng, "purple"EXT); LOADPIX (pix_red, redpng, "red"EXT); LOADPIX (pix_op, oppng, "op"EXT); LOADPIX (pix_voice, voicepng, "voice"EXT); /* tray icons, with inlined defaults */ LOADPIX (pix_tray_msg, traymsgpng, "message"EXT); LOADPIX (pix_tray_hilight, trayhilightpng, "highlight"EXT); LOADPIX (pix_tray_file, trayfilepng, "fileoffer"EXT); /* treeview icons, no defaults, load from disk only */ LOADPIX_DISKONLY (pix_channel, "channel"EXT); LOADPIX_DISKONLY (pix_dialog, "dialog"EXT); LOADPIX_DISKONLY (pix_server, "server"EXT); LOADPIX_DISKONLY (pix_util, "util"EXT); }
void icons_load_throbber(GdkPixbuf *pbs[]) { const guint8 *data; int i; GdkPixbuf *pb; gint w, h; gtk_icon_size_lookup(GTK_ICON_SIZE_DIALOG, &w, &h); for (i = 0; i < THROBBER_COUNT; i++) { switch (i) { case 0: data = logjam_throbber_1; break; case 1: data = logjam_throbber_2; break; case 2: data = logjam_throbber_3; break; case 3: data = logjam_throbber_4; break; case 4: data = logjam_throbber_5; break; case 5: data = logjam_throbber_6; break; case 6: data = logjam_throbber_7; break; case 7: data = logjam_throbber_8; break; default: g_warning("tried to load unknown throbber %d.", i); return; } pb = gdk_pixbuf_new_from_inline(-1, data, FALSE, NULL); pbs[i] = gdk_pixbuf_scale_simple(pb, w, h, GDK_INTERP_BILINEAR); g_object_unref(G_OBJECT(pb)); } }
GdkPixbuf * gimp_plug_in_procedure_get_pixbuf (const GimpPlugInProcedure *proc) { GdkPixbuf *pixbuf = NULL; GError *error = NULL; g_return_val_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc), NULL); switch (proc->icon_type) { case GIMP_ICON_TYPE_INLINE_PIXBUF: pixbuf = gdk_pixbuf_new_from_inline (proc->icon_data_length, proc->icon_data, TRUE, &error); break; case GIMP_ICON_TYPE_IMAGE_FILE: pixbuf = gdk_pixbuf_new_from_file ((gchar *) proc->icon_data, &error); break; default: break; } if (! pixbuf && error) { g_printerr ("%s\n", error->message); g_clear_error (&error); } return pixbuf; }
void pixmaps_init (void) { pix_book = gdk_pixbuf_new_from_inline (-1, bookpng, FALSE, 0); /* used in About window, tray icon and WindowManager icon. */ pix_xchat = load_pixmap ("hexchat", hexchatpng, 1); /* userlist icons, with inlined defaults */ pix_hop = load_pixmap ("hop", hoppng, 1); pix_purple = load_pixmap ("purple", purplepng, 1); pix_red = load_pixmap ("red", redpng, 1); pix_op = load_pixmap ("op", oppng, 1); pix_voice = load_pixmap ("voice", voicepng, 1); /* tray icons, with inlined defaults */ pix_tray_msg = load_pixmap ("message", traymsgpng, 1); pix_tray_hilight = load_pixmap ("highlight", trayhilightpng, 1); pix_tray_file = load_pixmap ("fileoffer", trayfilepng, 1); /* treeview icons, no defaults, load from disk only */ pix_channel = load_pixmap ("channel", NULL, 0); pix_dialog = load_pixmap ("dialog", NULL, 0); pix_server = load_pixmap ("server", NULL, 0); pix_util = load_pixmap ("util", NULL, 0); }
static void add_stock_item(void) { GtkIconSet *icon_set; GtkIconFactory *factory = gtk_icon_factory_new(); GtkIconTheme *theme = gtk_icon_theme_get_default(); GtkStockItem item = { GEANYSENDMAIL_STOCK_MAIL, N_("Mail"), 0, 0, GETTEXT_PACKAGE }; if (gtk_icon_theme_has_icon(theme, "mail-message-new")) { GtkIconSource *icon_source = gtk_icon_source_new(); icon_set = gtk_icon_set_new(); gtk_icon_source_set_icon_name(icon_source, "mail-message-new"); gtk_icon_set_add_source(icon_set, icon_source); gtk_icon_source_free(icon_source); } else { GdkPixbuf *pb = gdk_pixbuf_new_from_inline(-1, mail_pixbuf, FALSE, NULL); icon_set = gtk_icon_set_new_from_pixbuf(pb); g_object_unref(pb); } gtk_icon_factory_add(factory, item.stock_id, icon_set); gtk_stock_add(&item, 1); gtk_icon_factory_add_default(factory); g_object_unref(factory); gtk_icon_set_unref(icon_set); }
/* [ show_about ] * Creates the about dialog */ void show_about (GtkWidget *widget, gpointer data) { GdkPixbuf *pixbuf; static GtkWidget *dialog = NULL; /* Don't create more than one about box */ if (dialog != NULL) { g_assert (GTK_WIDGET_REALIZED (dialog)); gdk_window_show (dialog->window); gdk_window_raise (dialog->window); } else { const gchar *authors[] = { "Tomas Junnonen <*****@*****.**> - Main Developer, Maintainer", "Paul Drain <*****@*****.**> - Developer", NULL}; pixbuf = gdk_pixbuf_new_from_inline (-1, pengo, FALSE, NULL); dialog = gnome_about_new ( "Fortified", VERSION, "(C) 2000-2005 Tomas Junnonen", _("An all-in-one Linux firewall utility for GNOME.\n"), authors, NULL, NULL, pixbuf); g_signal_connect (G_OBJECT (dialog), "destroy", G_CALLBACK (gtk_widget_destroyed), &dialog); g_object_unref (G_OBJECT(pixbuf)); gtk_widget_show (dialog); } }
static void meta_stock_icons_init (void) { GtkIconFactory *factory; int i; MetaStockIcon items[] = { { METACITY_STOCK_DELETE, stock_delete_data }, { METACITY_STOCK_MINIMIZE, stock_minimize_data }, { METACITY_STOCK_MAXIMIZE, stock_maximize_data } }; factory = gtk_icon_factory_new (); gtk_icon_factory_add_default (factory); for (i = 0; i < (gint) G_N_ELEMENTS (items); i++) { GtkIconSet *icon_set; GdkPixbuf *pixbuf; pixbuf = gdk_pixbuf_new_from_inline (-1, items[i].icon_data, FALSE, NULL); icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); gtk_icon_factory_add (factory, items[i].stock_id, icon_set); gtk_icon_set_unref (icon_set); g_object_unref (G_OBJECT (pixbuf)); } g_object_unref (G_OBJECT (factory)); }
GdkCursor * create_cursor(GdkWindow *window, const guint8 *data, int hot_x, int hot_y) { GdkPixbuf *pixbuf; GdkCursor *cursor; GdkDisplay *display; g_return_val_if_fail(window != NULL, NULL); #if GTK_CHECK_VERSION (2,24,0) display = gdk_window_get_display (window); #else display = gdk_drawable_get_display (GDK_DRAWABLE (window)); #endif pixbuf = gdk_pixbuf_new_from_inline(-1, data, FALSE, NULL); cursor = gdk_cursor_new_from_pixbuf (display, pixbuf, hot_x,hot_y); g_assert(cursor != NULL); g_object_unref(pixbuf); return cursor; }
static GdkCursor * make_cursor (GdkDisplay *display) { GdkCursor *cursor; GdkPixbuf *pixbuf; static const guint8 *data; if (gdk_display_supports_cursor_alpha (display) && gdk_display_supports_cursor_color (display)) { data = cursor_color_picker; } else { data = cursor_color_picker_bw; } pixbuf = gdk_pixbuf_new_from_inline (-1, data, FALSE, NULL); cursor = gdk_cursor_new_from_pixbuf (display, pixbuf, 1, 30); g_object_unref (pixbuf); return cursor; }
GtkWidget*sc_image_new_by_size(const guint8* data,int width,int height) { GtkWidget*image; GdkPixbuf*pxf=gdk_pixbuf_new_from_inline(-1,data,FALSE,NULL); GdkPixbuf*real_pxf; if(!pxf) { image=gtk_image_new_from_icon_name("image-x-generic",GTK_ICON_SIZE_BUTTON); } else { real_pxf=gdk_pixbuf_scale_simple(pxf,width,height,GDK_INTERP_HYPER); g_object_unref(pxf); image=gtk_image_new_from_pixbuf(real_pxf); g_object_set(image,"pixel-size",GTK_IMAGE_PIXBUF,NULL); } g_object_unref(real_pxf); return image; }
GtkWidget*sc_image_button_new(const guint8* data) { GtkWidget*image; GtkWidget*button=gtk_button_new(); GdkPixbuf*pxf=gdk_pixbuf_new_from_inline(-1,data,FALSE,NULL); if(!pxf) { image=gtk_image_new_from_icon_name("image-x-generic",GTK_ICON_SIZE_BUTTON); } else { image=gtk_image_new_from_pixbuf(pxf); g_object_unref(pxf); } gtk_button_set_image(GTK_BUTTON(button),image); gtk_button_set_always_show_image(GTK_BUTTON(button),TRUE); sc_button_set_style(GTK_BUTTON(button)); return button; }
GtkWidget* utl_gui_image_label_radio_button (gchar *label, const guint8 *pix) { GtkWidget *button; GtkWidget *alignment; GtkWidget *hbox; GtkWidget *image; GdkPixbuf *icon; button = g_object_new (GTK_TYPE_RADIO_BUTTON, "visible", TRUE, NULL); alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); hbox = gtk_hbox_new (FALSE, 2); gtk_container_add (GTK_CONTAINER (alignment), hbox); icon = gdk_pixbuf_new_from_inline (-1, pix, FALSE, NULL); image = gtk_image_new_from_pixbuf(icon); gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, TRUE, 0); if (label != NULL && label != (gchar *)-1) { gtk_box_pack_start (GTK_BOX (hbox), g_object_new (GTK_TYPE_LABEL, "label", label, "use_underline", TRUE, NULL), FALSE, TRUE, 0); } gtk_widget_show_all (alignment); gtk_container_add (GTK_CONTAINER (button), alignment); return button; }
static void add_stock_icon (const gchar *stock_id, GtkIconSize size, const guint8 *inline_data) { GtkIconSource *source; GtkIconSet *set; GdkPixbuf *pixbuf; source = gtk_icon_source_new (); gtk_icon_source_set_size (source, size); gtk_icon_source_set_size_wildcarded (source, FALSE); pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL); gtk_icon_source_set_pixbuf (source, pixbuf); g_object_unref (pixbuf); set = gtk_icon_set_new (); gtk_icon_set_add_source (set, source); gtk_icon_source_free (source); gtk_icon_factory_add (mapobject_icon_factory, stock_id, set); gtk_icon_set_unref (set); }
void get_meta_info (EngineMetaInfo * emi) { emi->version = g_strdup("0.1"); emi->description = g_strdup(_("Based on original gtk-window-decorator")); emi->last_compat = g_strdup("0.0"); /* old themes still compatible */ emi->icon = gdk_pixbuf_new_from_inline(-1, my_pixbuf, TRUE, NULL); }
/* Set the application icons. */ void set_icons(void) { #include "app_icons.h" GList* icons = NULL; /* Setup the application icons. */ icons = g_list_append(icons, gdk_pixbuf_new_from_inline(-1, icon_16x16_inline, FALSE, NULL)); icons = g_list_append(icons, gdk_pixbuf_new_from_inline(-1, icon_24x24_inline, FALSE, NULL)); icons = g_list_append(icons, gdk_pixbuf_new_from_inline(-1, icon_32x32_inline, FALSE, NULL)); icons = g_list_append(icons, gdk_pixbuf_new_from_inline(-1, icon_36x36_inline, FALSE, NULL)); gtk_window_set_default_icon_list(icons); }
GdkPixbuf *create_pixbuf (const gchar *filename) { int nbIcon=sizeof(iconTranslation)/sizeof(name2xpm); int found=-1; for(int i=nbIcon-1;i>=0;i--) { if(!strcmp(iconTranslation[i].name,filename)) found=i; } if(found==-1) { printf("\n Mmmm problem with pixmap button. Did you change the code ?(%s)\n",filename); //ADM_assert(0); return NULL; } GdkPixbuf *pix=NULL; guint8 *gpix; switch(iconTranslation[found].icon) { case A_ICON_XPM: pix= gdk_pixbuf_new_from_xpm_data((const char **)iconTranslation[found].data); break; case A_ICON_PNG: gpix=( guint8 *)iconTranslation[found].data; pix=gdk_pixbuf_new_from_inline (-1, gpix, FALSE, NULL); break; default: ADM_assert(0); } return pix; }
/** * rb_stock_icons_init: * * Initializes the stock icons, adding the necessary filesystem * locations to the GTK icon search path. Must be called on startup. */ void rb_stock_icons_init (void) { GtkIconTheme *theme = gtk_icon_theme_get_default (); int i; int icon_size; char *dot_icon_dir; /* add our icon search paths */ dot_icon_dir = g_build_filename (rb_user_data_dir (), "icons", NULL); gtk_icon_theme_append_search_path (theme, dot_icon_dir); g_free (dot_icon_dir); gtk_icon_theme_append_search_path (theme, SHARE_DIR G_DIR_SEPARATOR_S "icons"); #ifdef USE_UNINSTALLED_DIRS gtk_icon_theme_append_search_path (theme, SHARE_UNINSTALLED_DIR G_DIR_SEPARATOR_S "icons"); #endif /* add inline icons */ gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &icon_size, NULL); for (i = 0; i < (int) G_N_ELEMENTS (inline_icons); i++) { GdkPixbuf *pixbuf; pixbuf = gdk_pixbuf_new_from_inline (-1, inline_icons[i].data, FALSE, NULL); g_assert (pixbuf); gtk_icon_theme_add_builtin_icon (inline_icons[i].name, icon_size, pixbuf); } }
GtkWidget*sc_image_toggle_button_new_by_size(const guint8* data,int siz) { GtkWidget*image; GtkWidget*button=gtk_toggle_button_new(); GdkPixbuf*pxf=gdk_pixbuf_new_from_inline(-1,data,FALSE,NULL); GdkPixbuf*real_pxf; if(!pxf) { image=gtk_image_new_from_icon_name("image-x-generic",GTK_ICON_SIZE_BUTTON); } else { real_pxf=gdk_pixbuf_scale_simple(pxf,siz,siz,GDK_INTERP_HYPER); g_object_unref(pxf); image=gtk_image_new_from_pixbuf(real_pxf); g_object_set(image,"pixel-size",GTK_IMAGE_PIXBUF,NULL); } g_object_unref(real_pxf); gtk_button_set_image(GTK_BUTTON(button),image); gtk_button_set_always_show_image(GTK_BUTTON(button),TRUE); sc_button_set_style(GTK_BUTTON(button)); return button; }
void pixmaps_init (void) { /* userlist icons, with inlined defaults */ pix_ulist_voice = load_pixmap ("ulist_voice", png_ulist_voice, 1); pix_ulist_halfop = load_pixmap ("ulist_halfop", png_ulist_halfop, 1); pix_ulist_op = load_pixmap ("ulist_op", png_ulist_op, 1); pix_ulist_owner = load_pixmap ("ulist_owner", png_ulist_owner, 1); pix_ulist_founder = load_pixmap ("ulist_founder", png_ulist_founder, 1); pix_ulist_netop = load_pixmap ("ulist_netop", png_ulist_netop, 1); /* tray icons, with inlined defaults */ pix_tray_fileoffer = load_pixmap ("tray_fileoffer", png_tray_fileoffer, 1); pix_tray_highlight = load_pixmap ("tray_highlight", png_tray_highlight, 1); pix_tray_message = load_pixmap ("tray_message", png_tray_message, 1); #if 0 /* treeview icons, no defaults, load from disk only */ pix_tree_channel = load_pixmap ("tree_channel", NULL, 0); pix_tree_dialog = load_pixmap ("tree_dialog", NULL, 0); pix_tree_server = load_pixmap ("tree_server", NULL, 0); pix_tree_util = load_pixmap ("tree_util", NULL, 0); #endif /* provide inline defaults for these coz they are nice! */ pix_tree_channel = load_pixmap ("tree_channel", png_tree_channel, 1); pix_tree_dialog = load_pixmap ("tree_dialog", png_tree_dialog, 1); pix_tree_server = load_pixmap ("tree_server", png_tree_server, 1); pix_tree_util = load_pixmap ("tree_util", png_tree_util, 1); /* non-replaceable book pixmap */ pix_book = gdk_pixbuf_new_from_inline (-1, png_book, FALSE, 0); /* used in About window, tray icon and WindowManager icon. */ pix_hexchat = load_pixmap ("hexchat", png_hexchat, 1); }
static void add_default_image(const gchar* stock_id, gint size, const guchar* inline_data) { GdkPixbuf* buf = gdk_pixbuf_new_from_inline(-1, inline_data, FALSE, NULL); g_return_if_fail(buf); gtk_icon_theme_add_builtin_icon(stock_id, size, buf); g_object_unref(buf); }
/* given the model and the path, construct the icon */ static void _dtv_cell_pixbuf_func (GtkCellLayout *layout, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) { DiaObject *object; GdkPixbuf *pixbuf = NULL; gtk_tree_model_get (tree_model, iter, OBJECT_COLUMN, &object, -1); if (object) { if (object->type->pixmap != NULL) { if (strncmp((char *)object->type->pixmap, "GdkP", 4) == 0) pixbuf = gdk_pixbuf_new_from_inline(-1, (guint8*)object->type->pixmap, TRUE, NULL); else /* must be an XPM */ pixbuf = gdk_pixbuf_new_from_xpm_data(object->type->pixmap); } else if (object->type->pixmap_file != NULL) { GError *error = NULL; pixbuf = gdk_pixbuf_new_from_file (object->type->pixmap_file, &error); if (error) { g_warning ("%s", error->message); g_error_free (error); } } else if (IS_GROUP(object)) { pixbuf = gdk_pixbuf_new_from_inline(-1, dia_group_icon, TRUE, NULL); } } else { #if 0 /* these icons are not that useful */ Layer *layer; gtk_tree_model_get (tree_model, iter, LAYER_COLUMN, &layer, -1); if (layer) pixbuf = gdk_pixbuf_new_from_inline(-1, dia_layers, TRUE, NULL); else /* must be diagram */ pixbuf = gdk_pixbuf_new_from_inline(-1, dia_diagram_icon, TRUE, NULL); #endif } g_object_set (cell, "pixbuf", pixbuf, NULL); if (pixbuf) g_object_unref (pixbuf); }
/** * gnomemeeting_stock_icons_init: * * Initializes the GnomeMeeting stock icons * **/ void gnomemeeting_stock_icons_init (void) { int i; typedef struct { char *id; gint size; const guint8 *data; } GmThemeIcon; static const GmThemeIcon theme_builtins[] = { { "audio-volume", 16, gm_audio_volume_16 }, { "brightness", 16, gm_brightness_16}, { "call-placed", 16, gm_call_placed_16}, { "call-missed", 16, gm_call_missed_16}, { "call-received", 16, gm_call_received_16}, { "call-transfer", 16, gm_call_transfer_16}, { "color", 16, gm_color_16}, { "contrast", 16, gm_contrast_16}, { "im-message", 16, gm_im_message_16}, { "im-message-new", 16, gm_im_message_new_16}, { "whiteness", 16, gm_whiteness_16}, { "video-settings", 16, gm_video_settings_16 }, { GM_ICON_LOGO, 16, gm_logo_16_stock_data }, { GM_ICON_LOGO, 22, gm_logo_22_stock_data }, { GM_ICON_LOGO, 32, gm_logo_32_stock_data }, { GM_ICON_LOGO, 48, gm_logo_48_stock_data }, { GM_ICON_LOGO, 72, gm_logo_72_stock_data }, { "phone-hang-up", 16, gm_phone_hang_up_16 }, { "phone-pick-up", 16, gm_phone_pick_up_16 }, { "phone-hang-up", 24, gm_phone_hang_up_24 }, { "phone-pick-up", 24, gm_phone_pick_up_24 }, { "user-inacall", 16, gm_user_inacall_16 }, { "user-ringing", 16, gm_user_ringing_16 }, }; /* Now install theme builtins */ for (i = 0; i < (int) G_N_ELEMENTS (theme_builtins); i++) { GdkPixbuf *pixbuf; pixbuf = gdk_pixbuf_new_from_inline (-1, theme_builtins[i].data, FALSE, NULL); gtk_icon_theme_add_builtin_icon (theme_builtins[i].id, theme_builtins[i].size, pixbuf); g_object_unref (G_OBJECT (pixbuf)); } }
static const GdkPixbuf * get_cursor_pixbuf (GimpCursor *cursor) { if (! cursor->pixbuf) cursor->pixbuf = gdk_pixbuf_new_from_inline (-1, cursor->pixbuf_data, FALSE, NULL); g_return_val_if_fail (cursor->pixbuf != NULL, NULL); return cursor->pixbuf; }
GTKHUpDown::GTKHUpDown(int Width, int Height, void *IncrementFunc, void *DecrementFunc, void *data) : GTKHBox(Width, Height, true, 0) { GdkPixbuf *Pixbuf; GtkWidget *Image; Left = new GTKButton(); Right = new GTKButton(); AddChild(Left); AddChild(Right); Pixbuf = gdk_pixbuf_new_from_inline(-1, ArrowLeft, FALSE, NULL); Image = gtk_image_new_from_pixbuf(Pixbuf); g_object_unref(Pixbuf); Left->SetImage(Image); Pixbuf = gdk_pixbuf_new_from_inline(-1, ArrowRight, FALSE, NULL); Image = gtk_image_new_from_pixbuf(Pixbuf); g_object_unref(Pixbuf); Right->SetImage(Image); Current = Min = Max = 0; Left->SetOnClicked(DecrementFunc, data); Right->SetOnClicked(IncrementFunc, data); }
GdkPixbuf * util_user_mode_tag_pixbuf(enum user_mode_enum user_mode) { GdkPixbuf * pixbuf; switch(user_mode) { case UMODE_AWAY: pixbuf = gdk_pixbuf_new_from_inline(-1, pixbuf_icon_user_tag_away, FALSE, NULL); break; case UMODE_DND: pixbuf = gdk_pixbuf_new_from_inline(-1, pixbuf_icon_user_tag_dnd, FALSE, NULL); break; case UMODE_OFFLINE: pixbuf = gdk_pixbuf_new_from_inline(-1, pixbuf_icon_user_tag_offline, FALSE, NULL); break; default: pixbuf = NULL; break; } return pixbuf; }
static void app_set_icon (GtkWindow *window) { gtk_window_set_icon_name (window, "dia"); if (!gtk_window_get_icon (window)) { GdkPixbuf *pixbuf = gdk_pixbuf_new_from_inline (-1, dia_app_icon, FALSE, NULL); if (pixbuf) { gtk_window_set_icon (window, pixbuf); g_object_unref (pixbuf); } } }
static void add_button(gpointer compose) { GtkWidget *toolbar; PrefsCommon *prefs; gint n = 0; GtkToolItem *item; GtkWidget *icon; GdkPixbuf *pixbuf; if (!config.enable_autoenc) { debug_print("autoenc: autoenc is disabled\n"); return; } toolbar = syl_plugin_compose_get_toolbar(compose); //n = gtk_toolbar_get_n_items(GTK_TOOLBAR(toolbar)); prefs = prefs_common_get(); if (prefs->compose_toolbar_setting) { gint i; gchar **namev; namev = g_strsplit(prefs->compose_toolbar_setting, ",", -1); for (i = 0; namev[i] != NULL; i++) { if (!strcmp(namev[i], "send")) { debug_print("send pos: %d\n", i); n = i + 1; break; } } g_strfreev(namev); } else { /* send,send-later,draft,... */ n = 1; } //icon = stock_pixbuf_widget_for_toolbar(STOCK_PIXMAP_MAIL_SEND); pixbuf = gdk_pixbuf_new_from_inline(sizeof(send_enc), send_enc, FALSE, NULL); icon = gtk_image_new_from_pixbuf(pixbuf); item = gtk_tool_button_new(icon, _("Send with encryption")); gtk_tool_item_set_is_important(item, TRUE); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item, n); //gtk_widget_show_all(GTK_WIDGET(toolbar)); gtk_widget_show_all(GTK_WIDGET(item)); g_object_set_data(G_OBJECT(toolbar), "send-enc-button", item); g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(send_encryption_clicked), compose); change_button_sensitive(compose, GTK_WIDGET(item)); }
static GdkPixbuf * get_fs_icon (IconName icon_name, double icon_size) { GdkPixbuf *pixbuf = NULL; gboolean scale = TRUE; if (icon_pixbuf[icon_name] == NULL) { GtkIconInfo *icon_info = NULL; icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_mime_name[icon_name], icon_size, 0); if (icon_info == NULL) { icon_pixbuf[icon_name] = gdk_pixbuf_new_from_inline (-1, dir_16_rgba, FALSE, NULL); scale = FALSE; } else { icon_pixbuf[icon_name] = gtk_icon_info_load_icon (icon_info, NULL); gtk_icon_info_free (icon_info); } } /* Scale keeping aspect ratio. */ if (! scale) { g_object_ref (icon_pixbuf[icon_name]); return icon_pixbuf[icon_name]; } if (icon_pixbuf[icon_name] != NULL) { int w, h; w = gdk_pixbuf_get_width (icon_pixbuf[icon_name]); h = gdk_pixbuf_get_height (icon_pixbuf[icon_name]); if (scale_keepping_ratio (&w, &h, icon_size, icon_size)) pixbuf = gdk_pixbuf_scale_simple (icon_pixbuf[icon_name], w, h, GDK_INTERP_BILINEAR); else { pixbuf = icon_pixbuf[icon_name]; g_object_ref (pixbuf); } } return pixbuf; }