[latexila/gnome-3] Save scheme setting: more robust
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila/gnome-3] Save scheme setting: more robust
- Date: Mon, 2 Apr 2012 01:25:02 +0000 (UTC)
commit 02024050ebe4ef2363f57374f04bc063bedf0ffe
Author: SÃbastien Wilmet <swilmet src gnome org>
Date: Mon Apr 2 03:22:49 2012 +0200
Save scheme setting: more robust
There were sometimes critical messages.
And anyway using the cursor_changed signal was a bad idea.
src/preferences_dialog.vala | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/src/preferences_dialog.vala b/src/preferences_dialog.vala
index 751a09b..0d2f490 100644
--- a/src/preferences_dialog.vala
+++ b/src/preferences_dialog.vala
@@ -227,17 +227,20 @@ public class PreferencesDialog : Dialog
init_schemes_treeview (schemes_treeview, current_scheme_id);
// the scheme has changed in the treeview -> update gsettings
- schemes_treeview.cursor_changed.connect ((treeview) =>
+ TreeSelection schemes_select = schemes_treeview.get_selection ();
+ schemes_select.changed.connect (() =>
{
- TreePath tree_path;
- TreeIter iter;
- schemes_treeview.get_cursor (out tree_path, null);
+ unowned TreeModel model;
+ GLib.List<TreePath> rows = schemes_select.get_selected_rows (out model);
+ if (rows.length () != 1)
+ return;
- TreeModel model = treeview.model;
- model.get_iter (out iter, tree_path);
+ TreePath path = rows.nth_data (0);
+ TreeIter iter;
+ model.get_iter (out iter, path);
string id;
- model.get (iter, StyleSchemes.ID, out id, -1);
+ model.get (iter, StyleSchemes.ID, out id);
settings.set_string ("scheme", id);
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]