[dconf-editor] Enter search mode when clicking pathbar.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Enter search mode when clicking pathbar.
- Date: Thu, 29 Nov 2018 13:26:55 +0000 (UTC)
commit e4215908ab31629e17939d0f2dbe3a5ac7e07d67
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Nov 29 14:06:26 2018 +0100
Enter search mode when clicking pathbar.
editor/adaptative-pathbar.vala | 3 ++-
editor/browser-headerbar.ui | 7 ++++++-
editor/browser-headerbar.vala | 2 ++
editor/large-pathbar.css | 12 ++++++++++++
editor/large-pathbar.vala | 35 +++++++++++++++++++++++++++++++++++
editor/pathwidget.ui | 5 +++--
6 files changed, 60 insertions(+), 4 deletions(-)
---
diff --git a/editor/adaptative-pathbar.vala b/editor/adaptative-pathbar.vala
index 2e869d8..b60eb91 100644
--- a/editor/adaptative-pathbar.vala
+++ b/editor/adaptative-pathbar.vala
@@ -39,7 +39,8 @@ private class AdaptativePathbar : Stack, Pathbar, AdaptativeWidget
private void create_large_pathbar ()
{
large_pathbar = new LargePathbar ();
- large_pathbar.valign = Align.CENTER;
+ large_pathbar.valign = Align.FILL;
+ large_pathbar.vexpand = true;
large_pathbar.show ();
add (large_pathbar);
large_pathbar_created = true;
diff --git a/editor/browser-headerbar.ui b/editor/browser-headerbar.ui
index 4ce5ff0..886bb2a 100644
--- a/editor/browser-headerbar.ui
+++ b/editor/browser-headerbar.ui
@@ -7,6 +7,7 @@
<child>
<object class="GtkButton" id="go_back_button">
<property name="visible">False</property>
+ <property name="valign">center</property>
<style>
<class name="image-button"/>
</style>
@@ -58,8 +59,9 @@
</object>
</child -->
<child type="title">
- <object class="GtkBox">
+ <object class="GtkBox" id="center_box">
<property name="visible">True</property>
+ <property name="valign">fill</property>
<property name="spacing">6</property>
<style>
<class name="centerwidget"/>
@@ -130,6 +132,7 @@
<child>
<object class="GtkMenuButton" id="quit_button">
<property name="visible">False</property>
+ <property name="valign">center</property>
<property name="action-name">app.quit</property>
<style>
<class name="titlebutton"/>
@@ -149,6 +152,7 @@
<child>
<object class="GtkButton" id="show_modifications_button">
<property name="visible">False</property>
+ <property name="valign">center</property>
<property name="action-name">ui.show-in-window-modifications</property>
<style>
<class name="titlebutton"/>
@@ -180,6 +184,7 @@
<child>
<object class="GtkMenuButton" id="modifications_actions_button">
<property name="visible">False</property>
+ <property name="valign">center</property>
<style>
<class name="image-button"/>
</style>
diff --git a/editor/browser-headerbar.vala b/editor/browser-headerbar.vala
index 7ee5480..17ca582 100644
--- a/editor/browser-headerbar.vala
+++ b/editor/browser-headerbar.vala
@@ -26,6 +26,7 @@ private class BrowserHeaderBar : HeaderBar, AdaptativeWidget
[GtkChild] private Revealer bookmarks_revealer;
[GtkChild] private Bookmarks bookmarks_button;
+ [GtkChild] private Box center_box;
[GtkChild] private Stack title_stack;
[GtkChild] private Label title_label;
@@ -167,6 +168,7 @@ private class BrowserHeaderBar : HeaderBar, AdaptativeWidget
construct
{
+ center_box.valign = Align.FILL;
install_action_entries ();
construct_modifications_actions_button_menu ();
}
diff --git a/editor/large-pathbar.css b/editor/large-pathbar.css
index dfbbd62..494c297 100644
--- a/editor/large-pathbar.css
+++ b/editor/large-pathbar.css
@@ -72,6 +72,18 @@ box.pathbar > label {
color:currentColor;
}
+.pathbar > button.invisible {
+ padding:0;
+ min-width:0;
+
+ border:none;
+ border-color:transparent;
+ box-shadow:none;
+ background:none;
+ background-color:transparent;
+ color:currentColor;
+}
+
/* items hacks */
.small-window.startup .pathbar > button > label.item { /* class remove after 0.3s */
transition:padding 0s;
diff --git a/editor/large-pathbar.vala b/editor/large-pathbar.vala
index 1eea3a0..3408bba 100644
--- a/editor/large-pathbar.vala
+++ b/editor/large-pathbar.vala
@@ -64,6 +64,11 @@ private class LargePathbar : Box, Pathbar
return;
_set_path (type, path);
+ if (invisible_button != null)
+ {
+ Variant variant = new Variant.string (complete_path);
+ ((!) invisible_button).set_detailed_action_name ("ui.open-search(" + variant.print (false) +
")");
+ }
update_active_button_cursor (type, ref active_button);
}
private void _set_path (ViewType type, string path)
@@ -79,6 +84,13 @@ private class LargePathbar : Box, Pathbar
bool destroy_all = false;
bool maintain_all = false;
@foreach ((child) => {
+ if (child is InvisibleButton)
+ {
+ child.destroy ();
+ invisible_button = null;
+ return;
+ }
+
if (child is Label)
{
if (destroy_all)
@@ -138,6 +150,7 @@ private class LargePathbar : Box, Pathbar
}
}
+ add_invisible_button ();
@foreach ((child) => child.show ());
}
private static inline void update_config_style_class (bool type_is_config, StyleContext context)
@@ -222,6 +235,14 @@ private class LargePathbar : Box, Pathbar
* * widgets management
\*/
+ InvisibleButton? invisible_button = null;
+
+ private void add_invisible_button ()
+ {
+ invisible_button = new InvisibleButton ();
+ add ((!) invisible_button);
+ }
+
private void add_slash_label ()
{
add (new Label ("/"));
@@ -282,6 +303,20 @@ private class LargePathbar : Box, Pathbar
}
}
+private class InvisibleButton : Button
+{
+ construct
+ {
+ set_detailed_action_name ("ui.open-search('/')");
+ hexpand = true;
+ vexpand = true;
+ can_focus = false;
+ focus_on_click = false;
+ StyleContext context = get_style_context ();
+ context.add_class ("invisible");
+ }
+}
+
[GtkTemplate (ui = "/ca/desrt/dconf-editor/ui/large-pathbar-item.ui")]
private class LargePathbarItem : Button
{
diff --git a/editor/pathwidget.ui b/editor/pathwidget.ui
index 4198e28..275fec9 100644
--- a/editor/pathwidget.ui
+++ b/editor/pathwidget.ui
@@ -2,11 +2,12 @@
<interface>
<!-- interface-requires gtk+ 3.0 -->
<template class="PathWidget" parent="GtkBox">
+ <property name="valign">fill</property>
<property name="spacing">6</property>
<child>
<object class="GtkStack" id="pathwidget_stack">
<property name="visible">True</property>
- <property name="valign">center</property>
+ <property name="valign">fill</property>
<property name="visible-child">pathbar_grid</property> <!-- uses the "id" attribute -->
<property name="transition-duration">300</property>
<property name="transition-type">crossfade</property>
@@ -28,7 +29,7 @@
<child>
<object class="AdaptativePathbar" id="pathbar">
<property name="visible">True</property>
- <property name="valign">center</property>
+ <property name="valign">fill</property>
</object>
</child>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]