[evolution-patches] (Addressbook UI) Fix for http://bugzilla.gnome.org/show_bug.cgi?id=238979



Hi,

I have added a menu entry "E_xpand %LISTNAME% Inline" for r-click on
lists, that expand the emails inline.

Please review it.

Thanks
Srini.
Index: e-name-selector-entry.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-name-selector-entry.c,v
retrieving revision 1.26
diff -u -p -r1.26 e-name-selector-entry.c
--- e-name-selector-entry.c	30 Sep 2005 08:23:06 -0000	1.26
+++ e-name-selector-entry.c	20 Dec 2005 03:54:15 -0000
@@ -1662,6 +1662,7 @@ prepare_popup_destination (ENameSelector
 
 	index = gtk_entry_layout_index_to_text_index (GTK_ENTRY (name_selector_entry), index);
 	destination = find_destination_at_position (name_selector_entry, index);
+	g_object_set_data (name_selector_entry, "index", index);
 
 	if (!destination || !e_destination_get_contact (destination))
 		return FALSE;
@@ -1699,6 +1700,33 @@ editor_closed_cb (GtkObject *editor, gpo
 }
 
 static void
+popup_activate_inline_expand (ENameSelectorEntry *name_selector_entry, GtkWidget *menu_item)
+{
+	char *email_list, *text;
+	EDestination *destination = name_selector_entry->popup_destination;
+	int position, start, end;
+
+ 	position = g_object_get_data (name_selector_entry, "index");
+	
+	email_list = e_destination_get_address(destination);
+ 	text = gtk_entry_get_text (GTK_ENTRY (name_selector_entry));	
+ 	get_range_at_position (text, position, &start, &end);
+
+	g_signal_handlers_block_by_func (name_selector_entry, user_delete_text, name_selector_entry);
+
+	gtk_editable_delete_text (GTK_EDITABLE (name_selector_entry), start, end);
+
+	text = sanitize_string (e_destination_get_textrep (destination, FALSE));
+	gtk_editable_insert_text (GTK_EDITABLE (name_selector_entry), email_list, -1, &start);
+
+	g_signal_handlers_unblock_by_func (name_selector_entry, user_delete_text, name_selector_entry);
+
+	clear_completion_model (name_selector_entry);
+	generate_attribute_list (name_selector_entry);
+
+}
+
+static void
 popup_activate_contact (ENameSelectorEntry *name_selector_entry, GtkWidget *menu_item)
 {
 	EBook        *book;
@@ -1781,6 +1809,7 @@ populate_popup (ENameSelectorEntry *name
 	GList        *l;
 	gint          i;
 	char 	     *edit_label;
+	gboolean      is_list;
 
 	destination = name_selector_entry->popup_destination;
 	if (!destination)
@@ -1820,6 +1849,26 @@ populate_popup (ENameSelectorEntry *name
 	/* Separator */
 
 	if (email_list) {
+		menu_item = gtk_separator_menu_item_new ();
+		gtk_widget_show (menu_item);
+		gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
+	}
+
+	/* Expand a list inline */
+
+	is_list = e_contact_get (contact, E_CONTACT_IS_LIST) ? TRUE : FALSE;
+
+	if (is_list) {
+		/* To Translators: This would be similiar to "Translate MyList Inline" where MyList is a Contact List*/
+		edit_label = g_strdup_printf (_("E_xpand %s Inline"), (char *)e_contact_get_const (contact, E_CONTACT_FILE_AS)); 
+		menu_item = gtk_menu_item_new_with_mnemonic (edit_label);
+		g_free (edit_label);
+		gtk_widget_show (menu_item);
+		gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
+		g_signal_connect_swapped (menu_item, "activate", G_CALLBACK (popup_activate_inline_expand),
+					  name_selector_entry);
+
+		/* Separator */
 		menu_item = gtk_separator_menu_item_new ();
 		gtk_widget_show (menu_item);
 		gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);


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