-
Notifications
You must be signed in to change notification settings - Fork 2
/
0003-Support-startup-minimized.patch
83 lines (74 loc) · 3.35 KB
/
0003-Support-startup-minimized.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
From a44842d6f0e6641176a7bd57723c7a44e77dcbec Mon Sep 17 00:00:00 2001
From: LiuLang <[email protected]>
Date: Sat, 2 Jan 2016 11:10:16 +0800
Subject: [PATCH 03/10] Support "startup-minimized".
https://github.com/LiuLang/bcloud-packages/issues/45#issuecomment-167710464
---
bcloud/App.py | 2 ++
bcloud/PreferencesDialog.py | 32 +++++++++++++++++++++++++++++---
2 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/bcloud/App.py b/bcloud/App.py
index e4d4d01..fd67aa9 100644
--- a/bcloud/App.py
+++ b/bcloud/App.py
@@ -180,6 +180,8 @@ class App:
if not self.profile:
self.show_signin_dialog()
self.window.show_all()
+ if self.profile['startup-minimized']:
+ self.window.hide()
if hasattr(self, 'home_page'):
self.switch_page(self.home_page)
diff --git a/bcloud/PreferencesDialog.py b/bcloud/PreferencesDialog.py
index 20f7c33..c62f261 100644
--- a/bcloud/PreferencesDialog.py
+++ b/bcloud/PreferencesDialog.py
@@ -74,14 +74,31 @@ class PreferencesDialog(Gtk.Dialog):
status_switch.props.halign = Gtk.Align.START
general_grid.attach(status_switch, 1, 3, 1, 1)
+ minimized_label = Gtk.Label.new(_('Startup minimized:'))
+ minimized_label.props.xalign = 1
+ general_grid.attach(minimized_label, 0, 4, 1, 1)
+ minimized_switch = Gtk.Switch()
+ minimized_switch.set_active(self.app.profile['startup-minimized'])
+ if self.app.profile['use-status-icon']:
+ minimized_switch.set_sensitive(True)
+ else:
+ minimized_switch.set_sensitive(False)
+ minimized_switch.set_active(False)
+ self.app.profile['startup-minimized'] = False
+ minimized_switch.connect('notify::active',
+ self.on_minimized_switch_activate)
+ minimized_switch.props.halign = Gtk.Align.START
+ general_grid.attach(minimized_switch, 1, 4, 1, 1)
+ self.minimized_switch = minimized_switch
+
avatar_label = Gtk.Label.new(_('Display Avatar:'))
avatar_label.props.xalign = 1
- general_grid.attach(avatar_label, 0, 4, 1, 1)
+ general_grid.attach(avatar_label, 0, 5, 1, 1)
avatar_switch = Gtk.Switch()
avatar_switch.set_active(self.app.profile['display-avatar'])
avatar_switch.connect('notify::active', self.on_avatar_switch_activate)
avatar_switch.props.halign = Gtk.Align.START
- general_grid.attach(avatar_switch, 1, 4, 1, 1)
+ general_grid.attach(avatar_switch, 1, 5, 1, 1)
# download tab
@@ -261,7 +278,16 @@ class PreferencesDialog(Gtk.Dialog):
self.app.profile['use-dark-theme'] = switch.get_active()
def on_status_switch_activate(self, switch, event):
- self.app.profile['use-status-icon'] = switch.get_active()
+ status = switch.get_active()
+ self.app.profile['use-status-icon'] = status
+ if status:
+ self.minimized_switch.set_sensitive(True)
+ else:
+ self.minimized_switch.set_sensitive(False)
+ self.minimized_switch.set_active(False)
+
+ def on_minimized_switch_activate(self, switch, event):
+ self.app.profile['startup-minimized'] = switch.get_active()
def on_avatar_switch_activate(self, switch, event):
self.app.profile['display-avatar'] = switch.get_active()
--
2.9.0