[evolution-patches] new patch for bug 49912(based on 1.4.5)



hi, Chris

I give a new patch for bug 49912, it can:
1) set a flag in EText to trace status popup menu.
2) connect two signals to Etext, and sent by popup menu(when it activate and  deactivate).
3) skip FOCUS CHANGE event in e-minicard-label and e-minicard if there is an activiated popup menu.

pls, review it and give your suggestions

thx

leon
Index: evolution/addressbook/ChangeLog
===================================================================
RCS file: /export/src/cvs/evolution/addressbook/ChangeLog,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ChangeLog
--- evolution/addressbook/ChangeLog	2003/09/26 06:34:28	1.1.1.1
+++ evolution/addressbook/ChangeLog	2003/10/27 12:03:14
@@ -1,3 +1,16 @@
+2003-10-28 Leon Zhang <leon zhang sun com>
+
+	* gui/widgets/e-minicard.c:
+	(e_minicard_event): skip focus change event if there is an 
+	activated popup menu.
+	(add_field): support signal "populate_popup".
+	(popup_activated): callback of signal "populate_popup", set flag
+	for popup menu.
+
+	* gui/widgets/e-minicard-label.c:
+	(e_minicard_label_event): skip focus change event if there is an
+	activated popup menu.
+
 2003-09-05  Dan Winship  <danw ximian com>
 
 	* gui/component/select-names/Makefile.am: Make libeselectnames.la
Index: evolution/addressbook/gui/widgets/e-minicard.c
===================================================================
RCS file: /export/src/cvs/evolution/addressbook/gui/widgets/e-minicard.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 e-minicard.c
--- evolution/addressbook/gui/widgets/e-minicard.c	2003/09/26 06:34:28	1.1.1.1
+++ evolution/addressbook/gui/widgets/e-minicard.c	2003/10/27 12:03:14
@@ -552,6 +552,24 @@
 	switch( event->type ) {
 	case GDK_FOCUS_CHANGE:
 		{
+			/* if there is an activated popup menu, skip current event */
+			GList *list;
+			gboolean popup = FALSE;
+                        for (list = e_minicard->fields; list; list = list->next) {
+				EMinicardField *field = E_MINICARD_FIELD(list->data);
+				EMinicardLabel *e_minicard_label = E_MINICARD_LABEL(GTK_OBJECT(field->label));
+				if (e_minicard_label->has_focus){
+					EText *t = E_TEXT(e_minicard_label->field);
+					if (t->has_popup) {
+						popup = TRUE;
+						break;
+					}
+				}
+			}
+
+			if (popup)
+				break;
+
 			GdkEventFocus *focus_event = (GdkEventFocus *) event;
 			d(g_print("%s: GDK_FOCUS_CHANGE: %s\n", G_GNUC_FUNCTION, focus_event->in?"in":"out"));
 			if (focus_event->in) {
@@ -802,6 +820,12 @@
 }
 
 static void
+popup_activated (EText *text, EMinicard *e_minicard)
+{
+        text->has_popup = TRUE;
+}
+
+static void
 add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width)
 {
 	GnomeCanvasItem *new_item;
@@ -840,6 +864,9 @@
 			 "changed", G_CALLBACK (field_changed), e_minicard);
 	g_signal_connect(E_MINICARD_LABEL(new_item)->field,
 			 "activate", G_CALLBACK (field_activated), e_minicard);
+	g_signal_connect(E_MINICARD_LABEL(new_item)->field,
+			 "populate_popup", G_CALLBACK (popup_activated), e_minicard);
+
 	g_object_set(E_MINICARD_LABEL(new_item)->field,
 		     "allow_newlines", e_card_simple_get_allow_newlines (e_minicard->simple, field),
 		     NULL);
Index: evolution/addressbook/gui/widgets/e-minicard-label.c
===================================================================
RCS file: /export/src/cvs/evolution/addressbook/gui/widgets/e-minicard-label.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 e-minicard-label.c
--- evolution/addressbook/gui/widgets/e-minicard-label.c	2003/09/26 06:34:28	1.1.1.1
+++ evolution/addressbook/gui/widgets/e-minicard-label.c	2003/10/27 12:03:14
@@ -364,6 +364,10 @@
 		}
 		break;
 	case GDK_FOCUS_CHANGE: {
+		EText *text = E_TEXT (e_minicard_label->field);
+		if (text->has_popup)
+			break;
+
 		GdkEventFocus *focus_event = (GdkEventFocus *) event;
 
 		e_minicard_label->has_focus = focus_event->in;
Index: gal/ChangeLog
===================================================================
RCS file: /export/src/cvs/gal/ChangeLog,v
retrieving revision 1.3
diff -u -r1.3 ChangeLog
--- gal/ChangeLog	2003/09/28 08:42:27	1.3
+++ gal/ChangeLog	2003/10/27 12:03:14
@@ -1,3 +1,10 @@
+2003-10-28 Leon Zhang <leon zhang sun com>
+
+	* gal/e-text/e-text.h: add a flag for status of popup menu.
+	* gal/e-text/e-text.c:
+	(popup_targets_received): support signal "deactivate".
+	(e_text_popup_deactivated): callback of signal "deactivate"
+
 2003-09-28  Gilbert Fang  <gilbert fang sun com>
 
         * gal/a11y/Makefile.am: add e-table atk support to libgal a11y
Index: gal/gal/e-text/e-text.c
===================================================================
RCS file: /export/src/cvs/gal/gal/e-text/e-text.c,v
retrieving revision 1.2
diff -u -r1.2 e-text.c
--- gal/gal/e-text/e-text.c	2003/09/27 10:33:14	1.2
+++ gal/gal/e-text/e-text.c	2003/10/27 12:03:14
@@ -2557,6 +2557,12 @@
 }
 
 static void
+e_text_popup_deactivated (EText *text)
+{
+	text->has_popup = FALSE;
+}
+
+static void
 popup_targets_received (GtkClipboard     *clipboard,
 			GtkSelectionData *data,
 			gpointer          user_data)
@@ -2573,6 +2579,9 @@
 	gtk_menu_attach_to_widget (GTK_MENU (popup_menu),
 				   GTK_WIDGET(GNOME_CANVAS_ITEM (text)->canvas),
 				   popup_menu_detach);
+
+	g_signal_connect_swapped(GTK_MENU_SHELL (popup_menu), "deactivate", 
+				G_CALLBACK (e_text_popup_deactivated), text);
 
 	/* cut menu item */
 	menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_CUT, NULL);
Index: gal/gal/e-text/e-text.h
===================================================================
RCS file: /export/src/cvs/gal/gal/e-text/e-text.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 e-text.h
--- gal/gal/e-text/e-text.h	2003/09/26 06:37:14	1.1.1.1
+++ gal/gal/e-text/e-text.h	2003/10/27 12:03:14
@@ -214,6 +214,7 @@
 	gboolean      im_context_signals_registered;
 
 	gboolean      handle_popup;
+	gboolean      has_popup;
 };
 
 struct _ETextClass {


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