Merge lp:~binli/ubuntu/trusty/unity-control-center/unity-control-center.lp1248720-block-power-callback-unless-its-triggered-by-user into lp:unity-control-center/14.04

Proposed by Bin Li
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 12783
Merged at revision: 12783
Proposed branch: lp:~binli/ubuntu/trusty/unity-control-center/unity-control-center.lp1248720-block-power-callback-unless-its-triggered-by-user
Merge into: lp:unity-control-center/14.04
Diff against target: 87 lines (+26/-0)
2 files modified
debian/changelog (+7/-0)
panels/bluetooth/cc-bluetooth-panel.c (+19/-0)
To merge this branch: bzr merge lp:~binli/ubuntu/trusty/unity-control-center/unity-control-center.lp1248720-block-power-callback-unless-its-triggered-by-user
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Review via email: mp+270924@code.launchpad.net

Description of the change

Cheery pick from lp:unity-control-center.

To post a comment you must log in.
Revision history for this message
Bin Li (binli) wrote :

revno: 12815 [merge]
author: Yu Ning <email address hidden>
committer: CI Train Bot <email address hidden>
branch nick: unity-control-center
timestamp: Fri 2015-04-10 14:09:34 +0000
message:
  Block power callback unless it's triggered by the user. Fixes: #1248720
  Approved by: Sebastien Bacher, Lars Uebernickel

Revision history for this message
Sebastien Bacher (seb128) wrote :

thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2015-07-27 16:23:21 +0000
+++ debian/changelog 2015-09-14 05:56:00 +0000
@@ -1,3 +1,10 @@
1unity-control-center (14.04.3+14.04.20140922-0ubuntu1.2) UNRELEASED; urgency=medium
2
3 [ Ning Yu ]
4 * Block power callback unless it's triggered by the user.(LP: #1248720)
5
6 -- Bin Li <bin.li@canonical.com> Mon, 14 Sep 2015 12:13:16 +0800
7
1unity-control-center (14.04.3+14.04.20140922-0ubuntu1.1) trusty; urgency=medium8unity-control-center (14.04.3+14.04.20140922-0ubuntu1.1) trusty; urgency=medium
29
3 [ Jian-Ding Chen (timchen119) ]10 [ Jian-Ding Chen (timchen119) ]
411
=== modified file 'panels/bluetooth/cc-bluetooth-panel.c'
--- panels/bluetooth/cc-bluetooth-panel.c 2014-02-20 22:57:03 +0000
+++ panels/bluetooth/cc-bluetooth-panel.c 2015-09-14 05:56:00 +0000
@@ -58,6 +58,8 @@
58 GHashTable *connecting_devices;58 GHashTable *connecting_devices;
59 GCancellable *cancellable;59 GCancellable *cancellable;
60 GSettings *indicator_settings;60 GSettings *indicator_settings;
61
62 gulong power_callback_handler_id;
61};63};
6264
63static void cc_bluetooth_panel_finalize (GObject *object);65static void cc_bluetooth_panel_finalize (GObject *object);
@@ -420,8 +422,12 @@
420422
421 state = gtk_switch_get_active (GTK_SWITCH (WID ("switch_bluetooth")));423 state = gtk_switch_get_active (GTK_SWITCH (WID ("switch_bluetooth")));
422 g_debug ("Power switched to %s", state ? "on" : "off");424 g_debug ("Power switched to %s", state ? "on" : "off");
425 g_signal_handler_block (G_OBJECT (WID ("switch_bluetooth")),
426 self->priv->power_callback_handler_id);
423 bluetooth_killswitch_set_state (self->priv->killswitch,427 bluetooth_killswitch_set_state (self->priv->killswitch,
424 state ? BLUETOOTH_KILLSWITCH_STATE_UNBLOCKED : BLUETOOTH_KILLSWITCH_STATE_SOFT_BLOCKED);428 state ? BLUETOOTH_KILLSWITCH_STATE_UNBLOCKED : BLUETOOTH_KILLSWITCH_STATE_SOFT_BLOCKED);
429 g_signal_handler_unblock (G_OBJECT (WID ("switch_bluetooth")),
430 self->priv->power_callback_handler_id);
425}431}
426432
427static void433static void
@@ -776,7 +782,11 @@
776 CcBluetoothPanel *self)782 CcBluetoothPanel *self)
777{783{
778 g_debug ("Default adapter power changed");784 g_debug ("Default adapter power changed");
785 g_signal_handler_block (G_OBJECT (WID ("switch_bluetooth")),
786 self->priv->power_callback_handler_id);
779 cc_bluetooth_panel_update_powered_state (self);787 cc_bluetooth_panel_update_powered_state (self);
788 g_signal_handler_unblock (G_OBJECT (WID ("switch_bluetooth")),
789 self->priv->power_callback_handler_id);
780}790}
781791
782static void792static void
@@ -785,9 +795,13 @@
785 CcBluetoothPanel *self)795 CcBluetoothPanel *self)
786{796{
787 g_debug ("Default adapter changed");797 g_debug ("Default adapter changed");
798 g_signal_handler_block (G_OBJECT (WID ("switch_bluetooth")),
799 self->priv->power_callback_handler_id);
788 cc_bluetooth_panel_update_state (self);800 cc_bluetooth_panel_update_state (self);
789 cc_bluetooth_panel_update_power (self);801 cc_bluetooth_panel_update_power (self);
790 cc_bluetooth_panel_update_powered_state (self);802 cc_bluetooth_panel_update_powered_state (self);
803 g_signal_handler_unblock (G_OBJECT (WID ("switch_bluetooth")),
804 self->priv->power_callback_handler_id);
791}805}
792806
793static void807static void
@@ -796,8 +810,12 @@
796 CcBluetoothPanel *self)810 CcBluetoothPanel *self)
797{811{
798 g_debug ("Killswitch changed to state '%s' (%d)", bluetooth_killswitch_state_to_string (state) , state);812 g_debug ("Killswitch changed to state '%s' (%d)", bluetooth_killswitch_state_to_string (state) , state);
813 g_signal_handler_block (G_OBJECT (WID ("switch_bluetooth")),
814 self->priv->power_callback_handler_id);
799 cc_bluetooth_panel_update_state (self);815 cc_bluetooth_panel_update_state (self);
800 cc_bluetooth_panel_update_power (self);816 cc_bluetooth_panel_update_power (self);
817 g_signal_handler_unblock (G_OBJECT (WID ("switch_bluetooth")),
818 self->priv->power_callback_handler_id);
801}819}
802820
803static void821static void
@@ -904,6 +922,7 @@
904 G_CALLBACK (switch_connected_active_changed), self);922 G_CALLBACK (switch_connected_active_changed), self);
905923
906 /* Set the initial state of power */924 /* Set the initial state of power */
925 self->priv->power_callback_handler_id =
907 g_signal_connect (G_OBJECT (WID ("switch_bluetooth")), "notify::active",926 g_signal_connect (G_OBJECT (WID ("switch_bluetooth")), "notify::active",
908 G_CALLBACK (power_callback), self);927 G_CALLBACK (power_callback), self);
909 g_signal_connect (G_OBJECT (self->priv->killswitch), "state-changed",928 g_signal_connect (G_OBJECT (self->priv->killswitch), "state-changed",

Subscribers

People subscribed via source and target branches