[nautilus] floating-bar: add _cleanup_actions()



commit b30c9ad791961a6cbf5622c1e3c34b8a088c0439
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Feb 14 17:19:00 2011 -0500

    floating-bar: add _cleanup_actions()

 src/nautilus-floating-bar.c |   26 ++++++++++++++++++++++++++
 src/nautilus-floating-bar.h |    1 +
 2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-floating-bar.c b/src/nautilus-floating-bar.c
index 29b58c0..48995fc 100644
--- a/src/nautilus-floating-bar.c
+++ b/src/nautilus-floating-bar.c
@@ -318,3 +318,29 @@ nautilus_floating_bar_add_action (NautilusFloatingBar *self,
 	g_signal_connect (button, "clicked",
 			  G_CALLBACK (action_button_clicked_cb), self);
 }
+
+void
+nautilus_floating_bar_cleanup_actions (NautilusFloatingBar *self)
+{
+	GtkWidget *box, *widget;
+	GList *children, *l;
+	gpointer data;
+
+	g_object_get (self,
+		      "widget", &box,
+		      NULL);
+
+	children = gtk_container_get_children (GTK_CONTAINER (box));
+	l = children;
+
+	while (l != NULL) {
+		widget = l->data;
+		data = g_object_get_data (G_OBJECT (widget), "action-id");
+		l = l->next;
+
+		if (data != NULL) {
+			/* destroy this */
+			gtk_widget_destroy (widget);
+		}
+	}
+}
diff --git a/src/nautilus-floating-bar.h b/src/nautilus-floating-bar.h
index 8379223..a438e3e 100644
--- a/src/nautilus-floating-bar.h
+++ b/src/nautilus-floating-bar.h
@@ -69,6 +69,7 @@ void        nautilus_floating_bar_set_show_spinner (NautilusFloatingBar *self,
 void        nautilus_floating_bar_add_action       (NautilusFloatingBar *self,
 						    const gchar *stock_id,
 						    gint action_id);
+void        nautilus_floating_bar_cleanup_actions  (NautilusFloatingBar *self);
 
 #endif /* __NAUTILUS_FLOATING_BAR_H__ */
 



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