[evolution] Cannot add folder to previously saved Search folder



commit dab7c5cd2cbb0dd2d05fae6d2a519955e87f0a27
Author: Milan Crha <mcrha redhat com>
Date:   Fri Aug 19 17:57:47 2011 +0200

    Cannot add folder to previously saved Search folder

 mail/mail-vfolder.c |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)
---
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index a24d9dc..2a7ed99 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -1248,6 +1248,25 @@ vfolder_edit (EShellView *shell_view)
 	gtk_widget_destroy (dialog);
 }
 
+static void
+vfolder_edit_response_cb (GtkWidget *dialog, gint response_id, gpointer user_data)
+{
+	if (response_id == GTK_RESPONSE_OK) {
+		EFilterRule *rule = g_object_get_data (G_OBJECT (dialog), "vfolder-rule");
+		EFilterRule *newrule = g_object_get_data (G_OBJECT (dialog), "vfolder-newrule");
+		const gchar *config_dir;
+		gchar *user;
+
+		e_filter_rule_copy (rule, newrule);
+		config_dir = mail_session_get_config_dir ();
+		user = g_build_filename (config_dir, "vfolders.xml", NULL);
+		e_rule_context_save ((ERuleContext *) context, user);
+		g_free (user);
+	}
+
+	gtk_widget_destroy (dialog);
+}
+
 void
 vfolder_edit_rule (EMailBackend *backend,
                    const gchar *folder_uri)
@@ -1305,21 +1324,12 @@ vfolder_edit_rule (EMailBackend *backend,
 	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
 	gtk_widget_show (widget);
 
-	if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
-		const gchar *config_dir;
-		gchar *user;
-
-		e_filter_rule_copy (rule, newrule);
-		config_dir = mail_session_get_config_dir ();
-		user = g_build_filename (config_dir, "vfolders.xml", NULL);
-		e_rule_context_save ((ERuleContext *) context, user);
-		g_free (user);
-	}
+	g_object_set_data_full (G_OBJECT (dialog), "vfolder-rule", rule, g_object_unref);
+	g_object_set_data_full (G_OBJECT (dialog), "vfolder-newrule", newrule, g_object_unref);
 
-	gtk_widget_destroy (dialog);
+	g_signal_connect (dialog, "response", G_CALLBACK (vfolder_edit_response_cb), NULL);
 
-	g_object_unref (rule);
-	g_object_unref (newrule);
+	gtk_widget_show (dialog);
 }
 
 static void



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