public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] [PATCH] Implement browse callback in the applet
@ 2007-07-24 16:38 Bastien Nocera
  2007-07-24 16:44 ` Bastien Nocera
  2007-07-24 21:19 ` Marcel Holtmann
  0 siblings, 2 replies; 8+ messages in thread
From: Bastien Nocera @ 2007-07-24 16:38 UTC (permalink / raw)
  To: BlueZ Hackers

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

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.

-- 
Bastien Nocera <hadess@hadess.net> 

[-- Attachment #2: bluez-gnome-implement-browse-callback.patch --]
[-- Type: text/x-patch, Size: 4140 bytes --]

Index: applet/Makefile.am
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/Makefile.am,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile.am
--- applet/Makefile.am	22 Jul 2007 16:06:05 -0000	1.19
+++ applet/Makefile.am	24 Jul 2007 16:35:28 -0000
@@ -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
diff -u -p -r1.67 main.c
--- applet/main.c	24 Jul 2007 15:19:33 -0000	1.67
+++ applet/main.c	24 Jul 2007 16:35:29 -0000
@@ -47,6 +47,8 @@
 #include <libnotify/notify.h>
 #endif
 
+#include "device-selector.h"
+
 #define PASSKEY_AGENT_PATH	"/org/bluez/passkey"
 #define AUTH_AGENT_PATH		"/org/bluez/auth"
 
@@ -1229,6 +1231,7 @@ static char *get_form_factor(void)
 
 	return formfactor;
 }
+
 static void adapter_setup(gpointer data, gpointer user_data)
 {
 	struct adapter_data *adapter = data;
@@ -1481,8 +1484,53 @@ static void settings_callback(GObject *w
 		g_printerr("Couldn't execute command: %s\n", command);
 }
 
+static void device_selected_callback(GObject *object, GParamSpec *spec, gpointer user_data)
+{
+	GtkDialog *dialog = user_data;
+	char *address;
+
+	g_object_get(object, "device-selected", &address, NULL);
+	gtk_dialog_set_response_sensitive(dialog, GTK_RESPONSE_ACCEPT, address != NULL);
+	g_free(address);
+}
+
 static void browse_callback(GObject *widget, gpointer user_data)
 {
+	GtkWidget *dialog, *selector;
+	char *address, *command;
+
+	dialog = gtk_dialog_new_with_buttons(_("Browse devices"),
+					     NULL,
+					     GTK_DIALOG_NO_SEPARATOR,
+					     GTK_STOCK_CANCEL,
+					     GTK_RESPONSE_REJECT,
+					     GTK_STOCK_CONNECT,
+					     GTK_RESPONSE_ACCEPT,
+					     NULL);
+	gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT, FALSE);
+	gtk_window_set_default_size(GTK_WINDOW(dialog), 400, 300);
+
+	/* Add the selector widget */
+	selector = bluetooth_device_selector_new(_("Select device to browse."));
+	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), selector);
+	gtk_widget_show(selector);
+	g_signal_connect(selector, "notify::device-selected",
+			 G_CALLBACK(device_selected_callback), dialog);
+
+	if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_ACCEPT) {
+		gtk_widget_destroy(dialog);
+		return;
+	}
+
+	g_object_get(selector, "device-selected", &address, NULL);
+	gtk_widget_destroy(dialog);
+
+	command = g_strdup_printf("nautilus --no-default-window \"obex://[%s]\"", address);
+	g_free(address);
+
+	if (!g_spawn_command_line_async(command, NULL))
+		g_printerr(_("Couldn't execute command: %s\n"), command);
+	g_free(command);
 }
 
 #if 0
@@ -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);
@@ -1534,9 +1586,6 @@ static void popup_callback(GObject *widg
 	gtk_widget_show(item);
 	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
 
-	gtk_widget_set_sensitive(item, obexftp_available() &&
-						attached_adapters() > 0);
-
 #if 0
 	item = gtk_separator_menu_item_new();
 	gtk_widget_show(item);
@@ -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(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);

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] [PATCH] Implement browse callback in the applet
  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
  1 sibling, 0 replies; 8+ messages in thread
From: Bastien Nocera @ 2007-07-24 16:44 UTC (permalink / raw)
  To: BlueZ development

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

On Tue, 2007-07-24 at 17:38 +0100, Bastien Nocera wrote:
<snip>
> It also fixes a popup menu being created _each time_ someone
> right-clicks on the bluetooth applet.

Updated version with the above fixed properly.

-- 
Bastien Nocera <hadess@hadess.net> 

[-- Attachment #2: bluez-gnome-implement-browse-callback-2.patch --]
[-- Type: text/x-patch, Size: 4519 bytes --]

Index: Makefile.am
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/Makefile.am,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile.am
--- Makefile.am	22 Jul 2007 16:06:05 -0000	1.19
+++ Makefile.am	24 Jul 2007 16:43:25 -0000
@@ -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
diff -u -p -r1.67 main.c
--- main.c	24 Jul 2007 15:19:33 -0000	1.67
+++ main.c	24 Jul 2007 16:43:26 -0000
@@ -47,6 +47,8 @@
 #include <libnotify/notify.h>
 #endif
 
+#include "device-selector.h"
+
 #define PASSKEY_AGENT_PATH	"/org/bluez/passkey"
 #define AUTH_AGENT_PATH		"/org/bluez/auth"
 
@@ -1229,6 +1231,7 @@ static char *get_form_factor(void)
 
 	return formfactor;
 }
+
 static void adapter_setup(gpointer data, gpointer user_data)
 {
 	struct adapter_data *adapter = data;
@@ -1481,8 +1484,53 @@ static void settings_callback(GObject *w
 		g_printerr("Couldn't execute command: %s\n", command);
 }
 
+static void device_selected_callback(GObject *object, GParamSpec *spec, gpointer user_data)
+{
+	GtkDialog *dialog = user_data;
+	char *address;
+
+	g_object_get(object, "device-selected", &address, NULL);
+	gtk_dialog_set_response_sensitive(dialog, GTK_RESPONSE_ACCEPT, address != NULL);
+	g_free(address);
+}
+
 static void browse_callback(GObject *widget, gpointer user_data)
 {
+	GtkWidget *dialog, *selector;
+	char *address, *command;
+
+	dialog = gtk_dialog_new_with_buttons(_("Browse devices"),
+					     NULL,
+					     GTK_DIALOG_NO_SEPARATOR,
+					     GTK_STOCK_CANCEL,
+					     GTK_RESPONSE_REJECT,
+					     GTK_STOCK_CONNECT,
+					     GTK_RESPONSE_ACCEPT,
+					     NULL);
+	gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT, FALSE);
+	gtk_window_set_default_size(GTK_WINDOW(dialog), 400, 300);
+
+	/* Add the selector widget */
+	selector = bluetooth_device_selector_new(_("Select device to browse."));
+	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), selector);
+	gtk_widget_show(selector);
+	g_signal_connect(selector, "notify::device-selected",
+			 G_CALLBACK(device_selected_callback), dialog);
+
+	if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_ACCEPT) {
+		gtk_widget_destroy(dialog);
+		return;
+	}
+
+	g_object_get(selector, "device-selected", &address, NULL);
+	gtk_widget_destroy(dialog);
+
+	command = g_strdup_printf("nautilus --no-default-window \"obex://[%s]\"", address);
+	g_free(address);
+
+	if (!g_spawn_command_line_async(command, NULL))
+		g_printerr(_("Couldn't execute command: %s\n"), command);
+	g_free(command);
 }
 
 #if 0
@@ -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);

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] [PATCH] Implement browse callback in the applet
  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 16:09   ` Bastien Nocera
  1 sibling, 2 replies; 8+ messages in thread
From: Marcel Holtmann @ 2007-07-24 21:19 UTC (permalink / raw)
  To: BlueZ development

Hi Bastien,

> 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
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] [PATCH] Implement browse callback in the applet
  2007-07-24 21:19 ` Marcel Holtmann
@ 2007-07-24 21:54   ` Bastien Nocera
  2007-07-25 13:43     ` Bastien Nocera
  2007-07-25 16:09   ` Bastien Nocera
  1 sibling, 1 reply; 8+ messages in thread
From: Bastien Nocera @ 2007-07-24 21:54 UTC (permalink / raw)
  To: BlueZ development

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

On Tue, 2007-07-24 at 23:19 +0200, Marcel Holtmann wrote:
> Hi Bastien,
> 
> > 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.

-- 
Bastien Nocera <hadess@hadess.net> 

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

Index: main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/main.c,v
retrieving revision 1.67
diff -u -p -r1.67 main.c
--- main.c	24 Jul 2007 15:19:33 -0000	1.67
+++ main.c	24 Jul 2007 16:43:26 -0000
@@ -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);

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] [PATCH] Implement browse callback in the applet
  2007-07-24 21:54   ` Bastien Nocera
@ 2007-07-25 13:43     ` Bastien Nocera
  2007-07-25 14:06       ` Marcel Holtmann
  0 siblings, 1 reply; 8+ messages in thread
From: Bastien Nocera @ 2007-07-25 13:43 UTC (permalink / raw)
  To: BlueZ development

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] [PATCH] Implement browse callback in the applet
  2007-07-25 13:43     ` Bastien Nocera
@ 2007-07-25 14:06       ` Marcel Holtmann
  0 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2007-07-25 14:06 UTC (permalink / raw)
  To: BlueZ development

Hi Bastien,

> > 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
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] [PATCH] Implement browse callback in the applet
  2007-07-24 21:19 ` Marcel Holtmann
  2007-07-24 21:54   ` Bastien Nocera
@ 2007-07-25 16:09   ` Bastien Nocera
  2007-07-25 17:48     ` Marcel Holtmann
  1 sibling, 1 reply; 8+ messages in thread
From: Bastien Nocera @ 2007-07-25 16:09 UTC (permalink / raw)
  To: BlueZ development

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

On Tue, 2007-07-24 at 23:19 +0200, Marcel Holtmann wrote:
> Hi Bastien,
> 
> > 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.

-- 
Bastien Nocera <hadess@hadess.net> 

[-- Attachment #2: bluez-gnome-implement-browse-callback-3.patch --]
[-- Type: text/x-patch, Size: 2790 bytes --]

Index: applet/Makefile.am
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/Makefile.am,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile.am
--- applet/Makefile.am	22 Jul 2007 16:06:05 -0000	1.19
+++ applet/Makefile.am	25 Jul 2007 15:49:12 -0000
@@ -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
diff -u -p -r1.70 main.c
--- applet/main.c	25 Jul 2007 14:03:50 -0000	1.70
+++ applet/main.c	25 Jul 2007 15:49:13 -0000
@@ -48,6 +48,8 @@
 #include <libnotify/notify.h>
 #endif
 
+#include "bluetooth-device-selection.h"
+
 #define PASSKEY_AGENT_PATH	"/org/bluez/passkey"
 #define AUTH_AGENT_PATH		"/org/bluez/auth"
 
@@ -1486,8 +1525,50 @@ static void settings_callback(GObject *w
 		g_printerr("Couldn't execute command: %s\n", command);
 }
 
+static void selected_device_changed(BluetoothDeviceSelection *sel, gchar *address, gpointer user_data)
+{
+	GtkDialog *dialog = user_data;
+
+	gtk_dialog_set_response_sensitive(dialog, GTK_RESPONSE_ACCEPT, address != NULL);
+}
+
 static void browse_callback(GObject *widget, gpointer user_data)
 {
+	GtkWidget *dialog, *selector;
+	char *address, *command;
+
+	dialog = gtk_dialog_new_with_buttons(_("Browse devices"),
+					     NULL,
+					     GTK_DIALOG_NO_SEPARATOR,
+					     GTK_STOCK_CANCEL,
+					     GTK_RESPONSE_REJECT,
+					     GTK_STOCK_CONNECT,
+					     GTK_RESPONSE_ACCEPT,
+					     NULL);
+	gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT, FALSE);
+	gtk_window_set_default_size(GTK_WINDOW(dialog), 400, 300);
+
+	/* Add the selector widget */
+	selector = bluetooth_device_selection_new(_("Select device to browse."));
+	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), selector);
+	gtk_widget_show(selector);
+	g_signal_connect(selector, "selected-device-changed",
+			 G_CALLBACK(selected_device_changed), dialog);
+
+	if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_ACCEPT) {
+		gtk_widget_destroy(dialog);
+		return;
+	}
+
+	g_object_get(selector, "device-selected", &address, NULL);
+	gtk_widget_destroy(dialog);
+
+	command = g_strdup_printf("nautilus --no-default-window \"obex://[%s]\"", address);
+	g_free(address);
+
+	if (!g_spawn_command_line_async(command, NULL))
+		g_printerr(_("Couldn't execute command: %s\n"), command);
+	g_free(command);
 }
 
 #if 0

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Bluez-devel] [PATCH] Implement browse callback in the applet
  2007-07-25 16:09   ` Bastien Nocera
@ 2007-07-25 17:48     ` Marcel Holtmann
  0 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2007-07-25 17:48 UTC (permalink / raw)
  To: BlueZ development

Hi Bastien,

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

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
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-07-25 17:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-07-25 14:06       ` Marcel Holtmann
2007-07-25 16:09   ` Bastien Nocera
2007-07-25 17:48     ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox