[dconf-editor] Make show_dialog() a signal.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Make show_dialog() a signal.
- Date: Sat, 26 Sep 2015 09:11:00 +0000 (UTC)
commit 304270096068da0feddfd3181692a46419168d97
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sat Sep 26 11:10:49 2015 +0200
Make show_dialog() a signal.
editor/dconf-window.vala | 33 ++++++++++++++++-----------------
1 files changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 3bdac97..fc9dc4e 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -69,11 +69,24 @@ class DConfWindow : ApplicationWindow
if (key.has_schema)
{
KeyListBoxRowEditable key_list_box_row = new KeyListBoxRowEditable (key);
+ key_list_box_row.show_dialog.connect (() => {
+ KeyEditor key_editor = new KeyEditor (key);
+ key_editor.set_transient_for (this);
+ key_editor.run ();
+ });
key.value_changed.connect (() => { key_list_box_row.update (); });
return key_list_box_row;
}
else
- return new KeyListBoxRowNonEditable (key.name, key.cool_text_value ());
+ {
+ KeyListBoxRowNonEditable key_list_box_row = new KeyListBoxRowNonEditable (key.name,
key.cool_text_value ());
+ key_list_box_row.show_dialog.connect (() => {
+ MessageDialog dialog = new MessageDialog (this, DialogFlags.MODAL, MessageType.WARNING,
ButtonsType.OK, _("No Schema, cannot edit value.")); // TODO with or without punctuation? // TODO
insert key name/path/..?
+ dialog.run ();
+ dialog.destroy ();
+ });
+ return key_list_box_row;
+ }
}
[GtkCallback]
@@ -81,7 +94,7 @@ class DConfWindow : ApplicationWindow
{
search_next_button.set_sensitive (true); // TODO better, or maybe just hide search_bar 2/2
- ((KeyListBoxRow) list_box_row.get_child ()).show_dialog (this);
+ ((KeyListBoxRow) list_box_row.get_child ()).show_dialog ();
}
/*\
@@ -205,7 +218,7 @@ private abstract class KeyListBoxRow : Grid
[GtkChild] protected Label key_value_label;
[GtkChild] protected Label key_info_label;
- public abstract void show_dialog (ApplicationWindow window);
+ public signal void show_dialog ();
}
private class KeyListBoxRowNonEditable : KeyListBoxRow
@@ -216,13 +229,6 @@ private class KeyListBoxRowNonEditable : KeyListBoxRow
key_value_label.label = key_value;
key_info_label.set_markup ("<i>" + _("No Schema") + "</i>");
}
-
- public override void show_dialog (ApplicationWindow window)
- {
- MessageDialog dialog = new MessageDialog (window, DialogFlags.MODAL, MessageType.WARNING,
ButtonsType.OK, _("No Schema, cannot edit value.")); // TODO with or without punctuation? // TODO
insert key name/path/..?
- dialog.run ();
- dialog.destroy ();
- }
}
private class KeyListBoxRowEditable : KeyListBoxRow
@@ -256,11 +262,4 @@ private class KeyListBoxRowEditable : KeyListBoxRow
key_value_label.label = key.cool_text_value ();
}
-
- public override void show_dialog (ApplicationWindow window)
- {
- KeyEditor key_editor = new KeyEditor (key);
- key_editor.set_transient_for (window);
- key_editor.run ();
- }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]