From 07a23dc4a63443eba04c3991e3cf8619981bdb22 Mon Sep 17 00:00:00 2001 From: Jason Leach Date: Tue, 5 Jun 2001 22:00:16 +0000 Subject: (Fix bug #655: SelectNames doesn't let you remove addresses after you add 2001-06-05 Jason Leach (Fix bug #655: SelectNames doesn't let you remove addresses after you add them) * gui/component/select-names/e-select-names.c (section_right_click_cb): New function, provides a popup menu with just "Remove" in it. (remove_cb): New callback to do the remove. (e_select_names_add_section): Attach the "right_click" signal to the section_right_click_cb above. svn path=/trunk/; revision=10123 --- addressbook/ChangeLog | 12 ++++++++ .../gui/component/select-names/e-select-names.c | 36 ++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 1ecae91348..167419884d 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,15 @@ +2001-06-05 Jason Leach + + (Fix bug #655: SelectNames doesn't let you remove addresses after + you add them) + + * gui/component/select-names/e-select-names.c + (section_right_click_cb): New function, provides a popup menu with + just "Remove" in it. + (remove_cb): New callback to do the remove. + (e_select_names_add_section): Attach the "right_click" signal to + the section_right_click_cb above. + 2001-06-05 Jon Trowbridge * gui/component/select-names/e-select-names-manager.c diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index 84ef76f9e0..94c613b274 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -496,6 +496,40 @@ remove_address(ETable *table, int row, int col, GdkEvent *event, ESelectNamesChi e_select_names_model_delete (child->source, row); } +#include +struct _RightClickData { + int row; + ESelectNamesChild *child; +}; +typedef struct _RightClickData RightClickData; + +static void +remove_cb (GtkWidget *widget, void *data) +{ + RightClickData *rcdata = (RightClickData *)data; + + remove_address (NULL, rcdata->row, 0, NULL, rcdata->child); + + g_free (rcdata); +} + +static void +section_right_click_cb (ETable *table, gint row, gint col, GdkEvent *event, ESelectNamesChild *child) +{ + EPopupMenu right_click_menu[] = { + { N_("Remove"), NULL, + GTK_SIGNAL_FUNC (remove_cb), NULL, 0 }, + { NULL, NULL, NULL, 0 } + }; + + RightClickData *rcdata = g_new0 (RightClickData, 1); + rcdata->row = row; + rcdata->child = child; + + e_popup_menu_run (right_click_menu, event, 0, 0, + rcdata); +} + void e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, ESelectNamesModel *source) { @@ -546,6 +580,8 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E model = e_select_names_table_model_new(source); etable = e_table_scrolled_new (model, NULL, SPEC2, NULL); + gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable))), "right_click", + GTK_SIGNAL_FUNC(section_right_click_cb), child); gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable))), "double_click", GTK_SIGNAL_FUNC(remove_address), child); -- cgit v1.2.3