[evolution-couchdb] Fixed removal of CouchDB addressbook options when switching to another addressbook backend and some



commit e09fbdbc272f2e694c12ec5df09c281f51ca065d
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Mon Oct 26 16:51:19 2009 +0100

    Fixed removal of CouchDB addressbook options when switching to another addressbook backend and some UI tweaks

 plugins/couchdb-contacts-source.c |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/plugins/couchdb-contacts-source.c b/plugins/couchdb-contacts-source.c
index e757c17..a67b4fe 100644
--- a/plugins/couchdb-contacts-source.c
+++ b/plugins/couchdb-contacts-source.c
@@ -152,11 +152,10 @@ destroy_ui_data (gpointer data)
 {
 	UIData *ui = data;
 
-	if (ui) {
+	if (ui && ui->vbox)
 		gtk_widget_destroy (ui->vbox);
-		g_object_unref (ui->source);
-		g_free (ui);
-	}
+
+	g_free (ui);
 }
 
 static void
@@ -205,8 +204,8 @@ plugin_couchdb_contacts (EPlugin *epl, EConfigHookItemFactoryData *data)
 	ESource *source;
         ESourceGroup *group;
 	const gchar *base_uri;
-	GtkWidget *parent, *parent_vbox;
-	GtkWidget *table, *label;
+	GtkWidget *parent;
+	GtkWidget *table, *label, *parent_vbox;
 	UIData *ui;
 	const gchar *property;
 	EABConfigTargetSource *t = (EABConfigTargetSource *) data->target;
@@ -216,14 +215,14 @@ plugin_couchdb_contacts (EPlugin *epl, EConfigHookItemFactoryData *data)
 
         base_uri = e_source_group_peek_base_uri (group);
 
-        g_object_set_data (G_OBJECT (epl), "wwidget", NULL);
+        g_object_set_data (G_OBJECT (epl), "cwidget", NULL);
 
-	if (strcmp(base_uri, COUCHDB_BASE_URI) != 0)
+	if (strcmp (base_uri, COUCHDB_BASE_URI) != 0)
                 return NULL;
 
 	/* Build up the UI */
 	ui = g_new0 (UIData, 1);
-	ui->source = g_object_ref (source);
+	ui->source = t->source;
 
 	parent = data->parent;
 	parent_vbox = gtk_widget_get_ancestor (gtk_widget_get_parent (parent), GTK_TYPE_VBOX);
@@ -236,26 +235,29 @@ plugin_couchdb_contacts (EPlugin *epl, EConfigHookItemFactoryData *data)
 	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
 	gtk_box_pack_start (GTK_BOX (ui->vbox), label, FALSE, FALSE, 0);
 
-	table = gtk_table_new (3, 2, FALSE);
+	table = gtk_table_new (3, 3, FALSE);
 	gtk_box_pack_start (GTK_BOX (ui->vbox), table, TRUE, TRUE, 0);
 
+	label = gtk_label_new ("   ");
+	gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+
 	ui->user_db_button = gtk_radio_button_new_with_label (NULL, _("Desktop CouchDB"));
-	gtk_table_attach (GTK_TABLE (table), ui->user_db_button, 0, 2, 0, 1,
+	gtk_table_attach (GTK_TABLE (table), ui->user_db_button, 1, 3, 0, 1,
 			  GTK_EXPAND | GTK_FILL, GTK_FILL, 3, 3);
 
 	ui->system_db_button = gtk_radio_button_new_with_label (
 		gtk_radio_button_get_group (GTK_RADIO_BUTTON (ui->user_db_button)),
 		_("System-wide CouchDB"));
-	gtk_table_attach (GTK_TABLE (table), ui->system_db_button, 0, 2, 1, 2,
+	gtk_table_attach (GTK_TABLE (table), ui->system_db_button, 1, 3, 1, 2,
 			  GTK_EXPAND | GTK_FILL, GTK_FILL, 3, 3);
 
 	ui->remote_db_button = gtk_radio_button_new_with_label (
 		gtk_radio_button_get_group (GTK_RADIO_BUTTON (ui->user_db_button)),
 		_("Remote CouchDB server"));
-	gtk_table_attach (GTK_TABLE (table), ui->remote_db_button, 0, 1, 2, 3,
+	gtk_table_attach (GTK_TABLE (table), ui->remote_db_button, 1, 2, 2, 3,
 			  GTK_EXPAND | GTK_FILL, GTK_FILL, 3, 3);
 	ui->remote_db_entry = gtk_entry_new ();
-	gtk_table_attach (GTK_TABLE (table), ui->remote_db_entry, 1, 2, 2, 3,
+	gtk_table_attach (GTK_TABLE (table), ui->remote_db_entry, 2, 3, 2, 3,
 			  GTK_EXPAND | GTK_FILL, GTK_FILL, 3, 3);
 
 	gtk_widget_show_all (ui->vbox);
@@ -277,7 +279,7 @@ plugin_couchdb_contacts (EPlugin *epl, EConfigHookItemFactoryData *data)
 		gtk_widget_set_sensitive (ui->remote_db_entry, FALSE);
 	}
 
-	g_object_set_data_full (G_OBJECT (epl), "gwidget", ui, destroy_ui_data);
+	g_object_set_data_full (G_OBJECT (epl), "cwidget", ui, destroy_ui_data);
 	g_signal_connect (ui->vbox, "destroy", G_CALLBACK (gtk_widget_destroyed), &ui->vbox);
 
 	/* Signals */



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