[Xfce4-commits] <xfce4-indicator-plugin:master> Do not ref/unref widgets and let libindicator manage them
Andrzej
noreply at xfce.org
Wed Jan 22 02:44:01 CET 2014
Updating branch refs/heads/master
to 11fbd8c67c272706dbde3ca9fa0722b4691ec817 (commit)
from 6eec40b9771d3bc430e62ab9a0c0c92b643d56ae (commit)
commit 11fbd8c67c272706dbde3ca9fa0722b4691ec817
Author: Andrzej <ndrwrdck at gmail.com>
Date: Wed Jan 22 01:43:35 2014 +0000
Do not ref/unref widgets and let libindicator manage them
panel-plugin/indicator-button-box.c | 17 ++---------------
panel-plugin/indicator-button.c | 18 ++----------------
2 files changed, 4 insertions(+), 31 deletions(-)
diff --git a/panel-plugin/indicator-button-box.c b/panel-plugin/indicator-button-box.c
index 2cb0c24..d4cf065 100644
--- a/panel-plugin/indicator-button-box.c
+++ b/panel-plugin/indicator-button-box.c
@@ -148,11 +148,6 @@ indicator_button_box_finalize (GObject *object)
indicator_button_box_disconnect_signals (box);
- if (box->label != NULL)
- g_object_unref (G_OBJECT (box->label));
- if (box->icon != NULL)
- g_object_unref (G_OBJECT (box->icon));
-
G_OBJECT_CLASS (indicator_button_box_parent_class)->finalize (object);
}
@@ -237,12 +232,8 @@ indicator_button_box_set_label (IndicatorButtonBox *box,
g_return_if_fail (GTK_IS_LABEL (label));
if (box->label != NULL)
- {
- gtk_container_remove (GTK_CONTAINER (box), box->label);
- g_object_unref (G_OBJECT (box->label));
- }
+ gtk_container_remove (GTK_CONTAINER (box), box->label);
box->label = GTK_WIDGET (label);
- g_object_ref (G_OBJECT (box->label));
g_signal_connect(G_OBJECT(box->label), "notify::label",
G_CALLBACK(indicator_button_box_label_changed), box);
g_signal_connect(G_OBJECT(box->label), "notify::visible",
@@ -284,13 +275,9 @@ indicator_button_box_set_image (IndicatorButtonBox *box,
/* g_debug ("indicator-button-box set image, image=%x", (uint) image); */
if (box->icon != NULL)
- {
- gtk_container_remove (GTK_CONTAINER (box), box->icon);
- g_object_unref (G_OBJECT (box->icon));
- }
+ gtk_container_remove (GTK_CONTAINER (box), box->icon);
box->icon = GTK_WIDGET (image);
- g_object_ref (G_OBJECT (box->icon));
g_signal_connect(G_OBJECT(box->icon), "notify::pixbuf",
G_CALLBACK(indicator_button_box_icon_changed), box);
diff --git a/panel-plugin/indicator-button.c b/panel-plugin/indicator-button.c
index 6b5fd92..2963e84 100644
--- a/panel-plugin/indicator-button.c
+++ b/panel-plugin/indicator-button.c
@@ -137,14 +137,6 @@ xfce_indicator_button_finalize (GObject *object)
xfce_indicator_button_disconnect_signals (button);
- if (button->menu != NULL)
- g_object_unref (G_OBJECT (button->menu));
- /* IndicatorObjectEntry is not GObject */
- /* if (button->entry != NULL) */
- /* g_object_unref (G_OBJECT (button->entry)); */
- if (button->io != NULL)
- g_object_unref (G_OBJECT (button->io));
-
G_OBJECT_CLASS (xfce_indicator_button_parent_class)->finalize (object);
}
@@ -184,10 +176,7 @@ xfce_indicator_button_set_menu (XfceIndicatorButton *button,
if (button->menu != menu)
{
- if (button->menu != NULL)
- g_object_unref (G_OBJECT (button->menu));
button->menu = menu;
- g_object_ref (G_OBJECT (button->menu));
g_signal_connect_swapped (G_OBJECT (button->menu), "deactivate",
G_CALLBACK (xfce_indicator_button_menu_deactivate), button);
gtk_menu_attach_to_widget(menu, GTK_WIDGET (button), NULL);
@@ -302,11 +291,6 @@ xfce_indicator_button_new (IndicatorObject *io,
gtk_container_add (GTK_CONTAINER (button->align_box), button->box);
gtk_widget_show (button->box);
- if (button->io != NULL)
- g_object_ref (G_OBJECT (button->io));
- /* IndicatorObjectEntry is not GObject */
- /* g_object_ref (G_OBJECT (button->entry)); */
-
return GTK_WIDGET (button);
}
@@ -332,11 +316,13 @@ xfce_indicator_button_button_press (GtkWidget *widget,
if(event->button == 1 && button->menu != NULL) /* left click only */
{
+ //gtk_menu_attach_to_widget(button->menu, GTK_WIDGET (button), NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),TRUE);
gtk_menu_reposition (GTK_MENU (button->menu));
gtk_menu_popup (button->menu, NULL, NULL,
xfce_panel_plugin_position_menu, button->plugin,
event->button, event->time);
+ //gtk_menu_detach(button->menu);
return TRUE;
}
More information about the Xfce4-commits
mailing list