Re: [evolution-patches] [Addressbook] Fix for #333858



Sorry, forget the patch. Attach it.

-Simon 

On Wed, 2006-03-08 at 15:41 +0800, simon.zheng wrote:
> Hi,
> 
> Bug 333858 â?? Multiple categories dialog are popped up in the same
> contact editor.
> http://bugzilla.gnome.org/show_bug.cgi?id=333858
> 
> Sending patch for review.
> 
> Thanks,
> -Simon
> 
> _______________________________________________
> Evolution-patches mailing list
> Evolution-patches gnome org
> http://mail.gnome.org/mailman/listinfo/evolution-patches
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.2062
diff -u -p -r1.2062 ChangeLog
--- ChangeLog	6 Mar 2006 10:59:03 -0000	1.2062
+++ ChangeLog	8 Mar 2006 06:57:24 -0000
@@ -1,3 +1,11 @@
+2006-03-08  Simon Zheng  <simon zheng sun com>
+
+	Fix for Bug #333858 
+	* gui/contact-editor/e-contact-editor.c (response):
+	(editor_delete_event_cb):
+	(categories_clicked):
+	Avoid popping up multiple copies of the categories dialog. 
+
 2006-03-06  Devashish Sharma <sdevashish novell com>
 
 	* gui/contact-editor/e-contact-editor.c (fill_in_address_textview):
Index: gui/contact-editor/e-contact-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/contact-editor/e-contact-editor.c,v
retrieving revision 1.256
diff -u -p -r1.256 e-contact-editor.c
--- gui/contact-editor/e-contact-editor.c	6 Mar 2006 10:59:02 -0000	1.256
+++ gui/contact-editor/e-contact-editor.c	8 Mar 2006 06:57:24 -0000
@@ -2609,8 +2609,10 @@ full_name_clicked (GtkWidget *button, EC
 	gtk_widget_destroy (GTK_WIDGET (dialog));
 }
 
+static GtkWidget *categories_dialog = NULL;
+
 static void
-response (GtkDialog *dialog, int response, EContactEditor *editor)
+categories_response (GtkDialog *dialog, int response, EContactEditor *editor)
 {
 	const char *categories;
 	GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories");
@@ -2622,7 +2624,8 @@ response (GtkDialog *dialog, int respons
 		else
 			e_contact_set (editor->contact, E_CONTACT_CATEGORIES, (char *)categories);
 	}
-	gtk_widget_hide(GTK_WIDGET(dialog));
+	gtk_widget_destroy(GTK_WIDGET(dialog));
+	categories_dialog = NULL;
 }
 
 static gboolean
@@ -2636,11 +2639,13 @@ categories_key_press_event( GtkWidget *w
 }
 
 static gint
-editor_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
+categories_editor_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
 {
 	if (widget)
-		if (GTK_IS_WIDGET (widget))
+		if (GTK_IS_WIDGET (widget)){
 			gtk_widget_destroy(widget);
+			categories_dialog = NULL;
+		}
 	return TRUE;
 }
 
@@ -2648,30 +2653,34 @@ static void
 categories_clicked (GtkWidget *button, EContactEditor *editor)
 {
 	char *categories = NULL;
-	GtkDialog *dialog;
 	GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories");
 
+	if (categories_dialog){
+		gtk_widget_show(categories_dialog);
+		return;
+	}
+
 	if (entry && GTK_IS_ENTRY(entry))
 		categories = g_strdup (gtk_entry_get_text(GTK_ENTRY(entry)));
 	else if (editor->contact)
 		categories = e_contact_get (editor->contact, E_CONTACT_CATEGORIES);
 
-	if (!(dialog = GTK_DIALOG (e_categories_dialog_new (categories)))) {
+	if (!(categories_dialog = GTK_WIDGET(e_categories_dialog_new (categories)))) {
 		e_error_run (NULL, "addressbook:edit-categories", NULL);
 		g_free (categories);
 		return;
 	}
 	
-	g_signal_connect (GTK_WIDGET (dialog), "key-press-event", G_CALLBACK (categories_key_press_event), editor);
+	g_signal_connect (categories_dialog, "key-press-event", G_CALLBACK (categories_key_press_event), editor);
 
-	g_signal_connect(dialog, "response",
-			G_CALLBACK (response), editor);
+	g_signal_connect(categories_dialog, "response",
+			G_CALLBACK (categories_response), editor);
 	
 	/* Close the category dialog if the editor is closed*/
 	g_signal_connect_swapped (EAB_EDITOR (editor), "editor_closed",
-			    G_CALLBACK (editor_delete_event_cb), GTK_WIDGET (dialog));
+			    G_CALLBACK (categories_editor_delete_event_cb), categories_dialog);
 	
-	gtk_widget_show(GTK_WIDGET(dialog));
+	gtk_widget_show(categories_dialog);
 	g_free (categories);
 }
 


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