Merge lp:~azzar1/software-properties/new-auth-dialog into lp:software-properties

Proposed by Andrea Azzarone
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 1044
Merged at revision: 1062
Proposed branch: lp:~azzar1/software-properties/new-auth-dialog
Merge into: lp:software-properties
Diff against target: 569 lines (+243/-202) (has conflicts)
3 files modified
data/gtkbuilder/dialog-auth.ui (+96/-80)
debian/changelog (+12/-0)
softwareproperties/gtk/DialogAuth.py (+135/-122)
Text conflict in debian/changelog
To merge this branch: bzr merge lp:~azzar1/software-properties/new-auth-dialog
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Review via email: mp+345483@code.launchpad.net

Commit message

Implement new design for authentication dialog according to https://github.com/CanonicalLtd/desktop-design/issues/62

To post a comment you must log in.
1038. By Andrea Azzarone

Merge trunk.

1039. By Andrea Azzarone

Merge with trunk.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

Merge with trunk and changelog entry updated.

1040. By Andrea Azzarone

Merge with trunk.

1041. By Andrea Azzarone

Refactor dialog-auth.ui and DialogAuth.py

Revision history for this message
Andrea Azzarone (azzar1) wrote :

I updated the code to sync it with the one used in gnome-software.

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

Thank you for the work, looks good to me, some small details

* that's not the exact same string but in https://user-images.githubusercontent.com/19801137/38986966-1632a352-43c6-11e8-9f30-4fada71b78ce.png mpt used the string

'Ubuntu One account' where you wrote '*A*ccount' ... is that wanted?

* The dialog is titled "software-properties-gtk" which is not that nice, can we get ride of the title or use something better/more user friendly?

* When I click on the sign in/register button (on disco, testing with an hacked lsb-release to have the UI showing) I get that error

'Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/softwareproperties/gtk/DialogAuth.py", line 237, in _button_continue_clicked_cb
    self._button_add_another_clicked_cb(self, self.button_add_another)
TypeError: _button_add_another_clicked_cb() takes 2 positional arguments but 3 were given'

review: Needs Fixing
1042. By Andrea Azzarone

s/Account/account/g

1043. By Andrea Azzarone

DialogAuth: Show an empty titlebar

1044. By Andrea Azzarone

DialogAuth: remove extra self argument to _button_add_another_clicked_cb()

Revision history for this message
Andrea Azzarone (azzar1) wrote :

> Thank you for the work, looks good to me, some small details
>
> * that's not the exact same string but in https://user-images.githubuserconten
> t.com/19801137/38986966-1632a352-43c6-11e8-9f30-4fada71b78ce.png mpt used the
> string
>
> 'Ubuntu One account' where you wrote '*A*ccount' ... is that wanted?
>
> * The dialog is titled "software-properties-gtk" which is not that nice, can
> we get ride of the title or use something better/more user friendly?
>
> * When I click on the sign in/register button (on disco, testing with an
> hacked lsb-release to have the UI showing) I get that error
>
> 'Traceback (most recent call last):
> File "/usr/lib/python3/dist-packages/softwareproperties/gtk/DialogAuth.py",
> line 237, in _button_continue_clicked_cb
> self._button_add_another_clicked_cb(self, self.button_add_another)
> TypeError: _button_add_another_clicked_cb() takes 2 positional arguments but 3
> were given'

Branch updated!

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

Looks good now!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/gtkbuilder/dialog-auth.ui'
--- data/gtkbuilder/dialog-auth.ui 2018-03-21 14:05:30 +0000
+++ data/gtkbuilder/dialog-auth.ui 2019-01-17 18:48:56 +0000
@@ -1,114 +1,130 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Generated with glade 3.20.4 -->2<!-- Generated with glade 3.22.1 -->
3<interface>3<interface>
4 <requires lib="gtk+" version="3.10"/>4 <requires lib="gtk+" version="3.10"/>
5 <object class="GtkListStore" id="liststore_account">
6 <columns>
7 <!-- column-name Id -->
8 <column type="gchararray"/>
9 <!-- column-name Email -->
10 <column type="gchararray"/>
11 <!-- column-name Account -->
12 <column type="GObject"/>
13 </columns>
14 </object>
5 <object class="GtkDialog" id="dialog_auth">15 <object class="GtkDialog" id="dialog_auth">
6 <property name="can_focus">False</property>
7 <property name="resizable">False</property>16 <property name="resizable">False</property>
8 <property name="modal">True</property>
9 <property name="destroy_with_parent">True</property>
10 <property name="type_hint">dialog</property>17 <property name="type_hint">dialog</property>
11 <property name="deletable">False</property>18 <child>
19 <placeholder/>
20 </child>
12 <child internal-child="vbox">21 <child internal-child="vbox">
13 <object class="GtkBox" id="box_dialog">22 <object class="GtkBox">
14 <property name="can_focus">False</property>23 <property name="border_width">6</property>
15 <property name="orientation">vertical</property>24 <property name="orientation">vertical</property>
16 <property name="spacing">2</property>25 <property name="spacing">2</property>
17 <child internal-child="action_area">26 <child internal-child="action_area">
18 <object class="GtkButtonBox" id="dialog-action_area1">27 <object class="GtkButtonBox">
19 <property name="can_focus">False</property>28 <child>
29 <object class="GtkButton" id="button_add_another">
30 <property name="label" translatable="yes">Add another…</property>
31 <property name="visible">True</property>
32 <property name="can_focus">True</property>
33 <property name="receives_default">True</property>
34 <signal name="clicked" handler="_button_add_another_clicked_cb" swapped="no"/>
35 </object>
36 <packing>
37 <property name="expand">True</property>
38 <property name="secondary">True</property>
39 <property name="non_homogeneous">True</property>
40 </packing>
41 </child>
42 <child>
43 <object class="GtkButton" id="button_cancel">
44 <property name="label" translatable="yes">Cancel</property>
45 <property name="visible">True</property>
46 <property name="can_focus">True</property>
47 <property name="receives_default">True</property>
48 <signal name="clicked" handler="_button_cancel_clicked_cb" swapped="no"/>
49 </object>
50 <packing>
51 <property name="expand">True</property>
52 <property name="non_homogeneous">True</property>
53 </packing>
54 </child>
55 <child>
56 <object class="GtkButton" id="button_continue">
57 <property name="visible">True</property>
58 <property name="can_focus">True</property>
59 <property name="receives_default">True</property>
60 <signal name="clicked" handler="_button_continue_clicked_cb" swapped="no"/>
61 </object>
62 <packing>
63 <property name="expand">True</property>
64 <property name="non_homogeneous">True</property>
65 </packing>
66 </child>
20 </object>67 </object>
21 <packing>68 <packing>
22 <property name="expand">False</property>69 <property name="expand">True</property>
23 <property name="fill">False</property>
24 <property name="position">0</property>
25 </packing>70 </packing>
26 </child>71 </child>
27 <child>72 <child>
28 <object class="GtkGrid" id="main_grid">73 <object class="GtkBox">
29 <property name="visible">True</property>74 <property name="visible">True</property>
30 <property name="can_focus">False</property>75 <property name="halign">start</property>
31 <property name="border_width">12</property>76 <property name="border_width">12</property>
32 <property name="row_spacing">12</property>77 <property name="spacing">18</property>
33 <property name="column_spacing">12</property>
34 <child>78 <child>
35 <object class="GtkLabel" id="label_title">79 <object class="GtkImage">
36 <property name="visible">True</property>80 <property name="visible">True</property>
37 <property name="can_focus">False</property>81 <property name="halign">start</property>
38 <property name="hexpand">True</property>82 <property name="valign">start</property>
39 <property name="label" translatable="yes">To enable Livepatch choose an Ubuntu Single Sign-on account.</property>83 <property name="icon_name">software-properties</property>
40 <property name="wrap">True</property>84 <property name="icon_size">6</property>
41 <property name="xalign">0</property>
42 </object>85 </object>
43 <packing>
44 <property name="left_attach">0</property>
45 <property name="top_attach">0</property>
46 </packing>
47 </child>86 </child>
48 <child>87 <child>
49 <object class="GtkFrame" id="main_frame">88 <object class="GtkBox" id="box_auth">
50 <property name="visible">True</property>89 <property name="visible">True</property>
51 <property name="can_focus">False</property>90 <property name="halign">start</property>
52 <property name="label_xalign">0</property>91 <property name="orientation">vertical</property>
92 <property name="spacing">12</property>
53 <child>93 <child>
54 <object class="GtkListBox" id="listbox_accounts">94 <object class="GtkLabel" id="label_header">
95 <property name="name">label_header</property>
55 <property name="visible">True</property>96 <property name="visible">True</property>
56 <property name="can_focus">False</property>97 <property name="halign">start</property>
57 <property name="selection_mode">none</property>98 <property name="valign">start</property>
99 <property name="use_markup">True</property>
100 <property name="justify">fill</property>
101 <property name="wrap">True</property>
102 <property name="max_width_chars">40</property>
103 </object>
104 </child>
105 <child>
106 <object class="GtkComboBox" id="combobox_account">
107 <property name="halign">start</property>
108 <property name="model">liststore_account</property>
58 <child>109 <child>
59 <object class="GtkListBoxRow" id="listboxrow_new_account">110 <object class="GtkCellRendererText"/>
60 <property name="visible">True</property>111 <attributes>
61 <property name="can_focus">False</property>112 <attribute name="text">1</attribute>
62 <child>113 </attributes>
63 <object class="GtkLabel" id="label_new_account">
64 <property name="height_request">48</property>
65 <property name="visible">True</property>
66 <property name="can_focus">False</property>
67 <property name="halign">center</property>
68 <property name="valign">center</property>
69 <property name="label" translatable="yes">&lt;b&gt;Use another account...&lt;/b&gt;</property>
70 <property name="use_markup">True</property>
71 <property name="justify">center</property>
72 </object>
73 </child>
74 </object>
75 </child>114 </child>
76 </object>115 </object>
77 </child>116 </child>
117 <child>
118 <object class="GtkLabel" id="label_account">
119 <property name="halign">start</property>
120 </object>
121 </child>
78 </object>122 </object>
79 <packing>
80 <property name="left_attach">0</property>
81 <property name="top_attach">1</property>
82 <property name="width">2</property>
83 </packing>
84 </child>123 </child>
85 </object>124 </object>
86 <packing>125 </child>
87 <property name="expand">False</property>126 </object>
88 <property name="fill">True</property>127 </child>
89 <property name="position">1</property>
90 </packing>
91 </child>
92 </object>
93 </child>
94 <child type="titlebar">
95 <object class="GtkHeaderBar">
96 <property name="visible">True</property>
97 <property name="can_focus">False</property>
98 <property name="title" translatable="yes">Choose an account</property>
99 <child>
100 <object class="GtkButton" id="button_cancel">
101 <property name="label">gtk-cancel</property>
102 <property name="visible">True</property>
103 <property name="can_focus">True</property>
104 <property name="receives_default">True</property>
105 <property name="use_stock">True</property>
106 </object>
107 </child>
108 </object>
109 </child>
110 <action-widgets>
111 <action-widget response="-6">button_cancel</action-widget>
112 </action-widgets>
113 </object>128 </object>
114</interface>129</interface>
130
115131
=== modified file 'debian/changelog'
--- debian/changelog 2019-01-16 16:02:03 +0000
+++ debian/changelog 2019-01-17 18:48:56 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
1software-properties (0.96.31) UNRELEASED; urgency=medium2software-properties (0.96.31) UNRELEASED; urgency=medium
23
3 * Remove the migration script, it was online needed until bionic4 * Remove the migration script, it was online needed until bionic
@@ -12,6 +13,17 @@
1213
13 -- Sebastien Bacher <seb128@ubuntu.com> Tue, 15 Jan 2019 10:48:27 +010014 -- Sebastien Bacher <seb128@ubuntu.com> Tue, 15 Jan 2019 10:48:27 +0100
1415
16=======
17software-properties (0.96.30) UNRELEASED; urgency=medium
18
19 * data/gtkbuilder/dialog-auth.ui: Update design of the authentication
20 dialog.
21 * softwareproperties/gtk/DialogAuth.py: Implement new design of the
22 authentication dialog.
23
24 -- Andrea Azzarone <andrea.azzarone@canonical.com> Wed, 19 Dec 2018 15:47:56 +0000
25
26>>>>>>> MERGE-SOURCE
15software-properties (0.96.29) disco; urgency=medium27software-properties (0.96.29) disco; urgency=medium
1628
17 * SoftwarePropertiesGtk.py: when checking a package's depends for DKMS also29 * SoftwarePropertiesGtk.py: when checking a package's depends for DKMS also
1830
=== modified file 'softwareproperties/gtk/DialogAuth.py'
--- softwareproperties/gtk/DialogAuth.py 2018-03-21 15:52:33 +0000
+++ softwareproperties/gtk/DialogAuth.py 2019-01-17 18:48:56 +0000
@@ -19,6 +19,7 @@
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-130719# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20# USA20# USA
2121
22from enum import IntEnum
22import os23import os
2324
24from gettext import gettext as _25from gettext import gettext as _
@@ -28,9 +29,13 @@
2829
29import gi30import gi
30gi.require_version('Goa', '1.0')31gi.require_version('Goa', '1.0')
31from gi.repository import Gio, GLib, Goa, GObject, Gtk32from gi.repository import Gio, GLib, Goa, Gtk
32import logging33import logging
3334
35class Column(IntEnum):
36 ID = 0
37 MAIL = 1
38 ACCOUNT = 2
3439
35class DialogAuth:40class DialogAuth:
3641
@@ -38,68 +43,126 @@
38 """setup up the gtk dialog"""43 """setup up the gtk dialog"""
39 self.parent = parent44 self.parent = parent
4045
41 setup_ui(self, os.path.join(datadir, "gtkbuilder",46 setup_ui(self, os.path.join(datadir, "gtkbuilder", "dialog-auth.ui"),
42 "dialog-auth.ui"), domain="software-properties")47 domain="software-properties")
43 self.label_title.set_max_width_chars(50)
4448
45 self.dialog = self.dialog_auth49 self.dialog = self.dialog_auth
46 self.dialog.use_header_bar = True50 self.dialog.set_title('')
51 self.dialog.set_deletable(False)
47 self.dialog.set_transient_for(parent)52 self.dialog.set_transient_for(parent)
4853
49 self.listboxrow_new_account.account = None54 self.button_continue.grab_focus()
5055
51 self.account = None56 self.account = None
52 self.dispose_on_new_account = False57 self.dispose_on_new_account = False
53 self.goa_client = Goa.Client.new_sync(None)58 self.goa_client = Goa.Client.new_sync(None)
5459
55 self.listbox_accounts.connect('row-activated', self._listbox_accounts_row_activated_cb)60 self._setup_model()
61 self._check_ui(select=False)
5662
57 # Be ready to other accounts63 # Be ready to other accounts
58 self.goa_client.connect('account-added', self._account_added_cb)64 self.goa_client.connect('account-added', self._account_added_cb)
59 self.goa_client.connect('account-removed', self._account_removed_cb)65 self.goa_client.connect('account-removed', self._account_removed_cb)
6066
61 self._setup_listbox_accounts()
62 self._check_ui()
63
64 def run(self):67 def run(self):
65 res = self.dialog.run()68 res = self.dialog.run()
66 self.dialog.hide()69 self.dialog.hide()
67 return res70 return res
6871
69 def _check_ui(self):72 def _setup_model(self):
70 rows = self.listbox_accounts.get_children()
71 has_accounts = len(rows) > 1
72
73 if has_accounts:
74 title = _('To continue choose an Ubuntu Single Sign-On account.')
75 new_account = _('Use another account…')
76 else:
77 title = _('To continue you need an Ubuntu Single Sign-On account.')
78 new_account = _('Sign In…')
79
80 self.label_title.set_text(title)
81 self.label_new_account.set_markup('<b>{}</b>'.format(new_account))
82
83 def _setup_listbox_accounts(self):
84 for obj in self.goa_client.get_accounts():73 for obj in self.goa_client.get_accounts():
85 account = obj.get_account()74 self._add_account(obj.get_account(), select=False)
86 if self._is_account_supported(account):75
87 self._add_account(account)76 def _set_header(self, label):
8877 self.label_header.set_markup(
89 def _is_account_supported(self, account):78 "<span size='larger' weight='bold'>%s</span>" % label)
90 return account.props.provider_type == 'ubuntusso'79
9180 def _check_ui(self, select):
92 def _add_account(self, account):81 naccounts = len(self.liststore_account)
93 row = self._create_row(account)82
94 self.listbox_accounts.prepend(row)83 if naccounts == 0:
95 self._check_ui()84 self._set_header(
85 _('To use Livepatch, you need to use an Ubuntu One account.'))
86 self.combobox_account.set_visible(False)
87 self.label_account.set_visible(False)
88 self.button_add_another.set_visible(False)
89 self.button_continue.set_label(_('Sign In / Register…'))
90 elif naccounts == 1:
91 self._set_header(
92 _('To use Livepatch, you need to use your Ubuntu One account.'))
93 self.combobox_account.set_visible(False)
94 self.label_account.set_visible(True)
95 self.label_account.set_text(self.liststore_account[0][Column.MAIL])
96 self.button_add_another.set_visible(True)
97 self.button_continue.set_label(_('Continue'))
98 else:
99 self._set_header(
100 _('To use Livepatch, you need to use an Ubuntu One account.'))
101 self.button_add_another.set_visible(True)
102 self.combobox_account.set_visible(True)
103 self.label_account.set_visible(False)
104 self.button_continue.set_label(_('Use'))
105 if select:
106 self.combobox_account.set_active(naccounts-1)
107 elif self.combobox_account.get_active() == -1:
108 self.combobox_account.set_active(0)
109
110 def _ignore_account(self, account):
111 return account.props.provider_type != 'ubuntusso'
112
113 def _get_account_iter(self, account):
114 row = self.liststore_account.get_iter_first()
115 while row is not None:
116 account_id = self.liststore_account.get_value(row, Column.ID)
117 if account_id == account.props.id:
118 return row
119 row = self.liststore_account.iter_next(row)
120 return None
121
122 def _add_account(self, account, select):
123 if self._ignore_account(account):
124 return
125
126 account_iter = self._get_account_iter(account)
127 if account_iter is not None:
128 return
129
130 account_iter = self.liststore_account.append()
131 self.liststore_account.set(account_iter,
132 [Column.ID, Column.MAIL, Column.ACCOUNT],
133 [account.props.id, account.props.presentation_identity, account])
134 self._check_ui(select)
96135
97 def _remove_account(self, account):136 def _remove_account(self, account):
98 for row in self.listbox_accounts.get_children():137 if self._ignore_account(account):
99 if row.account == account:138 return
100 row.destroy()139
101 self._check_ui()140 account_iter = self._get_account_iter(account)
102 break141 if account_iter is None:
142 return
143
144 self.liststore_account.remove(account_iter)
145 self._check_ui(select=False)
146
147 def _response_if_valid(self, account):
148 def cb(source, res, data):
149 try:
150 source.call_ensure_credentials_finish(res)
151 valid = True
152 except GLib.Error as e:
153 valid = False
154
155 if not valid:
156 try:
157 self._spawn_goa_with_args(account.props.id, None)
158 except GLib.Error as e:
159 logging.warning ('Failed to spawn gnome-control-center: %s',
160 e.message)
161 else:
162 self.account = account
163 self.dialog.response(Gtk.ResponseType.OK)
164
165 account.call_ensure_credentials(None, cb, None)
103166
104 def _build_dbus_params(self, action, arg):167 def _build_dbus_params(self, action, arg):
105 builder = GLib.VariantBuilder.new(GLib.VariantType.new('av'))168 builder = GLib.VariantBuilder.new(GLib.VariantType.new('av'))
@@ -118,7 +181,8 @@
118 v = GLib.Variant.new_variant(s)181 v = GLib.Variant.new_variant(s)
119 builder.add_value(v)182 builder.add_value(v)
120183
121 array = GLib.Variant.new_tuple(GLib.Variant.new_string('online-accounts'), builder.end())184 array = GLib.Variant.new_tuple(
185 GLib.Variant.new_string('online-accounts'), builder.end())
122 array = GLib.Variant.new_variant(array)186 array = GLib.Variant.new_variant(array)
123187
124 param = GLib.Variant.new_tuple(188 param = GLib.Variant.new_tuple(
@@ -135,94 +199,43 @@
135 'org.gtk.Actions', None)199 'org.gtk.Actions', None)
136200
137 param = self._build_dbus_params(action, arg)201 param = self._build_dbus_params(action, arg)
138 timeout = 10*60*1000 # 10 minutes should be enough to create an account202 proxy.call_sync('Activate', param, Gio.DBusCallFlags.NONE, -1, None)
139 proxy.call_sync('Activate', param, Gio.DBusCallFlags.NONE, timeout, None)
140
141 def _create_row(self, account):
142 identity = account.props.presentation_identity
143 provider_name = account.props.provider_name
144
145 row = Gtk.ListBoxRow.new()
146 row.show()
147
148 hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 6)
149 hbox.set_hexpand(True)
150 hbox.show()
151
152 image = Gtk.Image.new_from_icon_name('avatar-default', Gtk.IconSize.DIALOG)
153 image.set_pixel_size(48)
154 image.show()
155 hbox.pack_start(image, False, False, 0)
156
157 vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 2)
158 vbox.set_valign(Gtk.Align.CENTER)
159 vbox.show()
160 hbox.pack_start(vbox, False, False, 0)
161
162 if identity:
163 ilabel = Gtk.Label.new()
164 ilabel.set_halign(Gtk.Align.START)
165 ilabel.set_markup('<b>{}</b>'.format(identity))
166 ilabel.show()
167 vbox.pack_start(ilabel, True, True, 0)
168
169 if provider_name:
170 plabel = Gtk.Label.new()
171 plabel.set_halign(Gtk.Align.START)
172 plabel.set_markup('<small><span foreground=\"#555555\">{}</span></small>'.format(provider_name))
173 plabel.show()
174 vbox.pack_start(plabel, True, True, 0)
175
176 warning_icon = Gtk.Image.new_from_icon_name('dialog-warning-symbolic', Gtk.IconSize.BUTTON)
177 warning_icon.set_no_show_all(True)
178 warning_icon.set_margin_end (15)
179 hbox.pack_end(warning_icon, False, False, 0)
180
181 row.add(hbox)
182
183 account.bind_property('attention-needed', warning_icon, 'visible',
184 GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE)
185
186 row.account = account
187 return row
188
189 # Signals handlers
190 def _listbox_accounts_row_activated_cb(self, listbox, row):
191 account = row.account
192
193 if account is None:
194 # TODO (azzar1): there is no easy way to put this to false
195 # if the user close the windows without adding an account.
196 # We need to discuss with goa's upstream to support such usercases
197 try:
198 self._spawn_goa_with_args('add', 'ubuntusso')
199 self.dispose_on_new_account = True
200 except GLib.Error as e:
201 logging.warning ('Failed to spawing gnome-control-center: %s', e.message)
202 else:
203 if account.props.attention_needed:
204 try:
205 self._spawn_goa_with_args(account.props.id, None)
206 except GLib.Error as e:
207 logging.warning ('Failed to spawing gnome-control-center: %s', e.message)
208 else:
209 self.account = account
210 self.dialog.response(Gtk.ResponseType.OK)
211203
212 def _account_added_cb(self, goa_client, goa_object):204 def _account_added_cb(self, goa_client, goa_object):
213 account = goa_object.get_account()205 account = goa_object.get_account()
214 if not self._is_account_supported(account):206 if self._ignore_account(account):
215 return207 return
216 if not self.dispose_on_new_account:208 if not self.dispose_on_new_account:
217 self._add_account(account)209 self._add_account(account, True)
218 else:210 else:
219 self.account = account211 self._response_if_valid(account)
220 self.dialog.response(Gtk.ResponseType.OK)
221212
222 def _account_removed_cb(self, goa_client, goa_object):213 def _account_removed_cb(self, goa_client, goa_object):
223 account = goa_object.get_account()214 account = goa_object.get_account()
224 if self._is_account_supported(account):215 if not self._ignore_account(account):
225 self._remove_account(account)216 self._remove_account(account)
226217
227218 def _button_add_another_clicked_cb(self, button):
228219 try:
220 # There is no easy way to put this to false if the user close the
221 # windows without adding an account.
222 self._spawn_goa_with_args('add', 'ubuntusso')
223 self.dispose_on_new_account = True
224 except GLib.Error as e:
225 logging.warning ('Failed to spawn control-center: %s', e.message)
226
227 def _button_cancel_clicked_cb(self, button):
228 self.dialog.response(Gtk.ResponseType.CANCEL)
229
230 def _button_continue_clicked_cb(self, button):
231 naccounts = len(self.liststore_account)
232
233 account = None
234 if naccounts >= 1:
235 active_index = self.combobox_account.get_active()
236 account = self.liststore_account[active_index][Column.ACCOUNT]
237
238 if account is None:
239 self._button_add_another_clicked_cb(self.button_add_another)
240 else:
241 self._response_if_valid(account)

Subscribers

People subscribed via source and target branches

to status/vote changes: