linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Gollub <dgollub@suse.de>
To: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] bluez-gnome: No GUI way to switch from "off" mode
Date: Mon, 30 Apr 2007 21:38:18 +0200	[thread overview]
Message-ID: <200704302138.18170.dgollub@suse.de> (raw)
In-Reply-To: <1177946201.5443.59.camel@hammer.suse.cz>

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

On Monday 30 April 2007 17:16:41 Stanislav Brabec wrote:
> Hallo.
>
> I am just curious, whether no chance to enable Bluetooth from the GNOME
> Bluetooth is deliberate or not. I guess, that it is not deliberate.
Not quite sure if this was intended or not ... attachted is the suggested 
change by Stanislav.

best regards,
Daniel

[-- Attachment #2: bluez-gnome_modeoff.diff --]
[-- Type: text/x-diff, Size: 3205 bytes --]

? properties/.deps
? properties/Makefile
? properties/Makefile.in
? properties/bluetooth-properties
? properties/bluetooth-properties.desktop
Index: properties/main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/properties/main.c,v
retrieving revision 1.33
diff -u -p -r1.33 main.c
--- properties/main.c	26 Feb 2007 10:46:50 -0000	1.33
+++ properties/main.c	30 Apr 2007 19:37:59 -0000
@@ -757,6 +757,7 @@ struct adapter_data {
 	char *path;
 	int attached;
 	GtkWidget *child;
+	GtkWidget *button_off;
 	GtkWidget *button_connect;
 	GtkWidget *button_visible;
 	GtkWidget *timeout_label;
@@ -817,6 +818,9 @@ static void mode_callback(GtkWidget *but
 	} else if (button == adapter->button_visible) {
 		sensitive = TRUE;
 		mode = "discoverable";
+	} else if (button == adapter->button_off) {
+		sensitive = FALSE;
+		mode = "off";
 	} else
 		return;
 
@@ -981,14 +985,26 @@ static void create_adapter(struct adapte
 	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
 
 	button = gtk_radio_button_new_with_label(group,
-					_("Other devices can connect"));
+					_("Off. No devices can connect"));
 
 	group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
 
 	gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
 
 	if (mode && !strcmp(mode, "off"))
-		gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
+
+	adapter->button_off = button;
+
+	g_signal_connect(G_OBJECT(button), "toggled",
+					G_CALLBACK(mode_callback), adapter);
+
+	button = gtk_radio_button_new_with_label(group,
+					_("Other devices can connect"));
+
+	group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button));
+
+	gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
 
 	if (mode && !strcmp(mode, "connectable"))
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
@@ -1005,9 +1021,6 @@ static void create_adapter(struct adapte
 
 	gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
 
-	if (mode && !strcmp(mode, "off"))
-		gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
-
 	if (mode && !strcmp(mode, "discoverable"))
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
 
@@ -1125,15 +1138,14 @@ static void mode_changed(DBusGProxy *obj
 	if (list && list->data) {
 		struct adapter_data *adapter = list->data;
 		GtkWidget *button = NULL;
-		gboolean sensitive;
+		gboolean sensitive = TRUE;
 
 		if (!adapter->attached)
 			return;
 
-		sensitive = strcmp(mode, "off") ? TRUE : FALSE;
-
 		gtk_widget_set_sensitive(GTK_WIDGET(adapter->button_connect), sensitive);
 		gtk_widget_set_sensitive(GTK_WIDGET(adapter->button_visible), sensitive);
+		gtk_widget_set_sensitive(GTK_WIDGET(adapter->button_off), sensitive);
 
 		if (!strcmp(mode, "connectable")) {
 			sensitive = FALSE;
@@ -1141,6 +1153,9 @@ static void mode_changed(DBusGProxy *obj
 		} else if (!strcmp(mode, "discoverable")) {
 			sensitive = TRUE;
 			button = adapter->button_visible;
+		} else if (!strcmp(mode, "off")) {
+			sensitive = FALSE;
+			button = adapter->button_off;
 		}
 
 		gtk_widget_set_sensitive(GTK_WIDGET(adapter->timeout_label), sensitive);

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

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

[-- 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-04-30 19:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-30 15:16 [Bluez-devel] bluez-gnome: No GUI way to switch from "off" mode Stanislav Brabec
2007-04-30 19:38 ` Daniel Gollub [this message]
2007-05-03 17:25   ` Stanislav Brabec
2007-05-03 23:32     ` Bastien Nocera
2007-05-04  6:45       ` 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=200704302138.18170.dgollub@suse.de \
    --to=dgollub@suse.de \
    --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;
as well as URLs for NNTP newsgroup(s).