Skip to contentSkip to conversation

Implement browse callback in the applet

PATCH In review Bastien Nocera 2 participants 8 messages Jul 24, 2007 – Jul 25, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Implement browse callback in the applet

The patch implements the browse callback for the applet. It hardcodes the use of nautilus, but we should probably also check for nautilus in the obexftp_available().

It also fixes a popup menu being created _each time_ someone right-clicks on the bluetooth applet.

Signature · 1 line
Bastien Nocera <[email protected]> 

Index: applet/Makefile.am
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/Makefile.am,v retrieving revision 1.19

Makefile.am +2 -1
diff -u -p -r1.19 Makefile.am
@@ -4,7 +4,8 @@ bin_PROGRAMS = bluetooth-applet
 bluetooth_applet_SOURCES = main.c
 
 bluetooth_applet_LDADD = @NOTIFY_LIBS@ @GCONF_LIBS@ \
-		@GTK_LIBS@ @HAL_LIBS@ @DBUS_LIBS@
+		@GTK_LIBS@ @HAL_LIBS@ @DBUS_LIBS@ \
+		$(top_builddir)/common/libcommon.a
 
 nodist_bluetooth_applet_SOURCES = \
 		$(top_builddir)/common/passkey-agent-glue.h \

Index: applet/main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/main.c,v
retrieving revision 1.67

main.c +57 -4

101 lines not on this page · raw message

-------------------------------------------------------------------------
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/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#1 lore raw

On Tue, 2007-07-24 at 17:38 +0100, Bastien Nocera wrote:
<snip>

Quoted 2 lines

It also fixes a popup menu being created _each time_ someone right-clicks on the bluetooth applet.

Updated version with the above fixed properly.

Signature · 1 line
Bastien Nocera <[email protected]> 

Index: Makefile.am
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/Makefile.am,v retrieving revision 1.19

Makefile.am +2 -1
diff -u -p -r1.19 Makefile.am
@@ -4,7 +4,8 @@ bin_PROGRAMS = bluetooth-applet
 bluetooth_applet_SOURCES = main.c
 
 bluetooth_applet_LDADD = @NOTIFY_LIBS@ @GCONF_LIBS@ \
-		@GTK_LIBS@ @HAL_LIBS@ @DBUS_LIBS@
+		@GTK_LIBS@ @HAL_LIBS@ @DBUS_LIBS@ \
+		$(top_builddir)/common/libcommon.a
 
 nodist_bluetooth_applet_SOURCES = \
 		$(top_builddir)/common/passkey-agent-glue.h \

Index: main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/main.c,v
retrieving revision 1.67

main.c +61 -8

110 lines not on this page · raw message

-------------------------------------------------------------------------
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/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#2 lore raw
In reply to Bastien Nocera

Hi Bastien,

Quoted 6 lines

The patch implements the browse callback for the applet. It hardcodes the use of nautilus, but we should probably also check for nautilus in the obexftp_available().

It also fixes a popup menu being created _each time_ someone right-clicks on the bluetooth applet.

can you split this into two patches. They are both two independent things.

Regards

Marcel

-------------------------------------------------------------------------
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/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#3 lore raw
Quoted 11 lines · Marcel Holtmann

Hi Bastien,

Quoted 6 lines

The patch implements the browse callback for the applet. It hardcodes the use of nautilus, but we should probably also check for nautilus in the obexftp_available().

It also fixes a popup menu being created _each time_ someone right-clicks on the bluetooth applet.

can you split this into two patches. They are both two independent things.

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.

Signature · 1 line
Bastien Nocera <[email protected]> 

Index: main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/main.c,v
retrieving revision 1.67

main.c +13 -8
diff -u -p -r1.67 main.c
@@ -1507,9 +1555,13 @@ static void activate_callback(GObject *w
 static void popup_callback(GObject *widget, guint button,
 				guint activate_time, gpointer user_data)
 {
-	GtkWidget *menu;
+	static GtkWidget *menu = NULL;
+	static GtkWidget *browse_item = NULL;
 	GtkWidget *item;
 
+	if (menu != NULL)
+		goto popup;
+
 	menu = gtk_menu_new();
 
 	item = gtk_image_menu_item_new_from_stock(GTK_STOCK_PREFERENCES, NULL);
@@ -1528,14 +1580,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();
@@ -1549,6 +1598,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);

-------------------------------------------------------------------------
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/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#4 lore raw
Quoted 1 line · Bastien Nocera

On Tue, 2007-07-24 at 23:19 +0200, Marcel Holtmann wrote:

<snip>

Quoted 2 lines

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.

Signature · 1 line
Bastien Nocera <[email protected]> 

Index: main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/main.c,v
retrieving revision 1.69

main.c +18 -8
diff -u -p -r1.69 main.c
@@ -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();
 

-------------------------------------------------------------------------
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/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#5 lore raw

Hi Bastien,

Quoted 5 lines
Quoted 2 lines

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.

slightly modified patch applied, but the result is the same.

Regards

Marcel

-------------------------------------------------------------------------
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/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#6 lore raw
In reply to Marcel Holtmann
Quoted 11 lines · Marcel Holtmann

Hi Bastien,

Quoted 6 lines

The patch implements the browse callback for the applet. It hardcodes the use of nautilus, but we should probably also check for nautilus in the obexftp_available().

It also fixes a popup menu being created _each time_ someone right-clicks on the bluetooth applet.

can you split this into two patches. They are both two independent things.

And the left-over of that patch. Uses the new functionality from the BluetoothDeviceSelection widget.

Signature · 1 line
Bastien Nocera <[email protected]> 

Index: applet/Makefile.am
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/Makefile.am,v retrieving revision 1.19

Makefile.am +2 -1
diff -u -p -r1.19 Makefile.am
@@ -4,7 +4,8 @@ bin_PROGRAMS = bluetooth-applet
 bluetooth_applet_SOURCES = main.c
 
 bluetooth_applet_LDADD = @NOTIFY_LIBS@ @GCONF_LIBS@ \
-		@GTK_LIBS@ @HAL_LIBS@ @DBUS_LIBS@
+		@GTK_LIBS@ @HAL_LIBS@ @DBUS_LIBS@ \
+		$(top_builddir)/common/libcommon.a
 
 nodist_bluetooth_applet_SOURCES = \
 		$(top_builddir)/common/passkey-agent-glue.h \

Index: applet/main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/main.c,v
retrieving revision 1.70

main.c +44 -0

58 lines not on this page · raw message

-------------------------------------------------------------------------
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/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#7 lore raw

Hi Bastien,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The patch implements the browse callback for the applet. It hardcodes the use of nautilus, but we should probably also check for nautilus in the obexftp_available().

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

It also fixes a popup menu being created _each time_ someone right-clicks on the bluetooth applet.

can you split this into two patches. They are both two independent things.

And the left-over of that patch. Uses the new functionality from the BluetoothDeviceSelection widget.

the patch is in the CVS now. Thanks.

Regards

Marcel

-------------------------------------------------------------------------
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/
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel