[dconf-editor] Some cleanings in PathBar code.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Some cleanings in PathBar code.
- Date: Mon, 1 Aug 2016 13:09:01 +0000 (UTC)
commit 53f2b3051c98f32e3144e8ac5e3c013642a1a904
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Mon Aug 1 15:08:50 2016 +0200
Some cleanings in PathBar code.
editor/dconf-editor.ui | 2 +-
editor/dconf-window.vala | 5 +++++
editor/pathbar.ui | 1 -
editor/pathbar.vala | 24 +++++-------------------
4 files changed, 11 insertions(+), 21 deletions(-)
---
diff --git a/editor/dconf-editor.ui b/editor/dconf-editor.ui
index a394603..dadb722 100644
--- a/editor/dconf-editor.ui
+++ b/editor/dconf-editor.ui
@@ -20,7 +20,7 @@
<object class="PathBar" id="pathbar">
<property name="visible">True</property>
<property name="valign">center</property>
- <signal name="path_selected" handler="scroll_to_path"/>
+ <signal name="path_selected" handler="scroll_to_sure_path"/>
</object>
<packing>
<property name="pack-type">start</property>
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 37120e0..67772e2 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -225,6 +225,11 @@ class DConfWindow : ApplicationWindow
return return_value;
}
[GtkCallback]
+ private void scroll_to_sure_path (string full_name)
+ {
+ if (!scroll_to_path (full_name))
+ assert_not_reached ();
+ }
private bool scroll_to_path (string full_name)
{
registry_view.set_search_mode (false);
diff --git a/editor/pathbar.ui b/editor/pathbar.ui
index e7b21e0..029b8ea 100644
--- a/editor/pathbar.ui
+++ b/editor/pathbar.ui
@@ -10,7 +10,6 @@
<object class="GtkButton" id="root_button">
<property name="visible">True</property>
<property name="focus-on-click">False</property>
- <signal name="clicked" handler="set_root_path"/>
<child>
<object class="GtkLabel">
<style>
diff --git a/editor/pathbar.vala b/editor/pathbar.vala
index e8ef9c9..86c00f5 100644
--- a/editor/pathbar.vala
+++ b/editor/pathbar.vala
@@ -22,18 +22,12 @@ public class PathBar : Box
{
[GtkChild] private Button root_button;
- public signal bool path_selected (string path);
+ public signal void path_selected (string path);
construct
{
add_slash_label ();
- }
-
- public void set_path_and_notify (string path)
- {
- set_path (path);
- if (!path_selected (path))
- warning ("something has got wrong with pathbar");
+ root_button.clicked.connect (() => path_selected ("/"));
}
public void set_path (string path)
@@ -106,7 +100,6 @@ public class PathBar : Box
}
}
- /* only draw when finished, for CSS :last-child rendering */
show_all ();
}
@@ -114,13 +107,6 @@ public class PathBar : Box
* * widgets
\*/
- [GtkCallback]
- private void set_root_path ()
- {
- root_button.set_sensitive (false);
- set_path_and_notify ("/");
- }
-
private void add_slash_label ()
{
add (new Label ("/"));
@@ -130,7 +116,7 @@ public class PathBar : Box
{
PathBarItem path_bar_item = new PathBarItem (label);
- path_bar_item.path_bar_item_clicked_handler = path_bar_item.clicked.connect (() =>
set_path_and_notify (complete_path));
+ path_bar_item.path_bar_item_clicked_handler = path_bar_item.clicked.connect (() => path_selected
(complete_path));
path_bar_item.set_sensitive (!block);
add (path_bar_item);
@@ -142,12 +128,12 @@ private class PathBarItem : Button
{
public ulong path_bar_item_clicked_handler = 0;
- public string text_string { get; private set; }
+ public string text_string { get; construct; }
[GtkChild] private Label text_label;
public PathBarItem (string label)
{
- text_string = label;
+ Object (text_string: label);
text_label.set_text (label);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]