After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 637690 - couple issues with bt menu
couple issues with bt menu
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Dan Winship
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-12-20 21:33 UTC by William Jon McCann
Modified: 2011-01-06 18:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
BluetoothMenu: hide the device separator if no devices are shown (2.35 KB, patch)
2010-12-21 15:30 UTC, Giovanni Campagna
none Details | Review
BluetoothStatus: move the sendto item to the bottom (2.25 KB, patch)
2010-12-21 15:31 UTC, Giovanni Campagna
committed Details | Review
BluetoothStatus: update only devices that actually changed (2.80 KB, patch)
2010-12-21 15:31 UTC, Giovanni Campagna
committed Details | Review
BluetoothStatus: hide the device separator if no devices are shown (1.04 KB, patch)
2010-12-23 17:45 UTC, Giovanni Campagna
committed Details | Review

Description William Jon McCann 2010-12-20 21:33:48 UTC
* Separator is shown when there are no devices in the section.  This is because updateFullMenu() is called after updateDevices().

* Seems we relaunch bluetooth-sendto each time the menu item is clicked.  We should re-present the existing tool.

* In other menus we keep the Settings menu item separate at the bottom but since we have so many separators already I think it may be fine not to have another one.

* Should we still offer Send Files to Device if I don't have any devices set up?  Maybe yes since it seems that the sendto tool lets me pick one.  When I do pick one is it saved in my devices list after it is used successfully?

* It seems that the devices-changed signal is emitted while the sendto tool is scanning for other devices on the network.  I'm not sure it makes sense to recompute our menus while that is occurring.  Is it really the same signal for devices that I have paired with vs. devices I can send to?
Comment 1 Giovanni Campagna 2010-12-21 14:16:52 UTC
(In reply to comment #0)
> * Separator is shown when there are no devices in the section.  This is because
> updateFullMenu() is called after updateDevices().

Ugh. Will fix.

> * Seems we relaunch bluetooth-sendto each time the menu item is clicked.  We
> should re-present the existing tool.

Bug in gnome-bluetooth, I suppose (should use GtkApplication / libunique-3)

> * In other menus we keep the Settings menu item separate at the bottom but
> since we have so many separators already I think it may be fine not to have
> another one.

So should devices be contiguous with the settings item?

> * Should we still offer Send Files to Device if I don't have any devices set
> up?  Maybe yes since it seems that the sendto tool lets me pick one.  When I do
> pick one is it saved in my devices list after it is used successfully?

Only if you pair with it. Devices shown on the menu are those that are trusted to automatically connect with you, and often you don't want this.
The behaviour is the same as bluetooth-applet.

> * It seems that the devices-changed signal is emitted while the sendto tool is
> scanning for other devices on the network.  I'm not sure it makes sense to
> recompute our menus while that is occurring.  Is it really the same signal for
> devices that I have paired with vs. devices I can send to?

bluetoothd adds temporarily the device to the list when it is interacting with it, but we cannot distinguish this "device-added" from other similar signals (neither at the dbus or at the applet layer).
Comment 2 Dan Winship 2010-12-21 14:51:28 UTC
(In reply to comment #1)
> > * It seems that the devices-changed signal is emitted while the sendto tool is
> > scanning for other devices on the network.  I'm not sure it makes sense to
> > recompute our menus while that is occurring.  Is it really the same signal for
> > devices that I have paired with vs. devices I can send to?
> 
> bluetoothd adds temporarily the device to the list when it is interacting with
> it, but we cannot distinguish this "device-added" from other similar signals
> (neither at the dbus or at the applet layer).

But rather than always destroying and rebuilding the menu, we could figure out the updated menu contents first, and then only actually destroy+rebuild if it's going to change.
Comment 3 Giovanni Campagna 2010-12-21 15:30:53 UTC
Created attachment 176831 [details] [review]
BluetoothMenu: hide the device separator if no devices are shown

When BluetoothApplet::show-full-menu property is notified (when you
switch from a disabled adapter / no adapter to an active one), we
would show all the menu, including the device separator, without
checking if any devices actually existed.
Comment 4 Giovanni Campagna 2010-12-21 15:31:10 UTC
Created attachment 176832 [details] [review]
BluetoothStatus: move the sendto item to the bottom

Kill one separator by merging all global actions items at the end
of the menu, which ends up divided in three sections: status,
devices and actions.
Comment 5 Giovanni Campagna 2010-12-21 15:31:19 UTC
Created attachment 176833 [details] [review]
BluetoothStatus: update only devices that actually changed

When receiving a "devices-changed" signal from BluetoothApplet,
check if some device item corresponds to an existing one, destroy
the remaining and add the new ones.
With this patch, signal emission when no device actually changed
(which happen due to bluetoothd creating temporary devices) result
in a no-op.
Comment 6 Dan Winship 2010-12-21 22:06:50 UTC
Comment on attachment 176831 [details] [review]
BluetoothMenu: hide the device separator if no devices are shown

>+        if (!this._hasDevices)
>+            this._deviceSep.hide();
>+        // in the other case (show_full_menu false, hasDevices true),
>+        // the menu must remain hidden

I don't understand this comment. Particularly, that code is executed whether show_full_menu is true or false.
Comment 7 Dan Winship 2010-12-21 22:10:00 UTC
Comment on attachment 176833 [details] [review]
BluetoothStatus: update only devices that actually changed

looks right
Comment 8 Giovanni Campagna 2010-12-23 17:45:08 UTC
(In reply to comment #6)
> (From update of attachment 176831 [details] [review])
> >+        if (!this._hasDevices)
> >+            this._deviceSep.hide();
> >+        // in the other case (show_full_menu false, hasDevices true),
> >+        // the menu must remain hidden
> 
> I don't understand this comment. Particularly, that code is executed whether
> show_full_menu is true or false.

I considered four cases:
show_full_menu true, hasDevices true => covered by showAll
show_full_menu false, hasDevices false => covered by hideAll
show_full_menu true, hasDevices false => specifically hiding deviceSep
so the only case not handled by code is show_full_menu false, hasDevices true (in which case deviceSep must remain hidden)
Anyway, I see that this comment just creates confusion, so I will remove it.
Comment 9 Giovanni Campagna 2010-12-23 17:45:58 UTC
Created attachment 176957 [details] [review]
BluetoothStatus: hide the device separator if no devices are shown

When BluetoothApplet::show-full-menu property is notified (when you
switch from a disabled adapter / no adapter to an active one), we
would show all the menu, including the device separator, without
checking if any devices actually existed.
Comment 10 Dan Winship 2011-01-06 17:26:28 UTC
Comment on attachment 176957 [details] [review]
BluetoothStatus: hide the device separator if no devices are shown

ah, i get it now. how about:

        if (this._applet.show_full_menu) {
            this._showAll(this._fullMenuItems);
            if (this._hasDevices)
              this._showAll(this._deviceItems);
            else
              this._deviceSep.hide();
        } else {
            this._hideAll(this._fullMenuItems);
            this._hideAll(this._deviceItems);
        }

? I think that makes it clearer. OK to commit like that
Comment 11 Giovanni Campagna 2011-01-06 18:49:11 UTC
Comment on attachment 176957 [details] [review]
BluetoothStatus: hide the device separator if no devices are shown

Pushed with your change.