public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHes] Better buttons in adapter properties
@ 2008-10-14 17:02 Bastien Nocera
  2008-10-14 22:57 ` David Sainty
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien Nocera @ 2008-10-14 17:02 UTC (permalink / raw)
  To: BlueZ development

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

Before:
http://img369.imageshack.us/my.php?image=screenshotbluetoothprefoa6.png
After:
http://img233.imageshack.us/my.php?image=screenshotbluetoothprefby0.png

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=465398 (No labels in
buttons)
http://bugzilla.gnome.org/show_bug.cgi?id=505606 (trust toggle button
appears/disappears)
And the discussion that were recently made on the list about having a
shorter dialogue for EeePCs.

[-- Attachment #2: 0001-Fixes-for-adapter-specific-buttons.patch --]
[-- Type: text/x-patch, Size: 4424 bytes --]

>From a394c15d8d1f904bbd4399aa2b7baf8db40d5b4c Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 14 Oct 2008 16:08:23 +0100
Subject: [PATCH] Fixes for adapter specific buttons

- Add labels to the adapter buttons, otherwise people
wonder what each one is for.

- Always show the buttons, just make sure they're
disabled if no devices is selected.

- Remove the difference in look for the extra buttons
---
 properties/adapter.c |   43 +++++++++++++------------------------------
 1 files changed, 13 insertions(+), 30 deletions(-)

diff --git a/properties/adapter.c b/properties/adapter.c
index 7ace35b..9de10e7 100644
--- a/properties/adapter.c
+++ b/properties/adapter.c
@@ -246,15 +246,8 @@ static void select_callback(GtkTreeSelection *selection, gpointer user_data)
 
 	update_buttons(adapter, paired, trusted, connected);
 
-	if (selected == TRUE) {
-		gtk_widget_show(adapter->button_disconnect);
-		gtk_widget_show(adapter->button_trusted);
-		gtk_widget_show(adapter->button_delete);
-	} else {
-		gtk_widget_hide(adapter->button_disconnect);
-		gtk_widget_hide(adapter->button_trusted);
-		gtk_widget_hide(adapter->button_delete);
-	}
+	gtk_widget_set_sensitive(adapter->button_trusted, selected);
+	gtk_widget_set_sensitive(adapter->button_delete, selected);
 }
 
 static void row_callback(GtkTreeModel *model, GtkTreePath  *path,
@@ -646,61 +639,51 @@ static void create_adapter(struct adapter_data *adapter)
 	gtk_box_set_homogeneous(GTK_BOX(buttonbox), FALSE);
 	gtk_box_pack_start(GTK_BOX(vbox), buttonbox, FALSE, FALSE, 0);
 
-	button = gtk_button_new();
+	button = gtk_button_new_with_label(_("Setup new device..."));
 	image = gtk_image_new_from_stock(GTK_STOCK_ADD,
 						GTK_ICON_SIZE_BUTTON);
-	gtk_container_add(GTK_CONTAINER(button), image);
-	gtk_container_set_border_width(GTK_CONTAINER(button), 0);
+	gtk_button_set_image(GTK_BUTTON(button), image);
 	gtk_box_pack_start(GTK_BOX(buttonbox), button, FALSE, FALSE, 0);
 
 	g_signal_connect(G_OBJECT(button), "clicked",
 				G_CALLBACK(wizard_callback), adapter);
 
-	button = gtk_button_new();
-	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
+	button = gtk_button_new_with_label(_("Disconnect"));
 	image = gtk_image_new_from_stock(GTK_STOCK_DISCONNECT,
 						GTK_ICON_SIZE_BUTTON);
-	gtk_container_add(GTK_CONTAINER(button), image);
-	gtk_container_set_border_width(GTK_CONTAINER(button), 0);
-	gtk_widget_set_no_show_all(button, TRUE);
-	gtk_widget_show(image);
+	gtk_button_set_image(GTK_BUTTON(button), image);
 	gtk_box_pack_end(GTK_BOX(buttonbox), button, FALSE, FALSE, 0);
 	gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(buttonbox),
 								button, TRUE);
+	gtk_widget_set_sensitive(button, FALSE);
 
 	g_signal_connect(G_OBJECT(button), "clicked",
 				G_CALLBACK(disconnect_callback), adapter);
 
 	adapter->button_disconnect = button;
 
-	button = gtk_button_new();
-	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
+	button = gtk_button_new_with_label(_("Add to Trusted"));
 	image = gtk_image_new_from_stock(GTK_STOCK_ABOUT,
 						GTK_ICON_SIZE_BUTTON);
-	gtk_container_add(GTK_CONTAINER(button), image);
-	gtk_container_set_border_width(GTK_CONTAINER(button), 0);
-	gtk_widget_set_no_show_all(button, TRUE);
-	gtk_widget_show(image);
+	gtk_button_set_image(GTK_BUTTON(button), image);
 	gtk_box_pack_end(GTK_BOX(buttonbox), button, FALSE, FALSE, 0);
 	gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(buttonbox),
 								button, TRUE);
+	gtk_widget_set_sensitive(button, FALSE);
 
 	g_signal_connect(G_OBJECT(button), "clicked",
 				G_CALLBACK(trusted_callback), adapter);
 
 	adapter->button_trusted = button;
 
-	button = gtk_button_new();
-	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
+	button = gtk_button_new_with_label(_("Delete"));
 	image = gtk_image_new_from_stock(GTK_STOCK_DELETE,
 						GTK_ICON_SIZE_BUTTON);
-	gtk_container_add(GTK_CONTAINER(button), image);
-	gtk_container_set_border_width(GTK_CONTAINER(button), 0);
-	gtk_widget_set_no_show_all(button, TRUE);
-	gtk_widget_show(image);
+	gtk_button_set_image(GTK_BUTTON(button), image);
 	gtk_box_pack_end(GTK_BOX(buttonbox), button, FALSE, FALSE, 0);
 	gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(buttonbox),
 								button, TRUE);
+	gtk_widget_set_sensitive(button, FALSE);
 
 	g_signal_connect(G_OBJECT(button), "clicked",
 				G_CALLBACK(delete_callback), adapter);
-- 
1.5.5.2


[-- Attachment #3: 0002-Move-the-adapter-button-list-to-the-side.patch --]
[-- Type: text/x-patch, Size: 2567 bytes --]

>From 161b2023faa95b6d777c3cbaac902365548babf3 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 14 Oct 2008 17:37:51 +0100
Subject: [PATCH] Move the adapter button list to the side

This makes the dialogue wider, rather than tall, which is
useful for computers with small displays.
---
 properties/adapter.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/properties/adapter.c b/properties/adapter.c
index 9de10e7..0174716 100644
--- a/properties/adapter.c
+++ b/properties/adapter.c
@@ -437,6 +437,7 @@ static void create_adapter(struct adapter_data *adapter)
 
 	GtkWidget *mainbox;
 	GtkWidget *vbox;
+	GtkWidget *table;
 	GtkWidget *label;
 	GtkWidget *image;
 	GtkWidget *button;
@@ -602,18 +603,20 @@ static void create_adapter(struct adapter_data *adapter)
 	g_signal_connect(G_OBJECT(entry), "focus-out-event",
 					G_CALLBACK(focus_callback), adapter);
 
-	vbox = gtk_vbox_new(FALSE, 6);
-	gtk_box_pack_start(GTK_BOX(mainbox), vbox, TRUE, TRUE, 0);
+	table = gtk_table_new(2, 2, FALSE);
+	gtk_box_pack_start(GTK_BOX(mainbox), table, TRUE, TRUE, 0);
 
 	label = create_label(_("Known devices"));
-	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
+	gtk_table_attach(GTK_TABLE(table), label, 0, 2, 0, 1,
+			 GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 6);
 
 	scrolled = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
 				GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled),
 							GTK_SHADOW_OUT);
-	gtk_container_add(GTK_CONTAINER(vbox), scrolled);
+	gtk_table_attach(GTK_TABLE(table), scrolled, 0, 1, 1, 2,
+			 GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 6, 6);
 
 	model = bluetooth_client_get_device_filter_model(client,
 				adapter->proxy, device_filter, NULL, NULL);
@@ -632,12 +635,13 @@ static void create_adapter(struct adapter_data *adapter)
 
 	gtk_container_add(GTK_CONTAINER(scrolled), tree);
 
-	buttonbox = gtk_hbutton_box_new();
+	buttonbox = gtk_vbutton_box_new();
 	gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox),
 						GTK_BUTTONBOX_START);
 	gtk_box_set_spacing(GTK_BOX(buttonbox), 6);
 	gtk_box_set_homogeneous(GTK_BOX(buttonbox), FALSE);
-	gtk_box_pack_start(GTK_BOX(vbox), buttonbox, FALSE, FALSE, 0);
+	gtk_table_attach(GTK_TABLE(table), buttonbox, 1, 2, 1, 2,
+			 GTK_FILL, GTK_FILL, 6, 6);
 
 	button = gtk_button_new_with_label(_("Setup new device..."));
 	image = gtk_image_new_from_stock(GTK_STOCK_ADD,
-- 
1.5.5.2


[-- Attachment #4: 0003-Fix-trust-button.patch --]
[-- Type: text/x-patch, Size: 1518 bytes --]

>From a99222b4c0b505f5a0fc2a564977bf3be71a6c86 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Tue, 14 Oct 2008 17:59:58 +0100
Subject: [PATCH] Fix trust button

The trust button toggles the trust for a device, so the label
should reflect the action to take when clicked. Changed the label
to "Trust"/"Distrust" to avoid the widgets moving about when
toggling the trust status.
---
 properties/adapter.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/properties/adapter.c b/properties/adapter.c
index 0174716..b744a20 100644
--- a/properties/adapter.c
+++ b/properties/adapter.c
@@ -216,6 +216,11 @@ static gboolean focus_callback(GtkWidget *editable,
 static void update_buttons(struct adapter_data *adapter, gboolean bonded,
 					gboolean trusted, gboolean connected)
 {
+	if (trusted) {
+		gtk_button_set_label(GTK_BUTTON(adapter->button_trusted), _("Distrust"));
+	} else {
+		gtk_button_set_label(GTK_BUTTON(adapter->button_trusted), _("Trust"));
+	}
 	gtk_widget_set_sensitive(adapter->button_delete, bonded);
 	gtk_widget_set_sensitive(adapter->button_disconnect, connected);
 }
@@ -666,7 +671,7 @@ static void create_adapter(struct adapter_data *adapter)
 
 	adapter->button_disconnect = button;
 
-	button = gtk_button_new_with_label(_("Add to Trusted"));
+	button = gtk_button_new_with_label(_("Trust"));
 	image = gtk_image_new_from_stock(GTK_STOCK_ABOUT,
 						GTK_ICON_SIZE_BUTTON);
 	gtk_button_set_image(GTK_BUTTON(button), image);
-- 
1.5.5.2


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

* Re: [PATCHes] Better buttons in adapter properties
  2008-10-14 17:02 [PATCHes] Better buttons in adapter properties Bastien Nocera
@ 2008-10-14 22:57 ` David Sainty
  2008-10-14 23:04   ` Bastien Nocera
  0 siblings, 1 reply; 7+ messages in thread
From: David Sainty @ 2008-10-14 22:57 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: BlueZ development

Bastien Nocera wrote:
> Before:
> http://img369.imageshack.us/my.php?image=screenshotbluetoothprefoa6.png
> After:
> http://img233.imageshack.us/my.php?image=screenshotbluetoothprefby0.png
>
> Fixes:
> https://bugzilla.redhat.com/show_bug.cgi?id=465398 (No labels in
> buttons)
> http://bugzilla.gnome.org/show_bug.cgi?id=505606 (trust toggle button
> appears/disappears)
> And the discussion that were recently made on the list about having a
> shorter dialogue for EeePCs.
>   
It's an improvement.  I've attached what it looks like (in relatively 
stock EeePC 701 environment).

It's still too tall to see the Delete button and the Close button 
without dragging the window up and down.

Of course, it's not the only thing that produces windows too tall for 
this display :)



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

* Re: [PATCHes] Better buttons in adapter properties
  2008-10-14 22:57 ` David Sainty
@ 2008-10-14 23:04   ` Bastien Nocera
  2008-10-14 23:25     ` David Sainty
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien Nocera @ 2008-10-14 23:04 UTC (permalink / raw)
  To: David Sainty; +Cc: BlueZ development

On Wed, 2008-10-15 at 11:57 +1300, David Sainty wrote:
> Bastien Nocera wrote:
> > Before:
> > http://img369.imageshack.us/my.php?image=screenshotbluetoothprefoa6.png
> > After:
> > http://img233.imageshack.us/my.php?image=screenshotbluetoothprefby0.png
> >
> > Fixes:
> > https://bugzilla.redhat.com/show_bug.cgi?id=465398 (No labels in
> > buttons)
> > http://bugzilla.gnome.org/show_bug.cgi?id=505606 (trust toggle button
> > appears/disappears)
> > And the discussion that were recently made on the list about having a
> > shorter dialogue for EeePCs.
> >   
> It's an improvement.  I've attached what it looks like (in relatively 
> stock EeePC 701 environment).

You haven't attached anything :) I would recommend Evolution's
attachment reminder plugin :)

> It's still too tall to see the Delete button and the Close button 
> without dragging the window up and down.
> 
> Of course, it's not the only thing that produces windows too tall for 
> this display :)

There might be some spacing issue still, as well as a too high default
size. What's the size of the display on the EeePC again?


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

* Re: [PATCHes] Better buttons in adapter properties
  2008-10-14 23:04   ` Bastien Nocera
@ 2008-10-14 23:25     ` David Sainty
  2008-10-15 22:06       ` Bastien Nocera
  0 siblings, 1 reply; 7+ messages in thread
From: David Sainty @ 2008-10-14 23:25 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: BlueZ development

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

Bastien Nocera wrote:
> You haven't attached anything :) I would recommend Evolution's
> attachment reminder plugin :)
>
>   

Huh!  It previewed with it attached...  I think it's a Thunderbird 
feature.  Oh yeah, I attached it inline and Thunderbird stripped the 
image out when I sent the email in text :)  Amusing.  Oh look, and I've 
already deleted the image from my file system too.

Lets try again...

>> It's still too tall to see the Delete button and the Close button 
>> without dragging the window up and down.
>>
>> Of course, it's not the only thing that produces windows too tall for 
>> this display :)
>>     
>
> There might be some spacing issue still, as well as a too high default
> size. What's the size of the display on the EeePC again?
>   
800x480 full screen.  But the standard window manager decorations on the 
EeePC make anything taller than 422 pixels start to not fit.

[-- Attachment #2: shot.gif --]
[-- Type: image/gif, Size: 25492 bytes --]

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

* Re: [PATCHes] Better buttons in adapter properties
  2008-10-14 23:25     ` David Sainty
@ 2008-10-15 22:06       ` Bastien Nocera
  2008-10-23  4:57         ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien Nocera @ 2008-10-15 22:06 UTC (permalink / raw)
  To: David Sainty; +Cc: BlueZ development

On Wed, 2008-10-15 at 12:25 +1300, David Sainty wrote:
<snip>
> 800x480 full screen.  But the standard window manager decorations on the 
> EeePC make anything taller than 422 pixels start to not fit.

I think we can easily reduce the space taken by the visibility and
friendly name sections. I'll try to get a patch ready tomorrow.

Cheers


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

* Re: [PATCHes] Better buttons in adapter properties
  2008-10-15 22:06       ` Bastien Nocera
@ 2008-10-23  4:57         ` Marcel Holtmann
  2008-10-23  9:12           ` Bastien Nocera
  0 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2008-10-23  4:57 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: David Sainty, BlueZ development

Hi Bastien,

> > 800x480 full screen.  But the standard window manager decorations on the 
> > EeePC make anything taller than 422 pixels start to not fit.
> 
> I think we can easily reduce the space taken by the visibility and
> friendly name sections. I'll try to get a patch ready tomorrow.

any updates here that I might have missed?

Regards

Marcel



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

* Re: [PATCHes] Better buttons in adapter properties
  2008-10-23  4:57         ` Marcel Holtmann
@ 2008-10-23  9:12           ` Bastien Nocera
  0 siblings, 0 replies; 7+ messages in thread
From: Bastien Nocera @ 2008-10-23  9:12 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ development

On Thu, 2008-10-23 at 06:57 +0200, Marcel Holtmann wrote:
> Hi Bastien,
> 
> > > 800x480 full screen.  But the standard window manager decorations on the 
> > > EeePC make anything taller than 422 pixels start to not fit.
> > 
> > I think we can easily reduce the space taken by the visibility and
> > friendly name sections. I'll try to get a patch ready tomorrow.
> 
> any updates here that I might have missed?

Not since my rant about the discoverable preferences. The patched
version doesn't take any more space than the current layout, and fixes
discovery problems with the labels, so I would urge you to merge it.

I'll try to have a patch ready for squeezing the rest of the UI when
I've had more of a think about it.

Cheers

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

end of thread, other threads:[~2008-10-23  9:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-14 17:02 [PATCHes] Better buttons in adapter properties Bastien Nocera
2008-10-14 22:57 ` David Sainty
2008-10-14 23:04   ` Bastien Nocera
2008-10-14 23:25     ` David Sainty
2008-10-15 22:06       ` Bastien Nocera
2008-10-23  4:57         ` Marcel Holtmann
2008-10-23  9:12           ` Bastien Nocera

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