aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Leach <jleach@ximian.com>2001-06-06 07:59:31 +0800
committerJacob Leach <jleach@src.gnome.org>2001-06-06 07:59:31 +0800
commit70c01c8bb7947db6b98ef637afd3f6d06d2c182c (patch)
tree42870d556b59ba5f9c669587e1fdc23ab2ceca2e
parentef02eff9c8aafbe1fd17a41e66af597496685998 (diff)
downloadgsoc2013-evolution-70c01c8bb7947db6b98ef637afd3f6d06d2c182c.tar
gsoc2013-evolution-70c01c8bb7947db6b98ef637afd3f6d06d2c182c.tar.gz
gsoc2013-evolution-70c01c8bb7947db6b98ef637afd3f6d06d2c182c.tar.bz2
gsoc2013-evolution-70c01c8bb7947db6b98ef637afd3f6d06d2c182c.tar.lz
gsoc2013-evolution-70c01c8bb7947db6b98ef637afd3f6d06d2c182c.tar.xz
gsoc2013-evolution-70c01c8bb7947db6b98ef637afd3f6d06d2c182c.tar.zst
gsoc2013-evolution-70c01c8bb7947db6b98ef637afd3f6d06d2c182c.zip
Make this work when multiple names are selected then right click->Remove.
2001-06-05 Jason Leach <jleach@ximian.com> * gui/component/select-names/e-select-names.c (remove_cb): Make this work when multiple names are selected then right click->Remove. svn path=/trunk/; revision=10127
-rw-r--r--addressbook/ChangeLog8
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c32
2 files changed, 36 insertions, 4 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 421f54547d..94c8ec7ed4 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,9 @@
+2001-06-05 Jason Leach <jleach@ximian.com>
+
+ * gui/component/select-names/e-select-names.c (remove_cb): Make
+ this work when multiple names are selected then right
+ click->Remove.
+
2001-06-05 Christopher James Lahey <clahey@ximian.com>
* backend/ebook/e-card.c (e_card_set_arg): Copy dates as they come
@@ -22,7 +28,7 @@
(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.
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index d73b0e732b..b803ddd627 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -498,17 +498,43 @@ remove_address(ETable *table, int row, int col, GdkEvent *event, ESelectNamesChi
}
struct _RightClickData {
- int row;
+ ETable *table;
ESelectNamesChild *child;
};
typedef struct _RightClickData RightClickData;
+static GSList *selected_rows = NULL;
+
+static void
+etable_selection_foreach_cb (int row, void *data)
+{
+ /* Build a list of rows in reverse order, then remove them,
+ necessary because otherwise it'll start trying to delete
+ rows out of index in ETableModel */
+ selected_rows = g_slist_prepend (selected_rows,
+ GINT_TO_POINTER (row));
+}
+
+static void
+selected_rows_foreach_cb (void *row, void *data)
+{
+ ESelectNamesChild *child = data;
+
+ e_select_names_model_delete (child->source, GPOINTER_TO_INT (row));
+}
+
static void
remove_cb (GtkWidget *widget, void *data)
{
RightClickData *rcdata = (RightClickData *)data;
- remove_address (NULL, rcdata->row, 0, NULL, rcdata->child);
+ e_table_selected_row_foreach (rcdata->table,
+ etable_selection_foreach_cb,
+ rcdata->child);
+
+ g_slist_foreach (selected_rows,
+ (GFunc)selected_rows_foreach_cb,
+ rcdata->child);
g_free (rcdata);
}
@@ -523,7 +549,7 @@ section_right_click_cb (ETable *table, gint row, gint col, GdkEvent *event, ESel
};
RightClickData *rcdata = g_new0 (RightClickData, 1);
- rcdata->row = row;
+ rcdata->table = table;
rcdata->child = child;
e_popup_menu_run (right_click_menu, event, 0, 0,