evolution r36431 - in trunk/addressbook: . gui/component



Author: mcrha
Date: Tue Sep 23 11:02:55 2008
New Revision: 36431
URL: http://svn.gnome.org/viewvc/evolution?rev=36431&view=rev

Log:
2008-09-23  Milan Crha  <mcrha redhat com>

	** Part of fix for bug #272391

	* gui/component/apps_evolution_addressbook.schemas.in:
	* gui/component/autocompletion-config.c: (struct AutocompletionConfig),
	(config_control_destroy_notify), (add_section),
	(show_address_check_toggled_cb), (autocompletion_config_control_new):
	New UI for Edit->Preferences->Autocompletion, with the checkbox for
	the key "/apps/evolution/addressbook/completion/show_address" to be
	able to setup whether show mail address for the autocompleted contact.



Modified:
   trunk/addressbook/ChangeLog
   trunk/addressbook/gui/component/apps_evolution_addressbook.schemas.in
   trunk/addressbook/gui/component/autocompletion-config.c

Modified: trunk/addressbook/gui/component/apps_evolution_addressbook.schemas.in
==============================================================================
--- trunk/addressbook/gui/component/apps_evolution_addressbook.schemas.in	(original)
+++ trunk/addressbook/gui/component/apps_evolution_addressbook.schemas.in	Tue Sep 23 11:02:55 2008
@@ -27,6 +27,18 @@
       </locale>
     </schema>
 
+    <schema>
+      <key>/schemas/apps/evolution/addressbook/completion/show_address</key>
+      <applyto>/apps/evolution/addressbook/completion/show_address</applyto>
+      <owner>evolution-addressbook</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Show autocompleted name with an address</short>
+        <long>Whether force showing the mail address with the name of the autocompleted contact in the entry.</long>
+      </locale>
+    </schema>
+
     <!-- Select names last used uri -->
 
     <schema>

Modified: trunk/addressbook/gui/component/autocompletion-config.c
==============================================================================
--- trunk/addressbook/gui/component/autocompletion-config.c	(original)
+++ trunk/addressbook/gui/component/autocompletion-config.c	Tue Sep 23 11:02:55 2008
@@ -35,6 +35,7 @@
 
 #include <libedataserver/e-source-list.h>
 #include <libedataserverui/e-source-selector.h>
+#include <libedataserverui/e-name-selector-entry.h>
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 
@@ -45,6 +46,7 @@
 	GtkWidget *control_widget;
 
 	ESourceList *source_list;
+	GConfClient *gconf;
 } AutocompletionConfig;
 
 static void
@@ -84,6 +86,7 @@
 	AutocompletionConfig *ac = (AutocompletionConfig *) data;
 
 	g_object_unref (ac->source_list);
+	g_object_unref (ac->gconf);
 
 	g_free (ac);
 }
@@ -106,17 +109,76 @@
 	}
 }
 
+static GtkWidget *
+add_section (GtkWidget *vbox, const gchar *caption, gboolean expand)
+{
+	GtkWidget *label, *hbox, *itembox;
+	gchar *txt;
+
+	g_return_val_if_fail (vbox != NULL, NULL);
+	g_return_val_if_fail (caption != NULL, NULL);
+
+	txt = g_strconcat ("<b>", caption, "</b>", NULL);
+
+	label = gtk_label_new (NULL);
+	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+	gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+	gtk_label_set_markup (GTK_LABEL (label), txt);
+
+	g_free (txt);
+
+	/* bold caption of the section */
+	gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+
+	hbox = gtk_hbox_new (FALSE, 12);
+
+	/* space on the left for the items in the section */
+	gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (""), FALSE, FALSE, 0);
+
+	/* itembox, here will all section items go */
+	itembox = gtk_vbox_new (FALSE, 2);
+	gtk_box_pack_start (GTK_BOX (hbox), itembox, TRUE, TRUE, 0);
+
+	gtk_box_pack_start (GTK_BOX (vbox), hbox, expand, expand, 0);
+
+	return itembox;
+}
+
+static void
+show_address_check_toggled_cb (GtkToggleButton *check, AutocompletionConfig *ac)
+{
+	g_return_if_fail (check != NULL);
+	g_return_if_fail (ac != NULL);
+	g_return_if_fail (ac->gconf != NULL);
+
+	gconf_client_set_bool (ac->gconf, FORCE_SHOW_ADDRESS, gtk_toggle_button_get_active (check), NULL);
+}
+
 EvolutionConfigControl*
 autocompletion_config_control_new (void)
 {
 	AutocompletionConfig *ac;
 	CORBA_Environment ev;
-	GtkWidget *scrolledwin;
+	GtkWidget *scrolledwin, *vbox, *itembox, *w;
 
 	ac = g_new0 (AutocompletionConfig, 1);
 
 	CORBA_exception_init (&ev);
 
+	ac->gconf = gconf_client_get_default ();
+
+	vbox = gtk_vbox_new (FALSE, 6);
+	gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
+
+	itembox = add_section (vbox, _("Autocompletion"), FALSE);
+
+	w = gtk_check_button_new_with_mnemonic (_("Always _show address of the autocompleted contact"));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), gconf_client_get_bool (ac->gconf, FORCE_SHOW_ADDRESS, NULL));
+	g_signal_connect (w, "toggled", (GCallback)show_address_check_toggled_cb, ac);
+	gtk_box_pack_start (GTK_BOX (itembox), w, FALSE, FALSE, 0);
+
+	itembox = add_section (vbox, _("Look up in address books"), TRUE);
+
 	ac->source_list =  e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources");
 	/* XXX should we watch for the source list to change and
 	   update it in the control?  what about our local changes? */
@@ -139,7 +201,10 @@
 	gtk_widget_show (ac->control_widget);
 	gtk_widget_show (scrolledwin);
 
-	ac->config_control = evolution_config_control_new (scrolledwin);
+	gtk_widget_show_all (vbox);
+	gtk_box_pack_start (GTK_BOX (itembox), scrolledwin, TRUE, TRUE, 0);
+
+	ac->config_control = evolution_config_control_new (vbox);
 
 	g_signal_connect (ac->control_widget, "selection_changed",
 			  G_CALLBACK (source_selection_changed), ac);



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