aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-05-19 12:13:37 +0800
committerChris Lahey <clahey@src.gnome.org>2000-05-19 12:13:37 +0800
commitf62df6f7d7294888fde711dde94d28d7e2ac2c2a (patch)
tree72d18016028d6930fec50fc725b820abf9b3d31e
parent60f4552ab73a9c9fe39a68a0c1cbf6edae1d06e2 (diff)
downloadgsoc2013-evolution-f62df6f7d7294888fde711dde94d28d7e2ac2c2a.tar
gsoc2013-evolution-f62df6f7d7294888fde711dde94d28d7e2ac2c2a.tar.gz
gsoc2013-evolution-f62df6f7d7294888fde711dde94d28d7e2ac2c2a.tar.bz2
gsoc2013-evolution-f62df6f7d7294888fde711dde94d28d7e2ac2c2a.tar.lz
gsoc2013-evolution-f62df6f7d7294888fde711dde94d28d7e2ac2c2a.tar.xz
gsoc2013-evolution-f62df6f7d7294888fde711dde94d28d7e2ac2c2a.tar.zst
gsoc2013-evolution-f62df6f7d7294888fde711dde94d28d7e2ac2c2a.zip
Added e_container_foreach_leaf.
2000-05-19 Christopher James Lahey <clahey@helixcode.com> * e-gui-utils.c, e-gui-utils.h: Added e_container_foreach_leaf. svn path=/trunk/; revision=3130
-rw-r--r--e-util/ChangeLog4
-rw-r--r--e-util/e-gui-utils.c26
-rw-r--r--e-util/e-gui-utils.h5
-rw-r--r--widgets/misc/e-gui-utils.c26
-rw-r--r--widgets/misc/e-gui-utils.h5
5 files changed, 64 insertions, 2 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 9fde2e70a9..f9cc14b3ad 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,7 @@
+2000-05-19 Christopher James Lahey <clahey@helixcode.com>
+
+ * e-gui-utils.c, e-gui-utils.h: Added e_container_foreach_leaf.
+
2000-05-18 Christopher James Lahey <clahey@helixcode.com>
* Makefile.am: Add imagesdir support.
diff --git a/e-util/e-gui-utils.c b/e-util/e-gui-utils.c
index f7e2d946c6..5d53c64d35 100644
--- a/e-util/e-gui-utils.c
+++ b/e-util/e-gui-utils.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GUI utility functions
*
@@ -110,3 +111,28 @@ GtkWidget *e_create_image_widget(gchar *name,
return NULL;
}
+typedef struct {
+ GtkCallback callback;
+ gpointer closure;
+} CallbackClosure;
+
+static void
+e_container_foreach_leaf_callback(GtkWidget *widget, CallbackClosure *callback_closure)
+{
+ if (GTK_IS_CONTAINER(widget)) {
+ e_container_foreach_leaf(GTK_CONTAINER(widget), callback_closure->callback, callback_closure->closure);
+ } else {
+ (*callback_closure->callback) (widget, callback_closure->closure);
+ }
+}
+
+void
+e_container_foreach_leaf(GtkContainer *container,
+ GtkCallback callback,
+ gpointer closure)
+{
+ CallbackClosure callback_closure;
+ callback_closure.callback = callback;
+ callback_closure.closure = closure;
+ gtk_container_foreach(container, (GtkCallback) e_container_foreach_leaf_callback, &callback_closure);
+}
diff --git a/e-util/e-gui-utils.h b/e-util/e-gui-utils.h
index 7339821455..cffdbd1e4f 100644
--- a/e-util/e-gui-utils.h
+++ b/e-util/e-gui-utils.h
@@ -7,7 +7,10 @@
void e_popup_menu (GtkMenu *menu, GdkEventButton *event);
void e_auto_kill_popup_menu_on_hide (GtkMenu *menu);
void e_notice (GtkWindow *window, const char *type, const char *format, ...);
-GtkWidget *e_create_image_widget(gchar *name, gchar *string1, gchar *string2, gint int1, gint int2);
+GtkWidget *e_create_image_widget (gchar *name, gchar *string1, gchar *string2, gint int1, gint int2);
+void e_container_foreach_leaf (GtkContainer *container,
+ GtkCallback callback,
+ gpointer closure);
#endif /* E_GUI_UTILS_H */
diff --git a/widgets/misc/e-gui-utils.c b/widgets/misc/e-gui-utils.c
index f7e2d946c6..5d53c64d35 100644
--- a/widgets/misc/e-gui-utils.c
+++ b/widgets/misc/e-gui-utils.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GUI utility functions
*
@@ -110,3 +111,28 @@ GtkWidget *e_create_image_widget(gchar *name,
return NULL;
}
+typedef struct {
+ GtkCallback callback;
+ gpointer closure;
+} CallbackClosure;
+
+static void
+e_container_foreach_leaf_callback(GtkWidget *widget, CallbackClosure *callback_closure)
+{
+ if (GTK_IS_CONTAINER(widget)) {
+ e_container_foreach_leaf(GTK_CONTAINER(widget), callback_closure->callback, callback_closure->closure);
+ } else {
+ (*callback_closure->callback) (widget, callback_closure->closure);
+ }
+}
+
+void
+e_container_foreach_leaf(GtkContainer *container,
+ GtkCallback callback,
+ gpointer closure)
+{
+ CallbackClosure callback_closure;
+ callback_closure.callback = callback;
+ callback_closure.closure = closure;
+ gtk_container_foreach(container, (GtkCallback) e_container_foreach_leaf_callback, &callback_closure);
+}
diff --git a/widgets/misc/e-gui-utils.h b/widgets/misc/e-gui-utils.h
index 7339821455..cffdbd1e4f 100644
--- a/widgets/misc/e-gui-utils.h
+++ b/widgets/misc/e-gui-utils.h
@@ -7,7 +7,10 @@
void e_popup_menu (GtkMenu *menu, GdkEventButton *event);
void e_auto_kill_popup_menu_on_hide (GtkMenu *menu);
void e_notice (GtkWindow *window, const char *type, const char *format, ...);
-GtkWidget *e_create_image_widget(gchar *name, gchar *string1, gchar *string2, gint int1, gint int2);
+GtkWidget *e_create_image_widget (gchar *name, gchar *string1, gchar *string2, gint int1, gint int2);
+void e_container_foreach_leaf (GtkContainer *container,
+ GtkCallback callback,
+ gpointer closure);
#endif /* E_GUI_UTILS_H */