diff options
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/ChangeLog | 9 | ||||
-rw-r--r-- | e-util/e-popup.c | 21 | ||||
-rw-r--r-- | e-util/e-popup.h | 7 |
3 files changed, 34 insertions, 3 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index f33a5bef7a..c5ccab7aa7 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,12 @@ +2007-12-14 Milan Crha <mcrha@redhat.com> + + ** Part of fix for bug #211353 + + * e-popup.h: + * e-popup.c: (ep_build_tree): + Toggles can be in inconsistent state now, and can also contain + an image, which is a pointer to GtkImage widget. + 2007-12-17 Srinivasa Ragavan <sragavan@novell.com> * Makefile.am: Add e-logger.[ch] to compilation diff --git a/e-util/e-popup.c b/e-util/e-popup.c index edeb6cebdc..b7d904a6eb 100644 --- a/e-util/e-popup.c +++ b/e-util/e-popup.c @@ -37,6 +37,7 @@ #include <gtk/gtkseparatormenuitem.h> #include <gtk/gtklabel.h> #include <gtk/gtkimage.h> +#include <gtk/gtkhbox.h> #include "e-popup.h" @@ -381,7 +382,13 @@ ep_build_tree(struct _item_node *inode, guint32 mask) break; case E_POPUP_TOGGLE: menuitem = (GtkMenuItem *)gtk_check_menu_item_new(); - gtk_check_menu_item_set_active((GtkCheckMenuItem *)menuitem, item->type & E_POPUP_ACTIVE); + if (item->type & E_POPUP_INCONSISTENT) + gtk_check_menu_item_set_inconsistent (GTK_CHECK_MENU_ITEM (menuitem), TRUE); + else + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), item->type & E_POPUP_ACTIVE); + + if (item->image) + gtk_widget_show (item->image); break; case E_POPUP_RADIO: { char *ppath = inode->parent?inode->parent->item->path:NULL; @@ -411,7 +418,17 @@ ep_build_tree(struct _item_node *inode, guint32 mask) label = gtk_label_new_with_mnemonic(dgettext(inode->menu->domain, item->label)); gtk_misc_set_alignment((GtkMisc *)label, 0.0, 0.5); gtk_widget_show(label); - gtk_container_add((GtkContainer *)menuitem, label); + if (item->image && (item->type & E_POPUP_TYPE_MASK) == E_POPUP_TOGGLE) { + GtkWidget *hbox = gtk_hbox_new (FALSE, 4); + + gtk_box_pack_start (GTK_BOX (hbox), item->image, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); + gtk_widget_show (hbox); + gtk_container_add (GTK_CONTAINER (menuitem), hbox); + } else + gtk_container_add((GtkContainer *)menuitem, label); + } else if (item->image && (item->type & E_POPUP_TYPE_MASK) == E_POPUP_TOGGLE) { + gtk_container_add (GTK_CONTAINER (menuitem), item->image); } if (item->activate) diff --git a/e-util/e-popup.h b/e-util/e-popup.h index a4928c035c..617239c8f0 100644 --- a/e-util/e-popup.h +++ b/e-util/e-popup.h @@ -50,7 +50,9 @@ typedef void (*EPopupItemsFunc)(EPopup *ep, GSList *items, void *data); /** * enum _e_popup_t - Popup item type enumeration. * @E_POPUP_ITEM: A simple menu item. - * @E_POPUP_TOGGLE: A toggle menu item. + * @E_POPUP_TOGGLE: A toggle menu item. If struct _EPopupItem::image is + * not NULL, then it points to GtkImage directly and there is a toggle + * with an image and caption shown in the popup menu. * @E_POPUP_RADIO: A radio menu item. Note that the radio group is * global for the entire (sub) menu. i.e. submenu's must be used to * separate radio button menu items. @@ -63,6 +65,8 @@ typedef void (*EPopupItemsFunc)(EPopup *ep, GSList *items, void *data); * @E_POPUP_TYPE_MASK: Mask used to separate item type from option bits. * @E_POPUP_ACTIVE: An option bit to signify that the radio button or * toggle button is active. + * @E_POPUP_INCONSISTENT: An option to toggle only, if set, the toggle + * is shown in inconsistent state. This is used before E_POPUP_ACTIVE. */ enum _e_popup_t { E_POPUP_ITEM = 0, @@ -73,6 +77,7 @@ enum _e_popup_t { E_POPUP_BAR, E_POPUP_TYPE_MASK = 0xffff, E_POPUP_ACTIVE = 0x10000, + E_POPUP_INCONSISTENT = 0x20000 }; /* FIXME: activate passes back no context data apart from that provided. |