diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2007-04-20 02:53:33 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-04-20 02:53:33 +0800 |
commit | 64977cb1bcc55bf4c7c0fc38cd3d047b1e6a25c6 (patch) | |
tree | 4ebe95239bef43cb97c0e46aa8194d44e6c88be6 /e-util/e-gui-utils.c | |
parent | bb05f6e6d0541bf29c8dde4e264cc7c23ba52fbb (diff) | |
download | gsoc2013-evolution-64977cb1bcc55bf4c7c0fc38cd3d047b1e6a25c6.tar.gz gsoc2013-evolution-64977cb1bcc55bf4c7c0fc38cd3d047b1e6a25c6.tar.zst gsoc2013-evolution-64977cb1bcc55bf4c7c0fc38cd3d047b1e6a25c6.zip |
Massive code cleanup (bug #429422)
svn path=/trunk/; revision=33432
Diffstat (limited to 'e-util/e-gui-utils.c')
-rw-r--r-- | e-util/e-gui-utils.c | 90 |
1 files changed, 11 insertions, 79 deletions
diff --git a/e-util/e-gui-utils.c b/e-util/e-gui-utils.c index 3c1f6f67af..875dc91ad9 100644 --- a/e-util/e-gui-utils.c +++ b/e-util/e-gui-utils.c @@ -31,58 +31,6 @@ #include <libgnomevfs/gnome-vfs-mime-handlers.h> #include <libgnomeui/gnome-icon-lookup.h> -GtkWidget *e_create_image_widget(gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2) -{ - GtkWidget *alignment = NULL; - GtkWidget *w; - - if (string1) { - w = e_icon_factory_get_image (string1, E_ICON_SIZE_DIALOG); - - gtk_misc_set_alignment (GTK_MISC (w), 0.5, 0.5); - - alignment = gtk_widget_new(gtk_alignment_get_type(), - "child", w, - "xalign", (double) 0, - "yalign", (double) 0, - "xscale", (double) 0, - "yscale", (double) 0, - NULL); - - gtk_widget_show_all (alignment); - } - - return alignment; -} - -GtkWidget * -e_button_new_with_stock_icon (const char *label_str, const char *stockid) -{ - GtkWidget *button, *hbox, *label, *align, *image; - - button = gtk_button_new (); - - label = gtk_label_new_with_mnemonic (label_str); - - gtk_label_set_mnemonic_widget (GTK_LABEL (label), button); - - image = gtk_image_new_from_stock (stockid, GTK_ICON_SIZE_BUTTON); - hbox = gtk_hbox_new (FALSE, 2); - - align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); - - gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); - gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - gtk_container_add (GTK_CONTAINER (button), align); - gtk_container_add (GTK_CONTAINER (align), hbox); - gtk_widget_show_all (align); - - return button; -} - /** * e_icon_for_mime_type: * @mime_type: a MIME type @@ -97,35 +45,19 @@ e_button_new_with_stock_icon (const char *label_str, const char *stockid) GdkPixbuf * e_icon_for_mime_type (const char *mime_type, int size_hint) { - static GnomeIconTheme *icon_theme = NULL; - char *icon_name, *icon_path = NULL; + gchar *icon_name; GdkPixbuf *pixbuf = NULL; - - /* Try the icon theme. (GNOME 2.2 or Sun GNOME 2.0). - * This will also look in GNOME VFS. - */ - - if (!icon_theme) - icon_theme = gnome_icon_theme_new (); - gnome_icon_theme_set_allow_svg (icon_theme, TRUE); - - icon_name = gnome_icon_lookup (icon_theme, NULL, NULL, NULL, NULL, - mime_type, 0, NULL); - if (icon_name) { - /* FIXME: should we take size_hint as being the same - * as e-icon-factory.c? or should we just leave this - * as pixel size? */ - icon_path = gnome_icon_theme_lookup_icon ( - icon_theme, icon_name, size_hint, NULL, NULL); + + icon_name = gnome_icon_lookup ( + gtk_icon_theme_get_default (), + NULL, NULL, NULL, NULL, mime_type, 0, NULL); + + if (icon_name != NULL) { + pixbuf = gtk_icon_theme_load_icon ( + gtk_icon_theme_get_default (), + icon_name, size_hint, 0, NULL); g_free (icon_name); } - - if (icon_path == NULL) - return NULL; - - pixbuf = gdk_pixbuf_new_from_file (icon_path, NULL); - g_free (icon_path); - + return pixbuf; } - |