diff options
author | John Sullivan <sullivan@src.gnome.org> | 2000-02-15 19:25:37 +0000 |
---|---|---|
committer | John Sullivan <sullivan@src.gnome.org> | 2000-02-15 19:25:37 +0000 |
commit | ee43878056ae1da0732b442c20d043177f55911f (patch) | |
tree | de98935505df05c633e11298a743f6db4e2bc331 /src/nautilus-bookmark.c | |
parent | 57ec570570340bbe83d4251da95288c3fabeacde (diff) | |
download | nautilus-ee43878056ae1da0732b442c20d043177f55911f.tar.gz |
Added small icons to the Back and Forward context menus. Made window back and
forward lists store NautilusBookmark pointers instead of just char *.
Diffstat (limited to 'src/nautilus-bookmark.c')
-rw-r--r-- | src/nautilus-bookmark.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/nautilus-bookmark.c b/src/nautilus-bookmark.c index 8372f6e36..314c9800b 100644 --- a/src/nautilus-bookmark.c +++ b/src/nautilus-bookmark.c @@ -34,6 +34,8 @@ struct _NautilusBookmarkDetails +static GtkWidget *create_pixmap_widget_for_bookmark (const NautilusBookmark *bookmark); + static GtkObjectClass *parent_class = NULL; /* GtkObject methods. */ @@ -219,3 +221,60 @@ nautilus_bookmark_new (const gchar *name, const gchar *uri) return new_bookmark; } +static GtkWidget * +create_pixmap_widget_for_bookmark (const NautilusBookmark *bookmark) +{ + GdkPixmap *gdk_pixmap; + GdkBitmap *mask; + + if (!nautilus_bookmark_get_pixmap_and_mask (bookmark, + NAUTILUS_ICON_SIZE_SMALLER, + &gdk_pixmap, + &mask)) + { + return NULL; + } + + return gtk_pixmap_new (gdk_pixmap, mask); +} + +/** + * nautilus_bookmark_menu_item_new: + * + * Return a menu item representing a bookmark. + * @bookmark: The bookmark the menu item represents. + * Return value: A newly-created bookmark. + **/ +GtkWidget * +nautilus_bookmark_menu_item_new (const NautilusBookmark *bookmark) +{ + GtkWidget *menu_item; + GtkWidget *pixmap_widget; + GtkWidget *accel_label; + + /* Could check gnome_preferences_get_menus_have_icons here, but these + * are more important than stock menu icons, since they're connected to + * user data. For now let's not let them be turn-offable and see if + * anyone objects strenuously. + */ + menu_item = gtk_pixmap_menu_item_new (); + + pixmap_widget = create_pixmap_widget_for_bookmark (bookmark); + if (pixmap_widget != NULL) + { + gtk_widget_show (pixmap_widget); + gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (menu_item), pixmap_widget); + } + + accel_label = gtk_accel_label_new (nautilus_bookmark_get_name (bookmark)); + gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); + + gtk_container_add (GTK_CONTAINER (menu_item), accel_label); + gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (accel_label), menu_item); + gtk_widget_show (accel_label); + + return menu_item; +} + + + |