[evolution-patches] addressbook popup menu, last one




This is the remaining e-popup-menu removal in the addressbook.

I wonder if the popup menu there serves any useful purpose anyway?  Should the whole thing be removed?  There isn't one anywhere else on that window (its the one you get when you click on to/cc in the composer).

--
Michael Zucchi <notzed ximian com>
"born to die, live to work, it's all downhill from here"
Novell's Evolution and Free Software Developer
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1840
diff -u -p -r1.1840 ChangeLog
--- addressbook/ChangeLog	6 Oct 2004 03:22:21 -0000	1.1840
+++ addressbook/ChangeLog	6 Oct 2004 04:44:06 -0000
@@ -1,3 +1,20 @@
+2004-10-06  Not Zed  <NotZed Ximian com>
+
+	* gui/contact-editor/e-contact-editor.c: removed
+	gnome-popup-menu.h (unused).
+
+	* gui/widgets/e-addressbook-reflow-adapter.c: 
+	* gui/widgets/eab-popup-control.c: remove e-popup-menu.h (unused).
+
+	* gui/component/select-names/e-select-names.c
+	(section_right_click_cb): use e-popup.  Somewhat overengineered
+	for this use ...
+	(remove_cb): api changes.
+
+	* gui/widgets/eab-popup.c (eab_popup_target_new_select_names):
+	added pretty useless wrapper for the select names popup.  Added to
+	hook maps.
+
 2004-10-01  Not Zed  <NotZed Ximian com>
 
 	* gui/widgets/e-addressbook-view.c (do_popup_menu): convert to
Index: addressbook/gui/component/select-names/e-select-names.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/select-names/e-select-names.c,v
retrieving revision 1.134
diff -u -p -r1.134 e-select-names.c
--- addressbook/gui/component/select-names/e-select-names.c	19 Aug 2004 04:36:47 -0000	1.134
+++ addressbook/gui/component/select-names/e-select-names.c	6 Oct 2004 04:44:06 -0000
@@ -29,7 +29,6 @@
 
 #include <gal/e-table/e-table-simple.h>
 #include <gal/e-table/e-table-without.h>
-#include <gal/widgets/e-popup-menu.h>
 
 #include <libebook/e-book.h>
 #include <libebook/e-contact.h>
@@ -38,6 +37,7 @@
 #include <addressbook/util/eab-book-util.h>
 #include <addressbook/gui/component/addressbook-component.h>
 #include <addressbook/gui/component/addressbook.h>
+#include <addressbook/gui/widgets/eab-popup.h>
 
 #include "e-select-names-config.h"
 #include "e-select-names.h"
@@ -678,36 +678,45 @@ remove_address(ETable *table, int row, i
 	e_select_names_model_delete (child->source, row);
 }
 
-struct _RightClickData {
-	ESelectNamesChild *child;
-	int row;
-};
-typedef struct _RightClickData RightClickData;
-
 static void
-remove_cb (GtkWidget *widget, void *data)
+remove_cb (EPopup *ep, EPopupItem *pitem, void *data)
 {
-	RightClickData *rcdata = (RightClickData *)data;
+	EABPopupTargetSelectNames *t = (EABPopupTargetSelectNames *)ep->target;
 
-	e_select_names_model_delete (rcdata->child->source, rcdata->row);
+	e_select_names_model_delete (t->model, t->row);
+}
+
+static EPopupItem esn_select_popups[] = {
+	{ E_POPUP_ITEM, "20.delete", N_("Remove"), remove_cb, NULL, NULL, 0 },
+};
 
-	/* Free everything we've created */
-	g_free (rcdata);
+static void
+esn_select_popup_free (EPopup *ep, GSList *list, void *data)
+{
+	g_slist_free (list);
 }
 
 static void
 section_right_click_cb (ETable *et, int row, int col, GdkEvent *ev, ESelectNamesChild *child)
 {
-	static EPopupMenu right_click_menu[] = {
-		E_POPUP_ITEM (N_("Remove"), G_CALLBACK (remove_cb), 0),
-		E_POPUP_TERMINATOR
-	};
-	RightClickData *rcdata = g_new0 (RightClickData, 1);
+	EABPopup *ep;
+	EABPopupTargetSelectNames *t;
+	GSList *menus = NULL;
+	int i;
+	GtkMenu *menu;
+
+	ep = eab_popup_new("com.novell.evolution.addressbook.selectNames.popup");
+	t = eab_popup_target_new_select_names(ep, child->source, row);
+	t->target.widget = (GtkWidget *)et;
+
+	for (i=0;i<sizeof(esn_select_popups)/sizeof(esn_select_popups[0]);i++)
+		menus = g_slist_prepend(menus, &esn_select_popups[i]);
 
-	rcdata->row = row;
-	rcdata->child = child;
+	e_popup_add_items((EPopup *)ep, menus, esn_select_popup_free, NULL);
 
-	e_popup_menu_run (right_click_menu, (GdkEvent *)ev, 0, 0, rcdata);
+	/* visibility is disabled, we only disable menu items */
+	menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0, t->target.mask);
+	gtk_menu_popup(menu, NULL, NULL, NULL, NULL, ev->button.button, ev->button.time);
 }
 
 void
Index: addressbook/gui/contact-editor/e-contact-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/e-contact-editor.c,v
retrieving revision 1.218
diff -u -p -r1.218 e-contact-editor.c
--- addressbook/gui/contact-editor/e-contact-editor.c	13 Sep 2004 16:26:49 -0000	1.218
+++ addressbook/gui/contact-editor/e-contact-editor.c	6 Oct 2004 04:44:06 -0000
@@ -34,7 +34,6 @@
 #include <gtk/gtkstock.h>
 #include <gtk/gtkentry.h>
 #include <gtk/gtklabel.h>
-#include <libgnomeui/gnome-popup-menu.h>
 #include <libgnomeui/gnome-window-icon.h>
 #include <libgnome/gnome-util.h>
 #include <libgnome/gnome-i18n.h>
Index: addressbook/gui/widgets/e-addressbook-reflow-adapter.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-reflow-adapter.c,v
retrieving revision 1.30
diff -u -p -r1.30 e-addressbook-reflow-adapter.c
--- addressbook/gui/widgets/e-addressbook-reflow-adapter.c	21 Oct 2003 18:48:55 -0000	1.30
+++ addressbook/gui/widgets/e-addressbook-reflow-adapter.c	6 Oct 2004 04:44:07 -0000
@@ -12,7 +12,6 @@
 #include "eab-gui-util.h"
 
 #include "e-minicard.h"
-#include <gal/widgets/e-popup-menu.h>
 #include <gal/widgets/e-gui-utils.h>
 #include "addressbook/printing/e-contact-print.h"
 #include "addressbook/printing/e-contact-print-envelope.h"
Index: addressbook/gui/widgets/eab-popup-control.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-popup-control.c,v
retrieving revision 1.10
diff -u -p -r1.10 eab-popup-control.c
--- addressbook/gui/widgets/eab-popup-control.c	4 Aug 2004 15:23:13 -0000	1.10
+++ addressbook/gui/widgets/eab-popup-control.c	6 Oct 2004 04:44:07 -0000
@@ -48,7 +48,6 @@
 #include <bonobo/bonobo-control.h>
 #include <bonobo/bonobo-property-bag.h>
 #include <bonobo/bonobo-generic-factory.h>
-#include <gal/widgets/e-popup-menu.h>
 #include <addressbook/util/eab-book-util.h>
 #include <addressbook/gui/contact-editor/e-contact-editor.h>
 #include <addressbook/gui/contact-editor/e-contact-quick-add.h>
Index: addressbook/gui/widgets/eab-popup.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-popup.c,v
retrieving revision 1.1
diff -u -p -r1.1 eab-popup.c
--- addressbook/gui/widgets/eab-popup.c	6 Oct 2004 03:22:22 -0000	1.1
+++ addressbook/gui/widgets/eab-popup.c	6 Oct 2004 04:44:07 -0000
@@ -65,6 +65,11 @@ eabp_target_free(EPopup *ep, EPopupTarge
 
 		g_object_unref(s->selector);
 		break; }
+	case EAB_POPUP_TARGET_SELECT_NAMES: {
+		EABPopupTargetSelectNames *s = (EABPopupTargetSelectNames *)t;
+
+		g_object_unref(s->model);
+		break; }
 	}
 
 	((EPopupClass *)eabp_parent)->target_free(ep, t);
@@ -189,6 +194,18 @@ eab_popup_target_new_source(EABPopup *ea
 	return t;
 }
 
+EABPopupTargetSelectNames *
+eab_popup_target_new_select_names(EABPopup *eabp, struct _ESelectNamesModel *model, int row)
+{
+	EABPopupTargetSelectNames *t = e_popup_target_new(&eabp->popup, EAB_POPUP_TARGET_SELECT_NAMES, sizeof(*t));
+
+	t->model = model;
+	g_object_ref(model);
+	t->row = row;
+
+	return t;
+}
+
 /* ********************************************************************** */
 /* Popup menu plugin handler */
 
@@ -231,9 +248,14 @@ static const EPopupHookTargetMask eabph_
 	{ 0 }
 };
 
+static const EPopupHookTargetMask eabph_select_names_masks[] = {
+	{ 0 }
+};
+
 static const EPopupHookTargetMap eabph_targets[] = {
 	{ "select", EAB_POPUP_TARGET_SELECT, eabph_select_masks },
 	{ "source", EAB_POPUP_TARGET_SOURCE, eabph_source_masks },
+	{ "select-names", EAB_POPUP_TARGET_SELECT_NAMES, eabph_select_names_masks },
 	{ 0 }
 };
 
Index: addressbook/gui/widgets/eab-popup.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/eab-popup.h,v
retrieving revision 1.1
diff -u -p -r1.1 eab-popup.h
--- addressbook/gui/widgets/eab-popup.h	6 Oct 2004 03:22:22 -0000	1.1
+++ addressbook/gui/widgets/eab-popup.h	6 Oct 2004 04:44:07 -0000
@@ -45,6 +45,7 @@ typedef struct _EABPopupClass EABPopupCl
 enum _eab_popup_target_t {
 	EAB_POPUP_TARGET_SELECT,
 	EAB_POPUP_TARGET_SOURCE,
+	EAB_POPUP_TARGET_SELECT_NAMES,
 };
 
 /**
@@ -77,6 +78,7 @@ enum _eab_popup_target_source_t {
 
 typedef struct _EABPopupTargetSelect EABPopupTargetSelect;
 typedef struct _EABPopupTargetSource EABPopupTargetSource;
+typedef struct _EABPopupTargetSelectNames EABPopupTargetSelectNames;
 
 /**
  * struct _EABPopupTargetSelect - A list of address cards.
@@ -109,6 +111,23 @@ struct _EABPopupTargetSource {
 	struct _ESourceSelector *selector;
 };
 
+/**
+ * struct _EABPopupTargetSelectNames - A select names target.
+ * 
+ * @target: Superclass.
+ * @model: Select names model.
+ * @row: Row of item selected.
+ *
+ * This target is used to represent an item selected in an
+ * ESelectNames model.
+ **/
+struct _EABPopupTargetSelectNames {
+	EPopupTarget target;
+
+	struct _ESelectNamesModel *model;
+	int row;
+};
+
 typedef struct _EPopupItem EABPopupItem;
 
 /* The object */
@@ -128,6 +147,7 @@ EABPopup *eab_popup_new(const char *menu
 
 EABPopupTargetSelect *eab_popup_target_new_select(EABPopup *eabp, struct _EBook *book, int readonly, GPtrArray *cards);
 EABPopupTargetSource *eab_popup_target_new_source(EABPopup *eabp, struct _ESourceSelector *selector);
+EABPopupTargetSelectNames *eab_popup_target_new_select_names(EABPopup *eabp, struct _ESelectNamesModel *model, int row);
 
 /* ********************************************************************** */
 


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