Updating branch refs/heads/master to c9785b9b7beb502e6b7bd03cbfbc6cd765040a29 (commit) from 8af1dffe564bf937c61ff0d3381a1d543b628e5b (commit)
commit c9785b9b7beb502e6b7bd03cbfbc6cd765040a29 Author: Andrzej <ndrwr...@gmail.com> Date: Sat Apr 28 15:31:55 2012 +0900 Refactored XfceIndicatorButton class Moved box-specific fields to XfceIndicatorBox and added a box-layout-changed signal to update all buttons at once. This may also be faster and less glitchy as signals are merged by the main loop. panel-plugin/indicator-box.c | 141 +++++++++++++++++-------- panel-plugin/indicator-box.h | 20 +++- panel-plugin/indicator-button.c | 222 ++++++++++++++++++++------------------- panel-plugin/indicator-button.h | 29 ++---- panel-plugin/indicator.c | 11 +-- 5 files changed, 241 insertions(+), 182 deletions(-) diff --git a/panel-plugin/indicator-box.c b/panel-plugin/indicator-box.c index ffaf455..37248c4 100644 --- a/panel-plugin/indicator-box.c +++ b/panel-plugin/indicator-box.c @@ -65,6 +65,15 @@ enum PROP_ALIGN_LEFT }; +enum +{ + BOX_LAYOUT_CHANGED, + LAST_SIGNAL +}; + +static guint xfce_indicator_box_signals[LAST_SIGNAL] = { 0, }; + + G_DEFINE_TYPE (XfceIndicatorBox, xfce_indicator_box, GTK_TYPE_CONTAINER) static void @@ -103,7 +112,13 @@ xfce_indicator_box_class_init (XfceIndicatorBoxClass *klass) FALSE, EXO_PARAM_READWRITE)); - + xfce_indicator_box_signals[BOX_LAYOUT_CHANGED] = + g_signal_new (g_intern_static_string ("box-layout-changed"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } @@ -190,13 +205,7 @@ xfce_indicator_box_set_property (GObject *object, if (box->icon_size_max != val) { box->icon_size_max = val; - size = xfce_indicator_box_get_row_size (box); - for (li = box->children; li != NULL; li = li->next) - { - child = XFCE_INDICATOR_BUTTON (li->data); - g_return_if_fail (XFCE_IS_INDICATOR_BUTTON (child)); - xfce_indicator_button_set_size (child, box->panel_size, size); - } + g_signal_emit (G_OBJECT (box), xfce_indicator_box_signals[BOX_LAYOUT_CHANGED], 0); } break; @@ -205,12 +214,7 @@ xfce_indicator_box_set_property (GObject *object, if (box->align_left != val) { box->align_left = val; - for (li = box->children; li != NULL; li = li->next) - { - child = XFCE_INDICATOR_BUTTON (li->data); - g_return_if_fail (XFCE_IS_INDICATOR_BUTTON (child)); - xfce_indicator_button_set_align_left (child, box->align_left); - } + g_signal_emit (G_OBJECT (box), xfce_indicator_box_signals[BOX_LAYOUT_CHANGED], 0); } break; @@ -247,12 +251,7 @@ xfce_indicator_box_set_orientation (XfceIndicatorBox *box, if (needs_update) { - for (li = box->children; li != NULL; li = li->next) - { - child = XFCE_INDICATOR_BUTTON (li->data); - g_return_if_fail (XFCE_IS_INDICATOR_BUTTON (child)); - xfce_indicator_button_set_orientation (child, panel_orientation, orientation); - } + g_signal_emit (G_OBJECT (box), xfce_indicator_box_signals[BOX_LAYOUT_CHANGED], 0); gtk_widget_queue_resize (GTK_WIDGET (box)); } } @@ -285,13 +284,7 @@ xfce_indicator_box_set_size (XfceIndicatorBox *box, if (needs_update) { - size = xfce_indicator_box_get_row_size (box); - for (li = box->children; li != NULL; li = li->next) - { - child = XFCE_INDICATOR_BUTTON (li->data); - g_return_if_fail (XFCE_IS_INDICATOR_BUTTON (child)); - xfce_indicator_button_set_size (child, panel_size, size); - } + g_signal_emit (G_OBJECT (box), xfce_indicator_box_signals[BOX_LAYOUT_CHANGED], 0); gtk_widget_queue_resize (GTK_WIDGET (box)); } } @@ -322,10 +315,6 @@ xfce_indicator_box_add (GtkContainer *container, box->children = g_slist_append (box->children, child); gtk_widget_set_parent (child, GTK_WIDGET (box)); - xfce_indicator_button_set_orientation (button, box->panel_orientation, box->orientation); - size = xfce_indicator_box_get_row_size (box); - xfce_indicator_button_set_size (button, box->panel_size, size); - xfce_indicator_button_set_align_left (button, box->align_left); gtk_widget_queue_resize (GTK_WIDGET (container)); } @@ -402,9 +391,7 @@ xfce_indicator_box_size_request (GtkWidget *widget, row = 0; length = 0; x = 0; - //nrows = MAX (box->nrows, - // box->panel_size / xfce_indicator_box_get_row_size (box)); - nrows = box->panel_size / xfce_indicator_box_get_row_size (box); + nrows = xfce_indicator_box_get_nrows (box); for (li = box->children; li != NULL; li = li->next) { @@ -478,8 +465,7 @@ xfce_indicator_box_size_allocate (GtkWidget *widget, x0 = allocation->x; y0 = allocation->y; - //nrows = MAX (box->nrows, box->panel_size / box->icon_size_max); - nrows = box->panel_size / xfce_indicator_box_get_row_size (box); + nrows = xfce_indicator_box_get_nrows (box); panel_size = box->panel_size; size = panel_size / nrows; @@ -557,24 +543,93 @@ xfce_indicator_box_get_row_size (XfceIndicatorBox *box) } -XfceIndicatorButton * -xfce_indicator_box_get_button (XfceIndicatorBox *box, - IndicatorObjectEntry *entry) +void +xfce_indicator_box_remove_entry (XfceIndicatorBox *box, + IndicatorObjectEntry *entry) { GSList *li; GtkWidget *child; XfceIndicatorButton *button; - g_return_val_if_fail (XFCE_IS_INDICATOR_BOX (box), NULL); + g_return_if_fail (XFCE_IS_INDICATOR_BOX (box)); 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); + g_return_if_fail (XFCE_IS_INDICATOR_BUTTON (child)); button = XFCE_INDICATOR_BUTTON (child); if (xfce_indicator_button_get_entry (button) == entry) - return button; + { + xfce_indicator_button_disconnect_signals (button); + gtk_widget_destroy (GTK_WIDGET (button)); + } } - return NULL; +} + + + + + +GtkOrientation +xfce_indicator_box_get_panel_orientation (XfceIndicatorBox *box) +{ + g_return_val_if_fail (XFCE_IS_INDICATOR_BOX (box), GTK_ORIENTATION_HORIZONTAL); + + return box->panel_orientation; +} + + +GtkOrientation +xfce_indicator_box_get_indicator_orientation (XfceIndicatorBox *box) +{ + g_return_val_if_fail (XFCE_IS_INDICATOR_BOX (box), GTK_ORIENTATION_HORIZONTAL); + + return box->orientation; +} + + +gint +xfce_indicator_box_get_nrows (XfceIndicatorBox *box) +{ + g_return_val_if_fail (XFCE_IS_INDICATOR_BOX (box), 0); + + return box->panel_size / xfce_indicator_box_get_row_size (box); + +} + + +gint +xfce_indicator_box_get_panel_size (XfceIndicatorBox *box) +{ + g_return_val_if_fail (XFCE_IS_INDICATOR_BOX (box), 0); + + return box->panel_size; +} + + +gint +xfce_indicator_box_get_indicator_size (XfceIndicatorBox *box) +{ + g_return_val_if_fail (XFCE_IS_INDICATOR_BOX (box), 0); + + return xfce_indicator_box_get_row_size (box); +} + + +gint +xfce_indicator_box_get_icon_size_max (XfceIndicatorBox *box) +{ + g_return_val_if_fail (XFCE_IS_INDICATOR_BOX (box), 0); + + return box->icon_size_max; +} + + +gboolean +xfce_indicator_box_get_align_left (XfceIndicatorBox *box) +{ + g_return_val_if_fail (XFCE_IS_INDICATOR_BOX (box), FALSE); + + return box->align_left; } diff --git a/panel-plugin/indicator-box.h b/panel-plugin/indicator-box.h index 79b212d..e4ee8c9 100644 --- a/panel-plugin/indicator-box.h +++ b/panel-plugin/indicator-box.h @@ -21,7 +21,6 @@ #include <glib.h> #include <gtk/gtk.h> #include <libindicator/indicator-object.h> -#include "indicator-button.h" G_BEGIN_DECLS @@ -65,8 +64,23 @@ void xfce_indicator_box_set_size (XfceIndicatorBox *box, gint panel_size, gint nrows); -XfceIndicatorButton *xfce_indicator_box_get_button (XfceIndicatorBox *box, - IndicatorObjectEntry *entry); + +GtkOrientation xfce_indicator_box_get_panel_orientation (XfceIndicatorBox *box); + +GtkOrientation xfce_indicator_box_get_indicator_orientation (XfceIndicatorBox *box); + +gint xfce_indicator_box_get_nrows (XfceIndicatorBox *box); + +gint xfce_indicator_box_get_panel_size (XfceIndicatorBox *box); + +gint xfce_indicator_box_get_indicator_size (XfceIndicatorBox *box); + +gint xfce_indicator_box_get_icon_size_max (XfceIndicatorBox *box); + +gboolean xfce_indicator_box_get_align_left (XfceIndicatorBox *box); + +void xfce_indicator_box_remove_entry (XfceIndicatorBox *box, + IndicatorObjectEntry *entry); GtkWidget *xfce_indicator_box_new (); diff --git a/panel-plugin/indicator-button.c b/panel-plugin/indicator-button.c index 364d137..58ff3cc 100644 --- a/panel-plugin/indicator-button.c +++ b/panel-plugin/indicator-button.c @@ -32,7 +32,8 @@ #include "indicator-button.h" -static void xfce_indicator_button_finalize (GObject *object); +static void xfce_indicator_button_finalize (GObject *object); +static gint xfce_indicator_button_get_icon_size (XfceIndicatorButton *button); G_DEFINE_TYPE (XfceIndicatorButton, xfce_indicator_button, GTK_TYPE_TOGGLE_BUTTON) @@ -57,27 +58,23 @@ xfce_indicator_button_init (XfceIndicatorButton *button) gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE); gtk_widget_set_name (GTK_WIDGET (button), "indicator-button"); + button->io = NULL; button->entry = NULL; + button->buttonbox = NULL; button->menu = NULL; button->label = NULL; button->orig_icon = NULL; button->icon = NULL; - button->orig_icon_handler = 0; + button->orig_icon_changed_id = 0; + button->box_layout_changed_id = 0; - button->size = 0; - button->panel_size = 0; - button->icon_size = 24; - button->align_left = FALSE; - button->panel_orientation = GTK_ORIENTATION_HORIZONTAL; - button->orientation = GTK_ORIENTATION_HORIZONTAL; + button->align_box = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); + gtk_container_add (GTK_CONTAINER (button), button->align_box); + gtk_widget_show (button->align_box); - button->alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); - gtk_container_add (GTK_CONTAINER (button), button->alignment); - gtk_widget_show (button->alignment); - - button->box = xfce_hvbox_new (button->orientation, FALSE, 1); - gtk_container_add (GTK_CONTAINER (button->alignment), button->box); + button->box = xfce_hvbox_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 1); + gtk_container_add (GTK_CONTAINER (button->align_box), button->box); gtk_widget_show (button->box); } @@ -88,6 +85,8 @@ xfce_indicator_button_finalize (GObject *object) { XfceIndicatorButton *button = XFCE_INDICATOR_BUTTON (object); + xfce_indicator_button_disconnect_signals (button); + if (button->label != NULL) g_object_unref (G_OBJECT (button->label)); if (button->orig_icon != NULL) @@ -96,6 +95,8 @@ xfce_indicator_button_finalize (GObject *object) g_object_unref (G_OBJECT (button->icon)); if (button->menu != NULL) g_object_unref (G_OBJECT (button->menu)); + if (button->buttonbox != NULL) + g_object_unref (G_OBJECT (button->buttonbox)); /* IndicatorObjectEntry is not GObject */ /* if (button->entry != NULL) */ /* g_object_unref (G_OBJECT (button->entry)); */ @@ -113,33 +114,48 @@ xfce_indicator_button_update_layout (XfceIndicatorButton *button) GtkRequisition label_size; g_return_if_fail (XFCE_IS_INDICATOR_BUTTON (button)); + g_return_if_fail (XFCE_IS_INDICATOR_BOX (button->buttonbox)); if (button->label != NULL && - button->panel_orientation == GTK_ORIENTATION_VERTICAL && - button->orientation == GTK_ORIENTATION_HORIZONTAL) + xfce_indicator_box_get_panel_orientation (button->buttonbox) == GTK_ORIENTATION_VERTICAL && + xfce_indicator_box_get_indicator_orientation (button->buttonbox) == GTK_ORIENTATION_HORIZONTAL) { - gtk_alignment_set (GTK_ALIGNMENT (button->alignment), button->align_left ? 0.0 : 0.5, 0.5, 0.0, 0.0); gtk_widget_size_request (button->label, &label_size); - /* put icon above the label if number of rows > 1 (they look better) - or if they don't fit when arranged horizontally */ - if ((!button->align_left && button->panel_size != button->size) || - label_size.width > button->panel_size - button->size) - gtk_orientable_set_orientation (GTK_ORIENTABLE (button->box), GTK_ORIENTATION_VERTICAL); + if (!xfce_indicator_box_get_align_left (button->buttonbox) + || (button->icon != NULL + && label_size.width > + xfce_indicator_box_get_panel_size (button->buttonbox) + - xfce_indicator_box_get_indicator_size (button->buttonbox))) + { + gtk_alignment_set (GTK_ALIGNMENT (button->align_box), 0.5, 0.5, 0.0, 0.0); + gtk_orientable_set_orientation (GTK_ORIENTABLE (button->box), GTK_ORIENTATION_VERTICAL); + } else - gtk_orientable_set_orientation (GTK_ORIENTABLE (button->box), GTK_ORIENTATION_HORIZONTAL); + { + gtk_alignment_set (GTK_ALIGNMENT (button->align_box), 0.0, 0.5, 0.0, 0.0); + gtk_orientable_set_orientation (GTK_ORIENTABLE (button->box), GTK_ORIENTATION_HORIZONTAL); + } } else { - gtk_alignment_set (GTK_ALIGNMENT (button->alignment), 0.5, 0.5, 0.0, 0.0); + gtk_alignment_set (GTK_ALIGNMENT (button->align_box), 0.5, 0.5, 0.0, 0.0); + gtk_orientable_set_orientation (GTK_ORIENTABLE (button->box), + xfce_indicator_box_get_indicator_orientation (button->buttonbox)); } + + if (button->label != NULL) + gtk_label_set_angle (GTK_LABEL (button->label), + (xfce_indicator_box_get_indicator_orientation (button->buttonbox) == GTK_ORIENTATION_VERTICAL) + ? -90 : 0); if (button->icon != NULL) - xfce_panel_image_set_size (XFCE_PANEL_IMAGE (button->icon), button->icon_size); + xfce_panel_image_set_size (XFCE_PANEL_IMAGE (button->icon), xfce_indicator_button_get_icon_size (button)); } + static void xfce_indicator_button_update_icon (XfceIndicatorButton *button) { @@ -150,9 +166,8 @@ xfce_indicator_button_update_icon (XfceIndicatorButton *button) g_return_if_fail (GTK_IS_IMAGE (button->orig_icon)); g_return_if_fail (XFCE_IS_PANEL_IMAGE (button->icon)); - size = button->icon_size; + size = xfce_indicator_button_get_icon_size (button); - /* Copied from xfce_panel_image.c, try to snap to icon sizes, which minimize smoothing */ #if 0 if (size > 16 && size < 22) size = 16; @@ -183,7 +198,17 @@ xfce_indicator_button_update_icon (XfceIndicatorButton *button) xfce_panel_image_set_from_source (XFCE_PANEL_IMAGE (button->icon), "image-missing"); } - xfce_panel_image_set_size (XFCE_PANEL_IMAGE (button->icon), button->icon_size); + xfce_panel_image_set_size (XFCE_PANEL_IMAGE (button->icon), size); +} + + + +static void +xfce_indicator_button_label_changed (GtkLabel *label, + GParamSpec *pspec, + XfceIndicatorButton *button) +{ + xfce_indicator_button_update_layout (button); } @@ -205,9 +230,8 @@ xfce_indicator_button_set_label (XfceIndicatorButton *button, button->label = GTK_WIDGET (label); g_object_ref (G_OBJECT (button->label)); - gtk_label_set_angle (GTK_LABEL (button->label), - (button->orientation == GTK_ORIENTATION_VERTICAL) ? -90 : 0); gtk_box_pack_end (GTK_BOX (button->box), button->label, TRUE, FALSE, 1); + g_signal_connect(G_OBJECT(button->label), "notify::label", G_CALLBACK(xfce_indicator_button_label_changed), button); } xfce_indicator_button_update_layout (button); } @@ -244,8 +268,11 @@ xfce_indicator_button_set_image (XfceIndicatorButton *button, { if (button->orig_icon != NULL) { - g_signal_handler_disconnect - (G_OBJECT (button->orig_icon), button->orig_icon_handler); + if (button->orig_icon_changed_id != 0) + { + g_signal_handler_disconnect (G_OBJECT (button->orig_icon), button->orig_icon_changed_id); + button->orig_icon_changed_id = 0; + } g_object_unref (G_OBJECT (button->orig_icon)); } @@ -258,7 +285,7 @@ xfce_indicator_button_set_image (XfceIndicatorButton *button, button->orig_icon = GTK_WIDGET (image); g_object_ref (G_OBJECT (button->orig_icon)); - button->orig_icon_handler = g_signal_connect + button->orig_icon_changed_id = g_signal_connect (G_OBJECT (image), "notify::pixbuf", G_CALLBACK (on_pixbuf_changed), button); @@ -343,108 +370,87 @@ xfce_indicator_button_get_menu (XfceIndicatorButton *button) -void -xfce_indicator_button_set_orientation (XfceIndicatorButton *button, - GtkOrientation panel_orientation, - GtkOrientation orientation) +static gint +xfce_indicator_button_get_icon_size (XfceIndicatorButton *button) { - gboolean needs_update = FALSE; - - g_return_if_fail (XFCE_IS_INDICATOR_BUTTON (button)); + gint indicator_size; + gint border_thickness; + GtkStyle *style; - if (button->orientation != orientation) - { - button->orientation = orientation; + g_return_val_if_fail (XFCE_IS_INDICATOR_BUTTON (button), 24); + g_return_val_if_fail (XFCE_IS_INDICATOR_BOX (button->buttonbox), 24); - if (button->label != NULL) - gtk_label_set_angle (GTK_LABEL (button->label), - (orientation == GTK_ORIENTATION_VERTICAL) ? -90 : 0); - needs_update = TRUE; - } + indicator_size = xfce_indicator_box_get_indicator_size (button->buttonbox); - if (button->panel_orientation != panel_orientation) - { - button->panel_orientation = panel_orientation; - needs_update = TRUE; - } + style = gtk_widget_get_style (GTK_WIDGET (button)); + border_thickness = 2 * MAX (style->xthickness, style->ythickness) + 2; - if (needs_update) - { - gtk_orientable_set_orientation (GTK_ORIENTABLE (button->box), orientation); - xfce_indicator_button_update_layout (button); - } + return MIN (indicator_size - border_thickness, + xfce_indicator_box_get_icon_size_max (button->buttonbox)); } -void -xfce_indicator_button_set_size (XfceIndicatorButton *button, - gint panel_size, - gint size) +static void +xfce_indicator_button_box_layout_changed (XfceIndicatorButton *button, + XfceIndicatorBox *box) { - gboolean needs_update = FALSE; - gint border_thickness; - GtkStyle *style; - gdouble aspect; - g_return_if_fail (XFCE_IS_INDICATOR_BUTTON (button)); + g_return_if_fail (XFCE_IS_INDICATOR_BOX (box)); + g_return_if_fail (GTK_WIDGET (button)->parent != NULL); - if (button->size != size) - { - button->size = size; - needs_update = TRUE; - } + //printf ("parent %x\n", (guint) GTK_WIDGET (button)->parent); - if (button->panel_size != panel_size) - { - button->panel_size = panel_size; - needs_update = TRUE; - } - - if (needs_update) - { - style = gtk_widget_get_style (GTK_WIDGET (button)); - border_thickness = 2 * MAX (style->xthickness, style->ythickness) + 2; - button->icon_size = button->size - border_thickness; - - if (button->orig_icon != NULL) - { - xfce_indicator_button_update_icon (button); - xfce_indicator_button_update_layout (button); - } - } -} - - - -void -xfce_indicator_button_set_align_left (XfceIndicatorButton *button, - gboolean align_left) -{ - g_return_if_fail (XFCE_IS_INDICATOR_BUTTON (button)); - - if (button->align_left != align_left) - { - button->align_left = align_left; - xfce_indicator_button_update_layout (button); - } + if (button->orig_icon != NULL) + xfce_indicator_button_update_icon (button); + xfce_indicator_button_update_layout (button); } - GtkWidget * -xfce_indicator_button_new (IndicatorObject *io, - IndicatorObjectEntry *entry) +xfce_indicator_button_new (IndicatorObject *io, + IndicatorObjectEntry *entry, + XfceIndicatorBox *buttonbox) { XfceIndicatorButton *button = g_object_new (XFCE_TYPE_INDICATOR_BUTTON, NULL); + g_return_val_if_fail (XFCE_IS_INDICATOR_BOX (buttonbox), NULL); + button->io = io; button->entry = entry; + button->buttonbox = buttonbox; if (button->io != NULL) g_object_ref (G_OBJECT (button->io)); /* IndicatorObjectEntry is not GObject */ /* g_object_ref (G_OBJECT (button->entry)); */ + if (button->buttonbox != NULL) + g_object_ref (G_OBJECT (button->buttonbox)); + + button->box_layout_changed_id = + g_signal_connect_swapped (G_OBJECT (button->buttonbox), "box-layout-changed", + G_CALLBACK (xfce_indicator_button_box_layout_changed), button); + return GTK_WIDGET (button); } + +void +xfce_indicator_button_disconnect_signals (XfceIndicatorButton *button) +{ + g_return_if_fail (XFCE_IS_INDICATOR_BUTTON (button)); + + if (button->box_layout_changed_id != 0) + { + g_signal_handler_disconnect (button->buttonbox, button->box_layout_changed_id); + button->box_layout_changed_id = 0; + } + + if (button->orig_icon_changed_id != 0) + { + g_signal_handler_disconnect (G_OBJECT (button->orig_icon), button->orig_icon_changed_id); + button->orig_icon_changed_id = 0; + } + +} + diff --git a/panel-plugin/indicator-button.h b/panel-plugin/indicator-button.h index 4436c98..d7499bf 100644 --- a/panel-plugin/indicator-button.h +++ b/panel-plugin/indicator-button.h @@ -21,6 +21,7 @@ #include <glib.h> #include <gtk/gtk.h> #include <libindicator/indicator-object.h> +#include "indicator-box.h" G_BEGIN_DECLS @@ -42,22 +43,17 @@ struct _XfceIndicatorButton IndicatorObject *io; IndicatorObjectEntry *entry; + XfceIndicatorBox *buttonbox; GtkMenu *menu; - GtkWidget *alignment; + GtkWidget *align_box; GtkWidget *box; GtkWidget *label; GtkWidget *icon; GtkWidget *orig_icon; - gulong orig_icon_handler; - gint panel_size; - gint size; - gint icon_size; - gboolean align_left; - - GtkOrientation panel_orientation; - GtkOrientation orientation; + gulong orig_icon_changed_id; + gulong box_layout_changed_id; }; struct _XfceIndicatorButtonClass @@ -81,18 +77,11 @@ IndicatorObject *xfce_indicator_button_get_io (XfceIndicatorButton *button); GtkMenu *xfce_indicator_button_get_menu (XfceIndicatorButton *button); -void xfce_indicator_button_set_orientation (XfceIndicatorButton *button, - GtkOrientation panel_orientation, - GtkOrientation orientation); - -void xfce_indicator_button_set_size (XfceIndicatorButton *button, - gint panel_size, - gint size); - -void xfce_indicator_button_set_align_left (XfceIndicatorButton *button, - gboolean align_left); +GtkWidget *xfce_indicator_button_new (IndicatorObject *io, + IndicatorObjectEntry *entry, + XfceIndicatorBox *buttonbox); -GtkWidget *xfce_indicator_button_new (IndicatorObject *io, IndicatorObjectEntry *entry); +void xfce_indicator_button_disconnect_signals (XfceIndicatorButton *button); G_END_DECLS diff --git a/panel-plugin/indicator.c b/panel-plugin/indicator.c index 3332087..e122aea 100644 --- a/panel-plugin/indicator.c +++ b/panel-plugin/indicator.c @@ -350,7 +350,7 @@ indicator_construct (XfcePanelPlugin *plugin) if (indicators_loaded == 0) { /* A label to allow for click through */ - indicator->item = xfce_indicator_button_new(NULL, NULL); + indicator->item = xfce_indicator_button_new(NULL, NULL, XFCE_INDICATOR_BOX (indicator->buttonbox)); xfce_indicator_button_set_label(XFCE_INDICATOR_BUTTON(indicator->item), GTK_LABEL (gtk_label_new(_("No Indicators")))); gtk_container_add (GTK_CONTAINER (indicator->buttonbox), indicator->item); @@ -379,7 +379,7 @@ entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_d { XfcePanelPlugin *plugin = XFCE_PANEL_PLUGIN (user_data); IndicatorPlugin *indicator = XFCE_INDICATOR_PLUGIN (plugin); - GtkWidget * button = xfce_indicator_button_new (io, entry); + GtkWidget * button = xfce_indicator_button_new (io, entry, XFCE_INDICATOR_BOX (indicator->buttonbox)); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); gtk_button_set_use_underline(GTK_BUTTON (button),TRUE); gtk_widget_set_name(GTK_WIDGET (button), "indicator-button"); @@ -409,12 +409,7 @@ entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_d static void entry_removed (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data) { - XfceIndicatorButton *button; - - button = xfce_indicator_box_get_button (XFCE_INDICATOR_BOX (user_data), entry); - - if (button != NULL) - gtk_widget_destroy (GTK_WIDGET (button)); + xfce_indicator_box_remove_entry (XFCE_INDICATOR_BOX (user_data), entry); } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits