aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/misc/e-popup-menu.c4
-rw-r--r--widgets/misc/e-popup-menu.h53
-rw-r--r--widgets/table/e-table-header-item.c32
3 files changed, 67 insertions, 22 deletions
diff --git a/widgets/misc/e-popup-menu.c b/widgets/misc/e-popup-menu.c
index fd64f451da..f735166883 100644
--- a/widgets/misc/e-popup-menu.c
+++ b/widgets/misc/e-popup-menu.c
@@ -125,7 +125,7 @@ e_popup_menu_create (EPopupMenu *menu_list, guint32 disable_mask, guint32 hide_m
GtkWidget *item;
if (!separator)
- item = make_item (menu, L_(menu_list[i].name), menu_list[i].pixmap);
+ item = make_item (menu, L_(menu_list[i].name), menu_list[i].pixmap_widget);
else
item = make_item (menu, "", NULL);
@@ -135,7 +135,7 @@ e_popup_menu_create (EPopupMenu *menu_list, guint32 disable_mask, guint32 hide_m
if (menu_list[i].fn)
gtk_signal_connect (GTK_OBJECT (item), "activate",
GTK_SIGNAL_FUNC (menu_list[i].fn),
- menu_list[i].closure ? menu_list[i].closure : default_closure);
+ menu_list[i].use_custom_closure ? menu_list[i].closure : default_closure);
} else {
/* submenu */
GtkMenu *submenu;
diff --git a/widgets/misc/e-popup-menu.h b/widgets/misc/e-popup-menu.h
index 66435b9ecf..095c1a42d7 100644
--- a/widgets/misc/e-popup-menu.h
+++ b/widgets/misc/e-popup-menu.h
@@ -32,20 +32,65 @@
BEGIN_GNOME_DECLS
-#define E_POPUP_SEPARATOR { "", NULL, (NULL), NULL, NULL, 0 }
-#define E_POPUP_TERMINATOR { NULL, NULL, (NULL), NULL, NULL, 0 }
+#define E_POPUP_SEPARATOR { "", NULL, (NULL), NULL, 0 }
+#define E_POPUP_TERMINATOR { NULL, NULL, (NULL), NULL, 0 }
+
+
+/* In the following, CC = custom closure */
+
+#define E_POPUP_ITEM(name,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 }
+#define E_POPUP_ITEM_CC(name,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 }
+#define E_POPUP_SUBMENU(name,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 }
+
+#define E_POPUP_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 }
+#define E_POPUP_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 }
+#define E_POPUP_PIXMAP_SUBMENU(name,pixmap,submenu,disable_mask) { (name), (pixmap), NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 }
+
+#define E_POPUP_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 }
+#define E_POPUP_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 0, 0, 0, 1 }
+#define E_POPUP_PIXMAP_WIDGET_SUBMENU(name,pixmap_widget,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 }
+
+
+#define E_POPUP_TOGGLE_ITEM(name,fn,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 1, 0, value, 0 }
+#define E_POPUP_TOGGLE_ITEM_CC(name,fn,closure,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 1, 0, value, 1 }
+
+#define E_POPUP_TOGGLE_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 1, 0, value, 0 }
+#define E_POPUP_TOGGLE_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 1, 0, value, 1 }
+
+#define E_POPUP_TOGGLE_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 1, 0, value, 0 }
+#define E_POPUP_TOGGLE_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 1, 0, value, 1 }
+
+
+#define E_POPUP_RADIO_ITEM(name,fn,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 0, 1, value, 0 }
+#define E_POPUP_RADIO_ITEM_CC(name,fn,closure,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 0, 1, value, 1 }
+
+#define E_POPUP_RADIO_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 0, 1, value, 0 }
+#define E_POPUP_RADIO_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 0, 1, value, 1 }
+
+#define E_POPUP_RADIO_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 0, 1, value, 0 }
+#define E_POPUP_RADIO_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 0, 1, value, 1 }
typedef struct _EPopupMenu EPopupMenu;
struct _EPopupMenu {
char *name;
- GtkWidget *pixmap;
+ const gchar *pixmap;
void (*fn) (GtkWidget *widget, void *closure);
- void *closure;
EPopupMenu *submenu;
guint32 disable_mask;
+
+ /* Added post 0.19 */
+ GtkWidget *pixmap_widget;
+ void *closure;
+
+ guint is_toggle : 1;
+ guint is_radio : 1;
+ guint is_active : 1;
+
+ guint use_custom_closure : 1;
};
+
GtkMenu *e_popup_menu_create (EPopupMenu *menu_list,
guint32 disable_mask,
guint32 hide_mask,
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 1542853d16..87b499fb93 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -1450,22 +1450,22 @@ free_popup_info (GtkWidget *w, EthiHeaderInfo *info)
/* Bit 2 is disabled if not "sortable". */
/* Bit 4 is disabled if we don't have a pointer to our table object. */
static EPopupMenu ethi_context_menu [] = {
- { N_("Sort Ascending"), NULL, GTK_SIGNAL_FUNC(ethi_popup_sort_ascending), NULL, NULL, 2},
- { N_("Sort Descending"), NULL, GTK_SIGNAL_FUNC(ethi_popup_sort_descending), NULL, NULL, 2},
- { N_("Unsort"), NULL, GTK_SIGNAL_FUNC(ethi_popup_unsort), NULL, NULL, 0},
- { "", NULL, GTK_SIGNAL_FUNC(NULL), NULL, NULL, 0},
- { N_("Group By This Field"), NULL, GTK_SIGNAL_FUNC(ethi_popup_group_field), NULL, NULL, 16},
- { N_("Group By Box"), NULL, GTK_SIGNAL_FUNC(ethi_popup_group_box), NULL, NULL, 128},
- { "", NULL, GTK_SIGNAL_FUNC(NULL), NULL, NULL, 1},
- { N_("Remove This Column"), NULL, GTK_SIGNAL_FUNC(ethi_popup_remove_column), NULL, NULL, 8},
- { N_("Add a Column..."), NULL, GTK_SIGNAL_FUNC(ethi_popup_field_chooser), NULL, NULL, 0},
- { "", NULL, GTK_SIGNAL_FUNC(NULL), NULL, NULL, 1},
- { N_("Alignment"), NULL, GTK_SIGNAL_FUNC(ethi_popup_alignment), NULL, NULL, 128},
- { N_("Best Fit"), NULL, GTK_SIGNAL_FUNC(ethi_popup_best_fit), NULL, NULL, 2},
- { N_("Format Columns..."), NULL, GTK_SIGNAL_FUNC(ethi_popup_format_columns), NULL, NULL, 128},
- { "", NULL, GTK_SIGNAL_FUNC(NULL), NULL, NULL, 1},
- { N_("Customize Current View..."), NULL, GTK_SIGNAL_FUNC(ethi_popup_customize_view), NULL, NULL, 4},
- { NULL, NULL, NULL, NULL, 0 }
+ E_POPUP_ITEM (N_("Sort Ascending"), GTK_SIGNAL_FUNC(ethi_popup_sort_ascending), 2),
+ E_POPUP_ITEM (N_("Sort Descending"), GTK_SIGNAL_FUNC(ethi_popup_sort_descending), 2),
+ E_POPUP_ITEM (N_("Unsort"), GTK_SIGNAL_FUNC(ethi_popup_unsort), 0),
+ E_POPUP_SEPARATOR,
+ E_POPUP_ITEM (N_("Group By This Field"), GTK_SIGNAL_FUNC(ethi_popup_group_field), 16),
+ E_POPUP_ITEM (N_("Group By Box"), GTK_SIGNAL_FUNC(ethi_popup_group_box), 128),
+ E_POPUP_SEPARATOR,
+ E_POPUP_ITEM (N_("Remove This Column"), GTK_SIGNAL_FUNC(ethi_popup_remove_column), 8),
+ E_POPUP_ITEM (N_("Add a Column..."), GTK_SIGNAL_FUNC(ethi_popup_field_chooser), 0),
+ E_POPUP_SEPARATOR,
+ E_POPUP_ITEM (N_("Alignment"), GTK_SIGNAL_FUNC(ethi_popup_alignment), 128),
+ E_POPUP_ITEM (N_("Best Fit"), GTK_SIGNAL_FUNC(ethi_popup_best_fit), 2),
+ E_POPUP_ITEM (N_("Format Columns..."), GTK_SIGNAL_FUNC(ethi_popup_format_columns), 128),
+ E_POPUP_SEPARATOR,
+ E_POPUP_ITEM (N_("Customize Current View..."), GTK_SIGNAL_FUNC(ethi_popup_customize_view), 4),
+ E_POPUP_TERMINATOR
};
static void