public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] [PATCH] Implement browse callback in the applet
Date: Wed, 25 Jul 2007 14:43:01 +0100	[thread overview]
Message-ID: <1185370981.3641.243.camel@cookie.hadess.net> (raw)
In-Reply-To: <1185314064.3641.186.camel@cookie.hadess.net>

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

On Tue, 2007-07-24 at 22:54 +0100, Bastien Nocera wrote:
> On Tue, 2007-07-24 at 23:19 +0200, Marcel Holtmann wrote:
<snip>
> I guess the actual browse menu item implementation will have to wait for
> the other patches to be done. This patch should apply with some fuzz.

Same one with a global instead of a static. Should apply with extra fuzz
as well.

-- 
Bastien Nocera <hadess@hadess.net> 

[-- Attachment #2: bluez-gnome-fix-menu-leak-2.patch --]
[-- Type: text/x-patch, Size: 2126 bytes --]

Index: main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/main.c,v
retrieving revision 1.69
diff -u -p -r1.69 main.c
--- main.c	25 Jul 2007 11:18:09 -0000	1.69
+++ main.c	25 Jul 2007 13:39:33 -0000
@@ -60,6 +62,9 @@ static gboolean use_hal = FALSE;
 
 static GList *adapter_list = NULL;
 
+static GtkWidget *menu = NULL;
+static GtkWidget *browse_item = NULL;
+
 struct adapter_data {
 	char *path;
 	int attached;
@@ -1510,9 +1560,11 @@ static void activate_callback(GObject *w
 static void popup_callback(GObject *widget, guint button,
 				guint activate_time, gpointer user_data)
 {
-	GtkWidget *menu;
 	GtkWidget *item;
 
+	if (menu != NULL)
+		goto popup;
+
 	menu = gtk_menu_new();
 
 	item = gtk_image_menu_item_new_from_stock(GTK_STOCK_PREFERENCES, NULL);
@@ -1531,14 +1583,11 @@ static void popup_callback(GObject *widg
 	gtk_widget_show(item);
 	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
 
-	item = gtk_image_menu_item_new_with_label(_("Browse device..."));
-	g_signal_connect(item, "activate",
+	browse_item = gtk_image_menu_item_new_with_label(_("Browse device..."));
+	g_signal_connect(browse_item, "activate",
 				G_CALLBACK(browse_callback), NULL);
-	gtk_widget_show(item);
-	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
-
-	gtk_widget_set_sensitive(item, obexftp_available() &&
-						attached_adapters() > 0);
+	gtk_widget_show(browse_item);
+	gtk_menu_shell_append(GTK_MENU_SHELL(menu), browse_item);
 
 #if 0
 	item = gtk_separator_menu_item_new();
@@ -1552,6 +1601,10 @@ static void popup_callback(GObject *widg
 	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
 #endif
 
+popup:
+	gtk_widget_set_sensitive(browse_item, obexftp_available() &&
+						attached_adapters() > 0);
+
 	gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
 			gtk_status_icon_position_menu,
 			GTK_STATUS_ICON(widget), button, activate_time);
@@ -1685,6 +1738,10 @@ int main(int argc, char *argv[])
 	gtk_main();
 
 	g_object_unref(gconf);
+	if (menu)
+		g_object_unref(menu);
+	if (browse_item)
+		g_object_unref(browse_item);
 
 	close_notification();
 

[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2007-07-25 13:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-24 16:38 [Bluez-devel] [PATCH] Implement browse callback in the applet Bastien Nocera
2007-07-24 16:44 ` Bastien Nocera
2007-07-24 21:19 ` Marcel Holtmann
2007-07-24 21:54   ` Bastien Nocera
2007-07-25 13:43     ` Bastien Nocera [this message]
2007-07-25 14:06       ` Marcel Holtmann
2007-07-25 16:09   ` Bastien Nocera
2007-07-25 17:48     ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1185370981.3641.243.camel@cookie.hadess.net \
    --to=hadess@hadess.net \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox