aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-reflow
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-05-08 13:22:28 +0800
committerChris Lahey <clahey@src.gnome.org>2000-05-08 13:22:28 +0800
commit918cfb0b28bb47ae0ffd3f921e7399aa75b61530 (patch)
tree0c1a0f41f39da6ac28f551f2d144c9f8b0a0b9e8 /widgets/e-reflow
parent2d5740212cec3db7df1c993b2446f7e3f11685d0 (diff)
downloadgsoc2013-evolution-918cfb0b28bb47ae0ffd3f921e7399aa75b61530.tar.gz
gsoc2013-evolution-918cfb0b28bb47ae0ffd3f921e7399aa75b61530.tar.zst
gsoc2013-evolution-918cfb0b28bb47ae0ffd3f921e7399aa75b61530.zip
Made a minimal number of things be destroyed and recreated when updating a
2000-05-08 Christopher James Lahey <clahey@helixcode.com> * gui/minicard/e-minicard-view.c, gui/minicard/e-minicard.c, gui/minicard/e-minicard.h, gui/minicard/e-reflow-sorted.c, gui/minicard/e-reflow-sorted.h: Made a minimal number of things be destroyed and recreated when updating a field. svn path=/trunk/; revision=2904
Diffstat (limited to 'widgets/e-reflow')
-rw-r--r--widgets/e-reflow/e-reflow-sorted.c61
-rw-r--r--widgets/e-reflow/e-reflow-sorted.h8
2 files changed, 57 insertions, 12 deletions
diff --git a/widgets/e-reflow/e-reflow-sorted.c b/widgets/e-reflow/e-reflow-sorted.c
index c70d7b2739..688cf87c98 100644
--- a/widgets/e-reflow/e-reflow-sorted.c
+++ b/widgets/e-reflow/e-reflow-sorted.c
@@ -136,8 +136,8 @@ e_reflow_sorted_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
}
}
-void
-e_reflow_sorted_remove_item(EReflowSorted *e_reflow_sorted, const gchar *id)
+static GList *
+e_reflow_sorted_get_list(EReflowSorted *e_reflow_sorted, const gchar *id)
{
if (e_reflow_sorted->string_func) {
EReflow *reflow = E_REFLOW(e_reflow_sorted);
@@ -146,16 +146,32 @@ e_reflow_sorted_remove_item(EReflowSorted *e_reflow_sorted, const gchar *id)
GnomeCanvasItem *item = list->data;
char *string = e_reflow_sorted->string_func (item);
if (string && !strcmp(string, id)) {
- reflow->items = g_list_remove_link(reflow->items, list);
- g_list_free_1(list);
- gtk_object_destroy(GTK_OBJECT(item));
- if ( GTK_OBJECT_FLAGS( e_reflow_sorted ) & GNOME_CANVAS_ITEM_REALIZED ) {
- e_canvas_item_request_reflow(item);
- }
- return;
+ return list;
}
}
}
+ return NULL;
+}
+
+void
+e_reflow_sorted_remove_item(EReflowSorted *e_reflow_sorted, const gchar *id)
+{
+ GList *list;
+ GnomeCanvasItem *item = NULL;
+
+ list = e_reflow_sorted_get_list(e_reflow_sorted, id);
+ if (list)
+ item = list->data;
+
+ if (item) {
+ EReflow *reflow = E_REFLOW(e_reflow_sorted);
+ reflow->items = g_list_remove_link(reflow->items, list);
+ g_list_free_1(list);
+ gtk_object_destroy(GTK_OBJECT(item));
+ if ( GTK_OBJECT_FLAGS( e_reflow_sorted ) & GNOME_CANVAS_ITEM_REALIZED ) {
+ e_canvas_item_request_reflow(item);
+ }
+ }
}
void
@@ -168,6 +184,33 @@ e_reflow_sorted_replace_item(EReflowSorted *e_reflow_sorted, GnomeCanvasItem *it
}
}
+GnomeCanvasItem *
+e_reflow_sorted_get_item(EReflowSorted *e_reflow_sorted, const gchar *id)
+{
+ GList *list;
+ list = e_reflow_sorted_get_list(e_reflow_sorted, id);
+ if (list)
+ return list->data;
+ else
+ return NULL;
+}
+
+void
+e_reflow_sorted_reorder_item(EReflowSorted *e_reflow_sorted, const gchar *id)
+{
+ GList *list;
+ GnomeCanvasItem *item = NULL;
+
+ list = e_reflow_sorted_get_list(e_reflow_sorted, id);
+ if (list)
+ item = list->data;
+ if (item) {
+ EReflow *reflow = E_REFLOW(e_reflow_sorted);
+ reflow->items = g_list_remove_link(reflow->items, list);
+ g_list_free_1(list);
+ e_reflow_sorted_add_item(reflow, item);
+ }
+}
static void
e_reflow_sorted_add_item(EReflow *reflow, GnomeCanvasItem *item)
diff --git a/widgets/e-reflow/e-reflow-sorted.h b/widgets/e-reflow/e-reflow-sorted.h
index 4ffec7579b..d9b4acc747 100644
--- a/widgets/e-reflow/e-reflow-sorted.h
+++ b/widgets/e-reflow/e-reflow-sorted.h
@@ -76,9 +76,11 @@ struct _EReflowSortedClass
* should also do an ECanvas parent reflow request if its size
* changes.
*/
-void e_reflow_sorted_remove_item (EReflowSorted *sorted, const char *id);
-void e_reflow_sorted_replace_item (EReflowSorted *sorted, GnomeCanvasItem *item);
-GtkType e_reflow_sorted_get_type (void);
+void e_reflow_sorted_remove_item (EReflowSorted *sorted, const char *id);
+void e_reflow_sorted_replace_item (EReflowSorted *sorted, GnomeCanvasItem *item);
+void e_reflow_sorted_reorder_item (EReflowSorted *e_reflow_sorted, const gchar *id);
+GnomeCanvasItem *e_reflow_sorted_get_item (EReflowSorted *e_reflow_sorted, const gchar *id);
+GtkType e_reflow_sorted_get_type (void);
#ifdef __cplusplus
}