[evolution] Move EPopupMenu to /widgets/table.



commit 03320071af0ec6c676df56508bfca2ec03794070
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Jun 1 09:07:50 2011 -0400

    Move EPopupMenu to /widgets/table.
    
    ETableHeaderItem is the last user of EPopupMenu.  Move it to
    /widgets/table to discourage further use and strip out unused features.
    
    The functionality it provides has long since been superseded by
    GtkUIManager and GtkAction.

 calendar/gui/e-cal-list-view.c         |    1 -
 calendar/gui/e-day-view.c              |    1 -
 widgets/misc/Makefile.am               |    2 -
 widgets/table/Makefile.am              |    2 +
 widgets/{misc => table}/e-popup-menu.c |   54 +++++---------------------------
 widgets/{misc => table}/e-popup-menu.h |   23 ++------------
 widgets/table/e-table-header-item.c    |    2 +-
 7 files changed, 14 insertions(+), 71 deletions(-)
---
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c
index b81a441..7893dae 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -40,7 +40,6 @@
 #include <table/e-cell-text.h>
 #include <table/e-cell-combo.h>
 #include <table/e-cell-date.h>
-#include <misc/e-popup-menu.h>
 #include <table/e-cell-date-edit.h>
 #include <e-util/e-categories-config.h>
 #include <e-util/e-dialog-utils.h>
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index a9d4302..1591bc6 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -34,7 +34,6 @@
 #include <gdk/gdkkeysyms.h>
 #include <text/e-text.h>
 #include <misc/e-canvas-utils.h>
-#include <misc/e-popup-menu.h>
 #include <e-util/e-unicode.h>
 #include <libgnomecanvas/libgnomecanvas.h>
 #include <glib/gi18n.h>
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
index 4076249..05a5967 100644
--- a/widgets/misc/Makefile.am
+++ b/widgets/misc/Makefile.am
@@ -46,7 +46,6 @@ widgetsinclude_HEADERS =			\
 	e-paned.h				\
 	e-picture-gallery.h			\
 	e-popup-action.h			\
-	e-popup-menu.h				\
 	e-port-entry.h				\
 	e-preferences-window.h			\
 	e-preview-pane.h			\
@@ -126,7 +125,6 @@ libemiscwidgets_la_SOURCES =			\
 	e-paned.c				\
 	e-picture-gallery.c			\
 	e-popup-action.c			\
-	e-popup-menu.c				\
 	e-port-entry.c				\
 	e-preferences-window.c			\
 	e-preview-pane.c			\
diff --git a/widgets/table/Makefile.am b/widgets/table/Makefile.am
index 2764c96..0ae1e2b 100644
--- a/widgets/table/Makefile.am
+++ b/widgets/table/Makefile.am
@@ -29,6 +29,7 @@ libetable_la_SOURCES = 				\
 	e-cell-tree.c				\
 	e-cell-vbox.c				\
 	e-cell-hbox.c				\
+	e-popup-menu.c				\
 	e-table-click-to-add.c			\
 	e-table-col.c				\
 	e-table-column-specification.c		\
@@ -104,6 +105,7 @@ libetableinclude_HEADERS = 			\
 	e-cell-tree.h				\
 	e-cell-vbox.h				\
 	e-cell-hbox.h				\
+	e-popup-menu.h				\
 	e-table-click-to-add.h			\
 	e-table-col-dnd.h			\
 	e-table-col.h				\
diff --git a/widgets/misc/e-popup-menu.c b/widgets/table/e-popup-menu.c
similarity index 61%
rename from widgets/misc/e-popup-menu.c
rename to widgets/table/e-popup-menu.c
index d166ac0..07589b1 100644
--- a/widgets/misc/e-popup-menu.c
+++ b/widgets/table/e-popup-menu.c
@@ -38,7 +38,7 @@
  * Creates an item with an optional icon
  */
 static void
-make_item (GtkMenu *menu, GtkMenuItem *item, const gchar *name, GtkWidget *pixmap)
+make_item (GtkMenu *menu, GtkMenuItem *item, const gchar *name)
 {
 	GtkWidget *label;
 
@@ -53,24 +53,6 @@ make_item (GtkMenu *menu, GtkMenuItem *item, const gchar *name, GtkWidget *pixma
 	gtk_widget_show (label);
 
 	gtk_container_add (GTK_CONTAINER (item), label);
-
-	if (pixmap && GTK_IS_IMAGE_MENU_ITEM (item)) {
-		gtk_widget_show (pixmap);
-		gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), pixmap);
-	}
-}
-
-GtkMenu *
-e_popup_menu_create (EPopupMenu *menu_list,
-		     guint32 disable_mask,
-		     guint32 hide_mask,
-		     gpointer default_closure)
-{
-	return e_popup_menu_create_with_domain (menu_list,
-						disable_mask,
-						hide_mask,
-						default_closure,
-						NULL);
 }
 
 GtkMenu *
@@ -81,7 +63,6 @@ e_popup_menu_create_with_domain (EPopupMenu *menu_list,
 				 const gchar *domain)
 {
 	GtkMenu *menu = GTK_MENU (gtk_menu_new ());
-	GSList *group = NULL;
 	gboolean last_item_separator = TRUE;
 	gint last_non_separator = -1;
 	gint i;
@@ -101,38 +82,19 @@ e_popup_menu_create_with_domain (EPopupMenu *menu_list,
 			GtkWidget *item = NULL;
 
 			if (!separator) {
-				if (menu_list[i].is_toggle)
-					item = gtk_check_menu_item_new ();
-				else if (menu_list[i].is_radio)
-					item = gtk_radio_menu_item_new (group);
-				else
-					item = menu_list[i].pixmap_widget ? gtk_image_menu_item_new () : gtk_menu_item_new ();
-				if (menu_list[i].is_toggle || menu_list[i].is_radio)
-					gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), menu_list[i].is_active);
-				if (menu_list[i].is_radio)
-					group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item));
-
-				make_item (menu, GTK_MENU_ITEM (item), dgettext (domain, menu_list[i].name), menu_list[i].pixmap_widget);
+				item = gtk_menu_item_new ();
+
+				make_item (menu, GTK_MENU_ITEM (item), dgettext (domain, menu_list[i].name));
 			} else {
 				item = gtk_menu_item_new ();
 			}
 
 			gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
 
-			if (!menu_list[i].submenu) {
-				if (menu_list[i].fn)
-					g_signal_connect (item, "activate",
-							  G_CALLBACK (menu_list[i].fn),
-							  menu_list[i].use_custom_closure ? menu_list[i].closure : default_closure);
-			} else {
-				/* submenu */
-				GtkMenu *submenu;
-
-				submenu = e_popup_menu_create (menu_list[i].submenu, disable_mask, hide_mask,
-							       default_closure);
-
-				gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), GTK_WIDGET (submenu));
-			}
+			if (menu_list[i].fn)
+				g_signal_connect (item, "activate",
+						  G_CALLBACK (menu_list[i].fn),
+						  default_closure);
 
 			if (menu_list[i].disable_mask & disable_mask)
 				gtk_widget_set_sensitive (item, FALSE);
diff --git a/widgets/misc/e-popup-menu.h b/widgets/table/e-popup-menu.h
similarity index 71%
rename from widgets/misc/e-popup-menu.h
rename to widgets/table/e-popup-menu.h
index 24a8fa6..9fd3616 100644
--- a/widgets/misc/e-popup-menu.h
+++ b/widgets/table/e-popup-menu.h
@@ -29,12 +29,11 @@
 
 G_BEGIN_DECLS
 
-#define E_POPUP_SEPARATOR  { (gchar *) "", NULL, (NULL), NULL, 0 }
-#define E_POPUP_TERMINATOR { NULL, NULL, (NULL), NULL, 0 }
+#define E_POPUP_SEPARATOR  { (gchar *) "", NULL, (NULL), 0 }
+#define E_POPUP_TERMINATOR { NULL, NULL, (NULL), 0 }
 
 #define E_POPUP_ITEM(name,fn,disable_mask) \
-	{ (gchar *) (name), NULL, (fn), NULL, \
-	  (disable_mask), NULL, NULL, 0, 0, 0, 0 }
+	{ (gchar *) (name), NULL, (fn), (disable_mask) }
 
 typedef struct _EPopupMenu EPopupMenu;
 
@@ -42,25 +41,9 @@ struct _EPopupMenu {
 	gchar *name;
 	gchar *pixname;
 	GCallback fn;
-
-	EPopupMenu *submenu;
 	guint32 disable_mask;
-
-	/* Added post 0.19 */
-	GtkWidget *pixmap_widget;
-	gpointer 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,
-						 gpointer default_closure);
 GtkMenu *	e_popup_menu_create_with_domain	(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 9215e7b..d8a7d0d 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -36,8 +36,8 @@
 #include "e-util/e-util.h"
 #include "e-util/e-xml-utils.h"
 #include "misc/e-canvas.h"
-#include "misc/e-popup-menu.h"
 
+#include "e-popup-menu.h"
 #include "e-table.h"
 #include "e-table-col-dnd.h"
 #include "e-table-config.h"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]