summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Sales de Andrade <qulogic@pidgin.im>2012-07-23 03:25:45 -0400
committerElliott Sales de Andrade <qulogic@pidgin.im>2012-07-23 03:25:45 -0400
commit69f676723b23aa345d2530dd462d48a4117ebd58 (patch)
treed11337144629f5544d5bcba6f8a2e4e769340505
parentbe6babec64005f5cb53616bd300e3a5ac80668cf (diff)
downloadpidgin-69f676723b23aa345d2530dd462d48a4117ebd58.tar.gz
Hide tooltips field from PidginMenuTray.
We don't really use the grouping functionality, so we can just use one tooltip object for all menu tray objects.
-rw-r--r--pidgin/gtkmenutray.c36
-rw-r--r--pidgin/gtkmenutray.h3
2 files changed, 24 insertions, 15 deletions
diff --git a/pidgin/gtkmenutray.c b/pidgin/gtkmenutray.c
index f78661ad2d..55a73ef946 100644
--- a/pidgin/gtkmenutray.c
+++ b/pidgin/gtkmenutray.c
@@ -35,6 +35,9 @@ enum {
* Globals
*****************************************************************************/
static GObjectClass *parent_class = NULL;
+#if !GTK_CHECK_VERSION(2,12,0)
+static GtkTooltips *tooltips = NULL;
+#endif
/******************************************************************************
* Internal Stuff
@@ -65,6 +68,16 @@ pidgin_menu_tray_deselect(GtkItem *item) {
/******************************************************************************
* Widget Stuff
*****************************************************************************/
+#if !GTK_CHECK_VERSION(2,12,0)
+static void
+tooltips_unref_cb(gpointer data, GObject *object, gboolean is_last_ref)
+{
+ if (is_last_ref) {
+ g_object_unref(tooltips);
+ tooltips = NULL;
+ }
+}
+#endif
/******************************************************************************
* Object Stuff
@@ -96,10 +109,9 @@ pidgin_menu_tray_map(GtkWidget *widget)
static void
pidgin_menu_tray_finalize(GObject *obj)
{
-#if !GTK_CHECK_VERSION(2,12,0)
- PidginMenuTray *tray = PIDGIN_MENU_TRAY(obj);
-#endif
#if 0
+ PidginMenuTray *tray = PIDGIN_MENU_TRAY(obj);
+
/* This _might_ be leaking, but I have a sneaking suspicion that the widget is
* getting destroyed in GtkContainer's finalize function. But if were are
* leaking here, be sure to figure out why this causes a crash.
@@ -110,12 +122,6 @@ pidgin_menu_tray_finalize(GObject *obj)
gtk_widget_destroy(GTK_WIDGET(tray->tray));
#endif
-#if !GTK_CHECK_VERSION(2,12,0)
- if (tray->tooltips) {
- gtk_object_sink(GTK_OBJECT(tray->tooltips));
- }
-#endif
-
G_OBJECT_CLASS(parent_class)->finalize(obj);
}
@@ -247,8 +253,11 @@ void
pidgin_menu_tray_set_tooltip(PidginMenuTray *menu_tray, GtkWidget *widget, const char *tooltip)
{
#if !GTK_CHECK_VERSION(2,12,0)
- if (!menu_tray->tooltips)
- menu_tray->tooltips = gtk_tooltips_new();
+ gboolean notify_tooltips = FALSE;
+ if (!tooltips) {
+ tooltips = gtk_tooltips_new();
+ notify_tooltips = TRUE;
+ }
#endif
/* Should we check whether widget is a child of menu_tray? */
@@ -266,7 +275,10 @@ pidgin_menu_tray_set_tooltip(PidginMenuTray *menu_tray, GtkWidget *widget, const
#if GTK_CHECK_VERSION(2,12,0)
gtk_widget_set_tooltip_text(widget, tooltip);
#else
- gtk_tooltips_set_tip(menu_tray->tooltips, widget, tooltip, NULL);
+ gtk_tooltips_set_tip(tooltips, widget, tooltip, NULL);
+
+ if (notify_tooltips)
+ g_object_add_toggle_ref(G_OBJECT(tooltips), tooltips_unref_cb, NULL);
#endif
}
diff --git a/pidgin/gtkmenutray.h b/pidgin/gtkmenutray.h
index 158530a7bb..2bdbe21c8e 100644
--- a/pidgin/gtkmenutray.h
+++ b/pidgin/gtkmenutray.h
@@ -40,9 +40,6 @@ typedef struct _PidginMenuTrayClass PidginMenuTrayClass;
struct _PidginMenuTray {
GtkMenuItem gparent; /**< The parent instance */
GtkWidget *tray; /**< The tray */
-#if !GTK_CHECK_VERSION(2,12,0)
- GtkTooltips *tooltips; /**< Tooltips */
-#endif
};
/** A PidginMenuTrayClass */