183
* Create a description to place above the applications treeview.
185
* @return a Gtk.Label for a description of the applications treeview
187
private Gtk.Widget create_applications_tree_description ()
189
applications_tree_description = new Gtk.Label (null);
191
applications_tree_description.xalign = 0.0f;
192
applications_tree_description.show ();
194
return applications_tree_description;
198
* Create the notebook with a page for adding providers.
200
* @return a Gtk.Notebook containing a provider selection tree view
202
private Gtk.Widget create_applications_tree ()
204
applications_store = new AccountApplicationsModel ();
206
var scrolled_window = new Gtk.ScrolledWindow (null, null);
207
applications_tree = new Gtk.TreeView.with_model (applications_store);
209
// TODO: Add spacing between rows. vertical-separator style property.
210
applications_tree.headers_visible = false;
212
var icon_renderer = new Gtk.CellRendererPixbuf ();
213
icon_renderer.stock_size = Gtk.IconSize.DIALOG;
214
icon_renderer.set_padding (6, 6);
216
var description_renderer = new Gtk.CellRendererText ();
217
var tree_column = new Gtk.TreeViewColumn ();
218
tree_column.pack_start (icon_renderer, false);
219
tree_column.add_attribute (icon_renderer,
221
AccountApplicationsModel.ModelColumns.APPLICATION_ICON);
222
tree_column.pack_start (description_renderer, true);
223
tree_column.add_attribute (description_renderer,
225
AccountApplicationsModel.ModelColumns.APPLICATION_DESCRIPTION);
226
applications_tree.append_column (tree_column);
228
scrolled_window.expand = true;
229
scrolled_window.shadow_type = Gtk.ShadowType.ETCHED_IN;
230
scrolled_window.add (applications_tree);
232
scrolled_window.show_all ();
234
return scrolled_window;
238
* Show an appropriate page in the notebook, depending on which row was
239
* selected in the accounts treeview.
241
* @return selection the selection of the accounts treeview
185
* Create a description to place above the applications grid.
187
* @return a Gtk.Label for a description of the applications grid
189
private Gtk.Widget create_applications_grid_description ()
191
applications_grid_description = new Gtk.Label (null);
193
applications_grid_description.xalign = 0.0f;
194
applications_grid_description.show ();
196
return applications_grid_description;
200
* Create the grid with a list of applications using the current account.
202
* @return a Gtk.Grid containing a list of applications
204
private Gtk.Widget create_applications_grid ()
206
applications_model = new AccountApplicationsModel ();
208
applications_scroll = new Gtk.ScrolledWindow (null, null);
210
// Instantiates applications_grid.
211
populate_applications_grid ();
213
applications_scroll.shadow_type = Gtk.ShadowType.ETCHED_IN;
214
applications_scroll.window_placement_set = true;
216
return applications_scroll;
220
* Create a button box for the account editing buttons.
222
* @return a Gtk.ButtonBox for the remove or edit account buttons
243
224
private Gtk.Widget create_remove_account_box ()
226
var buttonbox = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
227
buttonbox.set_layout (Gtk.ButtonBoxStyle.END);
245
229
var remove_button = new Gtk.Button.with_label (_("Remove account"));
247
231
remove_button.clicked.connect (on_remove_account_clicked);
249
remove_button.halign = Gtk.Align.END;
250
remove_button.show ();
252
return remove_button;
233
buttonbox.add (remove_button);
234
buttonbox.show_all ();
240
* Populate the grid of applications from the model. Instantiates
243
private void populate_applications_grid ()
245
if (applications_grid != null)
247
applications_grid.destroy ();
250
applications_grid = new Gtk.Grid ();
251
applications_grid.orientation = Gtk.Orientation.VERTICAL;
252
applications_grid.row_spacing = 6;
253
applications_grid.expand = true;
255
unowned List<AccountApplicationRow?> applications = applications_model.application_rows;
257
applications.foreach (add_application);
259
applications_scroll.add_with_viewport (applications_grid);
261
applications_scroll.show_all ();
265
* Add an individual application from the model to the applications grid.
267
* @param application the description of the application
269
private void add_application (AccountApplicationRow? application)
271
var grid = new Gtk.Grid ();
272
grid.border_width = 6;
273
grid.column_spacing = 6;
274
grid.orientation = Gtk.Orientation.HORIZONTAL;
276
grid.add (new Gtk.Image.from_gicon (application.icon,
277
Gtk.IconSize.DIALOG));
278
var label = new Gtk.Label (application.description);
279
label.hexpand = true;
280
label.use_markup = true;
284
// TODO: Add options button here, if there is one.
286
applications_grid.add (grid);