Updating branch refs/heads/master
         to d59fbfc202bd55d0821037b250e89cb31100457e (commit)
       from 2bf70a11a8707924c3a2e3cf2ff265a4f0410f9b (commit)

commit d59fbfc202bd55d0821037b250e89cb31100457e
Author: Andrzej <ndrwr...@gmail.com>
Date:   Thu Mar 29 23:49:06 2012 +0900

    Reworked entry_removed handler

 panel-plugin/indicator-box.c    |   23 +++++++++++++++++++++++
 panel-plugin/indicator-box.h    |   12 ++++++++++--
 panel-plugin/indicator-button.h |    4 ++++
 panel-plugin/indicator.c        |   17 +++++------------
 4 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/panel-plugin/indicator-box.c b/panel-plugin/indicator-box.c
index 95376dd..700a218 100644
--- a/panel-plugin/indicator-box.c
+++ b/panel-plugin/indicator-box.c
@@ -519,3 +519,26 @@ xfce_indicator_box_get_row_size (XfceIndicatorBox *box)
 
   return MIN (box->panel_size / box->nrows, box->icon_size_max + 
border_thickness);
 }
+
+
+XfceIndicatorButton *
+xfce_indicator_box_get_button (XfceIndicatorBox     *box,
+                               IndicatorObjectEntry *entry)
+{
+  GSList              *li;
+  GtkWidget           *child;
+  XfceIndicatorButton *button;
+
+  g_return_val_if_fail (XFCE_IS_INDICATOR_BOX (box), NULL);
+
+  for (li = box->children; li != NULL; li = li->next)
+    {
+      child = GTK_WIDGET (li->data);
+      g_return_val_if_fail (XFCE_IS_INDICATOR_BUTTON (child), NULL);
+
+      button = XFCE_INDICATOR_BUTTON (child);
+      if (xfce_indicator_button_get_entry (button) == entry)
+        return button;
+    }
+  return NULL;
+}
diff --git a/panel-plugin/indicator-box.h b/panel-plugin/indicator-box.h
index b28c9d2..e302279 100644
--- a/panel-plugin/indicator-box.h
+++ b/panel-plugin/indicator-box.h
@@ -18,6 +18,11 @@
 #ifndef __INDICATOR_BOX_H__
 #define __INDICATOR_BOX_H__
 
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <libindicator/indicator-object.h>
+#include "indicator-button.h"
+
 G_BEGIN_DECLS
 
 GType xfce_indicator_box_get_type (void);
@@ -51,14 +56,17 @@ struct _XfceIndicatorBoxClass
   GtkContainerClass __parent__;
 };
 
-void xfce_indicator_box_set_orientation (XfceIndicatorBox *button,
+void xfce_indicator_box_set_orientation (XfceIndicatorBox *box,
                                          GtkOrientation panel_orientation,
                                          GtkOrientation orientation);
 
-void xfce_indicator_box_set_size (XfceIndicatorBox *button,
+void xfce_indicator_box_set_size (XfceIndicatorBox *box,
                                   gint panel_size,
                                   gint nrows);
 
+XfceIndicatorButton *xfce_indicator_box_get_button (XfceIndicatorBox     *box,
+                                                    IndicatorObjectEntry 
*entry);
+
 GtkWidget *xfce_indicator_box_new ();
 
 G_END_DECLS
diff --git a/panel-plugin/indicator-button.h b/panel-plugin/indicator-button.h
index 80e93fb..129aa22 100644
--- a/panel-plugin/indicator-button.h
+++ b/panel-plugin/indicator-button.h
@@ -18,6 +18,10 @@
 #ifndef __INDICATOR_BUTTON_H__
 #define __INDICATOR_BUTTON_H__
 
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <libindicator/indicator-object.h>
+
 G_BEGIN_DECLS
 
 GType xfce_indicator_button_get_type (void);
diff --git a/panel-plugin/indicator.c b/panel-plugin/indicator.c
index e0b2551..e1047cc 100644
--- a/panel-plugin/indicator.c
+++ b/panel-plugin/indicator.c
@@ -361,21 +361,14 @@ entry_added (IndicatorObject * io, IndicatorObjectEntry * 
entry, gpointer user_d
 
 
 static void
-entry_removed_cb (GtkWidget * widget, gpointer userdata)
+entry_removed (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer 
user_data)
 {
-  gpointer data = (gpointer) xfce_indicator_button_get_entry 
(XFCE_INDICATOR_BUTTON (widget));
-
-  if (data != userdata)
-    return;
-    
-  gtk_widget_destroy(widget);
-}
+  XfceIndicatorButton *button;
 
+  button = xfce_indicator_box_get_button (XFCE_INDICATOR_BOX (user_data), 
entry);
 
-static void
-entry_removed (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer 
user_data)
-{
-  gtk_container_foreach(GTK_CONTAINER(user_data), entry_removed_cb, entry);
+  if (button != NULL)
+    gtk_widget_destroy (GTK_WIDGET (button));
 }
 
 
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to