aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorRodney Dawes <dobey@ximian.com>2004-04-19 23:18:37 +0800
committerRodney Dawes <dobey@src.gnome.org>2004-04-19 23:18:37 +0800
commitf4b4be936edef388577024f565b2f1643d4bd2f9 (patch)
treeeb1dc967076e1a46b25fb1c84c596ef94e40fbc9 /widgets
parent9b8a6860948ad7cd5d1c6a24360e4b59fc120fb2 (diff)
downloadgsoc2013-evolution-f4b4be936edef388577024f565b2f1643d4bd2f9.tar
gsoc2013-evolution-f4b4be936edef388577024f565b2f1643d4bd2f9.tar.gz
gsoc2013-evolution-f4b4be936edef388577024f565b2f1643d4bd2f9.tar.bz2
gsoc2013-evolution-f4b4be936edef388577024f565b2f1643d4bd2f9.tar.lz
gsoc2013-evolution-f4b4be936edef388577024f565b2f1643d4bd2f9.tar.xz
gsoc2013-evolution-f4b4be936edef388577024f565b2f1643d4bd2f9.tar.zst
gsoc2013-evolution-f4b4be936edef388577024f565b2f1643d4bd2f9.zip
Update to use EIconFactory to get the filename for the component icons
2004-04-19 Rodney Dawes <dobey@ximian.com> * e-info-label.c (e_info_label_new): Update to use EIconFactory to get the filename for the component icons using the icon theme 2004-04-19 Michael Terry <mike@mterry.name> * e-combo-buddon.c: * e-url-entry.c: Update these to use EIconFactory and GtkImages directly instead of GdkPixmaps svn path=/trunk/; revision=25513
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog11
-rw-r--r--widgets/misc/e-combo-button.c69
-rw-r--r--widgets/misc/e-info-label.c3
-rw-r--r--widgets/misc/e-url-entry.c6
4 files changed, 40 insertions, 49 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 7418952b54..21d0150b4a 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,14 @@
+2004-04-19 Rodney Dawes <dobey@ximian.com>
+
+ * e-info-label.c (e_info_label_new): Update to use EIconFactory to
+ get the filename for the component icons using the icon theme
+
+2004-04-19 Michael Terry <mike@mterry.name>
+
+ * e-combo-buddon.c:
+ * e-url-entry.c: Update these to use EIconFactory and GtkImages
+ directly instead of GdkPixmaps
+
2004-04-09 Rodney Dawes <dobey@ximian.com>
* e-charset-picker.c: Include gtkhbox.h in here to avoid the warnings
diff --git a/widgets/misc/e-combo-button.c b/widgets/misc/e-combo-button.c
index 802a776942..5dafec034e 100644
--- a/widgets/misc/e-combo-button.c
+++ b/widgets/misc/e-combo-button.c
@@ -25,13 +25,13 @@
#endif
#include "e-combo-button.h"
-#include "art/empty.xpm"
+#include <e-util/e-icon-factory.h>
#include <gtk/gtkarrow.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkmain.h>
-#include <gtk/gtkpixmap.h>
+#include <gtk/gtkimage.h>
#include <gtk/gtksignal.h>
#include <gal/util/e-util.h>
@@ -40,9 +40,9 @@
struct _EComboButtonPrivate {
GdkPixbuf *icon;
- GtkWidget *icon_pixmap;
+ GtkWidget *icon_image;
GtkWidget *label;
- GtkWidget *arrow_pixmap;
+ GtkWidget *arrow_image;
GtkWidget *hbox;
GtkMenu *menu;
@@ -68,35 +68,18 @@ static guint signals[LAST_SIGNAL] = { 0 };
/* Utility functions. */
static GtkWidget *
-create_pixmap_widget_from_pixbuf (GdkPixbuf *pixbuf)
+create_empty_image_widget (void)
{
- GtkWidget *pixmap_widget;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
-
- gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &mask, 128);
-
- pixmap_widget = gtk_pixmap_new (pixmap, mask);
-
- gdk_pixmap_unref (pixmap);
- g_object_unref (mask);
-
- return pixmap_widget;
-}
-
-static GtkWidget *
-create_empty_pixmap_widget (void)
-{
- GtkWidget *pixmap_widget;
+ GtkWidget *image_widget;
GdkPixbuf *pixbuf;
- pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **)empty_xpm);
+ pixbuf = e_icon_factory_get_icon (NULL, 16);
- pixmap_widget = create_pixmap_widget_from_pixbuf (pixbuf);
+ image_widget = gtk_image_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
- return pixmap_widget;
+ return image_widget;
}
static void
@@ -104,8 +87,6 @@ set_icon (EComboButton *combo_button,
GdkPixbuf *pixbuf)
{
EComboButtonPrivate *priv;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
priv = combo_button->priv;
@@ -114,19 +95,15 @@ set_icon (EComboButton *combo_button,
if (pixbuf == NULL) {
priv->icon = NULL;
- gtk_widget_hide (priv->icon_pixmap);
+ gtk_widget_hide (priv->icon_image);
return;
}
priv->icon = g_object_ref (pixbuf);
- gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &mask, 128);
- gtk_pixmap_set (GTK_PIXMAP (priv->icon_pixmap), pixmap, mask);
-
- gtk_widget_show (priv->icon_pixmap);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (priv->icon_image), priv->icon);
- gdk_pixmap_unref (pixmap);
- gdk_pixmap_unref (mask);
+ gtk_widget_show (priv->icon_image);
}
@@ -156,7 +133,7 @@ paint (EComboButton *combo_button,
separator_x = (priv->label->allocation.width
+ priv->label->allocation.x
- + priv->arrow_pixmap->allocation.x) / 2;
+ + priv->arrow_image->allocation.x) / 2;
gtk_widget_style_get (GTK_WIDGET (widget),
"focus-line-width", &focus_width,
@@ -278,9 +255,9 @@ impl_destroy (GtkObject *object)
priv = combo_button->priv;
if (priv) {
- if (priv->arrow_pixmap != NULL) {
- gtk_widget_destroy (priv->arrow_pixmap);
- priv->arrow_pixmap = NULL;
+ if (priv->arrow_image != NULL) {
+ gtk_widget_destroy (priv->arrow_image);
+ priv->arrow_image = NULL;
}
if (priv->icon != NULL) {
@@ -313,7 +290,7 @@ impl_button_press_event (GtkWidget *widget,
GTK_BUTTON (widget)->button_down = TRUE;
if (event->button == 3 ||
- event->x >= priv->arrow_pixmap->allocation.x) {
+ event->x >= priv->arrow_image->allocation.x) {
/* User clicked on the right side: pop up the menu. */
gtk_button_pressed (GTK_BUTTON (widget));
@@ -452,19 +429,19 @@ init (EComboButton *combo_button)
gtk_container_add (GTK_CONTAINER (combo_button), priv->hbox);
gtk_widget_show (priv->hbox);
- priv->icon_pixmap = create_empty_pixmap_widget ();
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->icon_pixmap, TRUE, TRUE, 0);
- gtk_widget_show (priv->icon_pixmap);
+ priv->icon_image = create_empty_image_widget ();
+ gtk_box_pack_start (GTK_BOX (priv->hbox), priv->icon_image, TRUE, TRUE, 0);
+ gtk_widget_show (priv->icon_image);
priv->label = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->label, TRUE, TRUE,
2 * GTK_WIDGET (combo_button)->style->xthickness);
gtk_widget_show (priv->label);
- priv->arrow_pixmap = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
- gtk_box_pack_start (GTK_BOX (priv->hbox), priv->arrow_pixmap, TRUE, TRUE,
+ priv->arrow_image = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
+ gtk_box_pack_start (GTK_BOX (priv->hbox), priv->arrow_image, TRUE, TRUE,
GTK_WIDGET (combo_button)->style->xthickness);
- gtk_widget_show (priv->arrow_pixmap);
+ gtk_widget_show (priv->arrow_image);
priv->icon = NULL;
priv->menu = NULL;
diff --git a/widgets/misc/e-info-label.c b/widgets/misc/e-info-label.c
index fffc24c83d..8b3f006396 100644
--- a/widgets/misc/e-info-label.c
+++ b/widgets/misc/e-info-label.c
@@ -112,9 +112,8 @@ e_info_label_new(const char *icon)
{
EInfoLabel *el = g_object_new(e_info_label_get_type(), 0);
GtkWidget *image;
- char *name = g_strdup_printf(MAP_DIR "/%s", icon);
+ char *name = e_icon_factory_get_icon_filename (icon, 16);
- /* FIXME: the image stuff should use the icon theme stuff when its committed */
image = gtk_image_new_from_file(name);
g_free(name);
gtk_misc_set_padding((GtkMisc *)image, 6, 6);
diff --git a/widgets/misc/e-url-entry.c b/widgets/misc/e-url-entry.c
index 4b680b1add..dad935b1da 100644
--- a/widgets/misc/e-url-entry.c
+++ b/widgets/misc/e-url-entry.c
@@ -28,6 +28,7 @@
#include <gtk/gtk.h>
#include <libgnome/gnome-url.h>
#include "e-url-entry.h"
+#include <e-util/e-icon-factory.h>
struct _EUrlEntryPrivate {
GtkWidget *entry;
@@ -93,6 +94,7 @@ init (EUrlEntry *url_entry)
{
EUrlEntryPrivate *priv;
GtkWidget *pixmap;
+ GdkPixbuf *pixbuf;
priv = g_new0 (EUrlEntryPrivate, 1);
url_entry->priv = priv;
@@ -102,7 +104,9 @@ init (EUrlEntry *url_entry)
priv->button = gtk_button_new ();
gtk_widget_set_sensitive (priv->button, FALSE);
gtk_box_pack_start (GTK_BOX (url_entry), priv->button, FALSE, FALSE, 0);
- pixmap = gtk_image_new_from_file (MAP_DIR "/connect_to_url-16.xpm");
+ pixbuf = e_icon_factory_get_icon ("stock_connect-to-url", 16);
+ pixmap = gtk_image_new_from_pixbuf (pixbuf);
+ g_object_unref (pixbuf);
gtk_container_add (GTK_CONTAINER (priv->button), pixmap);
gtk_widget_show (pixmap);