aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--example/menus.c8
-rw-r--r--src/idousermenuitem.c36
-rw-r--r--src/idousermenuitem.h2
3 files changed, 24 insertions, 22 deletions
diff --git a/example/menus.c b/example/menus.c
index b303cf5..1675f45 100644
--- a/example/menus.c
+++ b/example/menus.c
@@ -106,7 +106,7 @@ main (int argc, char *argv[])
menuitem = ido_user_menu_item_new ();
g_object_set (menuitem,
"label", "Guest",
- "icon", NULL,
+ "icon-filename", NULL,
"is-logged-in", FALSE,
"is-current-user", FALSE,
NULL);
@@ -115,7 +115,7 @@ main (int argc, char *argv[])
menuitem = ido_user_menu_item_new ();
g_object_set (menuitem,
"label", "Bobby Fischer",
- "icon", "/usr/share/pixmaps/faces/chess.jpg",
+ "icon-filename", "/usr/share/pixmaps/faces/chess.jpg",
"is-logged-in", FALSE,
"is-current-user", FALSE,
NULL);
@@ -124,7 +124,7 @@ main (int argc, char *argv[])
menuitem = ido_user_menu_item_new ();
g_object_set (menuitem,
"label", "Linus Torvalds",
- "icon", "/usr/share/pixmaps/faces/penguin.jpg",
+ "icon-filename", "/usr/share/pixmaps/faces/penguin.jpg",
"is-logged-in", TRUE,
"is-current-user", FALSE,
NULL);
@@ -132,7 +132,7 @@ main (int argc, char *argv[])
menuitem = ido_user_menu_item_new ();
g_object_set (menuitem, "label", "Mark Shuttleworth",
- "icon", "/usr/share/pixmaps/faces/astronaut.jpg",
+ "icon-filename", "/usr/share/pixmaps/faces/astronaut.jpg",
"is-logged-in", TRUE,
"is-current-user", TRUE,
NULL);
diff --git a/src/idousermenuitem.c b/src/idousermenuitem.c
index 5677065..cb405e8 100644
--- a/src/idousermenuitem.c
+++ b/src/idousermenuitem.c
@@ -33,7 +33,7 @@ enum
{
PROP_0,
PROP_LABEL,
- PROP_ICON,
+ PROP_ICON_FILENAME,
PROP_IS_LOGGED_IN,
PROP_IS_CURRENT_USER,
PROP_LAST
@@ -50,7 +50,7 @@ struct _IdoUserMenuItemPrivate
gboolean is_logged_in;
gboolean is_current_user;
gchar * label;
- gchar * icon_name;
+ gchar * icon_filename;
};
G_DEFINE_TYPE (IdoUserMenuItem, ido_user_menu_item, GTK_TYPE_MENU_ITEM);
@@ -75,8 +75,8 @@ my_get_property (GObject * o,
g_value_set_string (value, self->priv->label);
break;
- case PROP_ICON:
- g_value_set_string (value, self->priv->icon_name);
+ case PROP_ICON_FILENAME:
+ g_value_set_string (value, self->priv->icon_filename);
break;
case PROP_IS_LOGGED_IN:
@@ -107,7 +107,7 @@ my_set_property (GObject * o,
ido_user_menu_item_set_label (self, g_value_get_string (value));
break;
- case PROP_ICON:
+ case PROP_ICON_FILENAME:
ido_user_menu_item_set_icon (self, g_value_get_string (value));
break;
@@ -138,7 +138,7 @@ my_finalize (GObject *object)
IdoUserMenuItem * self = IDO_USER_MENU_ITEM (object);
g_free (self->priv->label);
- g_free (self->priv->icon_name);
+ g_free (self->priv->icon_filename);
G_OBJECT_CLASS (ido_user_menu_item_parent_class)->finalize (object);
}
@@ -166,11 +166,11 @@ ido_user_menu_item_class_init (IdoUserMenuItemClass *klass)
"J. Random User",
prop_flags);
- properties[PROP_ICON] = g_param_spec_string ("icon",
- "The icon's name",
- "The icon to display",
- NULL,
- prop_flags);
+ properties[PROP_ICON_FILENAME] = g_param_spec_string ("icon-filename",
+ "The icon's filename",
+ "The icon to display",
+ NULL,
+ prop_flags);
properties[PROP_IS_LOGGED_IN] = g_param_spec_boolean ("is-logged-in",
"is logged in",
@@ -286,18 +286,18 @@ ido_user_menu_item_primitive_draw_cb_gtk_3 (GtkWidget * widget,
***/
void
-ido_user_menu_item_set_icon (IdoUserMenuItem * self, const char * icon_name)
+ido_user_menu_item_set_icon (IdoUserMenuItem * self, const char * icon_filename)
{
gboolean updated = FALSE;
IdoUserMenuItemPrivate * p = self->priv;
GtkImage * image = GTK_IMAGE (p->user_image);
/* make a private copy of the icon name */
- g_free (p->icon_name);
- self->priv->icon_name = g_strdup (icon_name);
+ g_free (p->icon_filename);
+ self->priv->icon_filename = g_strdup (icon_filename);
/* now try to use it */
- if (icon_name && *icon_name)
+ if (icon_filename && *icon_filename)
{
int width = 18; /* arbitrary default values */
int height = 18;
@@ -306,7 +306,8 @@ ido_user_menu_item_set_icon (IdoUserMenuItem * self, const char * icon_name)
/* load the image */
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);
- pixbuf = gdk_pixbuf_new_from_file_at_size (icon_name, width, height, &err);
+ pixbuf = gdk_pixbuf_new_from_file_at_size (icon_filename,
+ width, height, &err);
if (err == NULL)
{
gtk_image_set_from_pixbuf (image, pixbuf);
@@ -315,7 +316,8 @@ ido_user_menu_item_set_icon (IdoUserMenuItem * self, const char * icon_name)
}
else
{
- g_warning ("Couldn't load the image \"%s\": %s", icon_name, err->message);
+ g_warning ("Couldn't load the image \"%s\": %s",
+ icon_filename, err->message);
g_clear_error (&err);
}
}
diff --git a/src/idousermenuitem.h b/src/idousermenuitem.h
index 7826718..b9a3d00 100644
--- a/src/idousermenuitem.h
+++ b/src/idousermenuitem.h
@@ -36,7 +36,7 @@ typedef struct _IdoUserMenuItemPrivate IdoUserMenuItemPrivate;
/* property keys */
#define IDO_USER_MENU_ITEM_PROP_LABEL "label"
-#define IDO_USER_MENU_ITEM_PROP_ICON "icon"
+#define IDO_USER_MENU_ITEM_PROP_ICON_FILENAME "icon-filename"
#define IDO_USER_MENU_ITEM_PROP_IS_LOGGED_IN "is-logged-in"
#define IDO_USER_MENU_ITEM_PROP_IS_CURRENT_USER "is-current-user"