[seahorse] KeyManager: don't use a GtkAction for new-object.
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] KeyManager: don't use a GtkAction for new-object.
- Date: Sat, 5 May 2018 09:40:34 +0000 (UTC)
commit aa59bfee0be06da07d29e00ba6ee82db9bf8356d
Author: Niels De Graef <nielsdegraef gmail com>
Date: Thu May 3 22:13:03 2018 +0200
KeyManager: don't use a GtkAction for new-object.
common/catalog.vala | 2 -
src/key-manager.vala | 53 ++---------------------------------
src/seahorse-key-manager-widgets.ui | 4 --
src/seahorse-key-manager.ui | 31 +++++++++++++++++++-
4 files changed, 32 insertions(+), 58 deletions(-)
---
diff --git a/common/catalog.vala b/common/catalog.vala
index 4a67bc0..5e066be 100644
--- a/common/catalog.vala
+++ b/common/catalog.vala
@@ -56,8 +56,6 @@ public abstract class Catalog : Gtk.Window {
unowned string? name;
if (widget is Gtk.MenuBar)
name = "menu-placeholder";
- else if (widget is Gtk.Toolbar)
- name = "toolbar-placeholder";
else
name = null;
var holder = this._builder.get_object(name);
diff --git a/src/key-manager.vala b/src/key-manager.vala
index 97762fb..cd220c8 100644
--- a/src/key-manager.vala
+++ b/src/key-manager.vala
@@ -53,7 +53,6 @@ public class Seahorse.KeyManager : Catalog {
{ "new-menu", null, N_("_New") },
{ "app-quit", Gtk.Stock.QUIT, null, "<control>Q", N_("Close this program") },
{ "file-new", Gtk.Stock.NEW, N_("_New…"), "<control>N", N_("Create a new key or item") },
- { "new-object", Gtk.Stock.ADD, N_("_New…"), null, N_("Add a new key or item") },
{ "file-import", Gtk.Stock.OPEN, N_("_Import…"), "<control>I", N_("Import from a file") },
{ "edit-import-clipboard", Gtk.Stock.PASTE, null, "<control>V", N_("Import from the clipboard") }
};
@@ -111,45 +110,10 @@ public class Seahorse.KeyManager : Catalog {
// Flush all updates
ensure_updated();
- // Find the toolbar
- Gtk.Container placeholder = (Gtk.Container) builder.get_object("toolbar-placeholder");
- if (placeholder != null) {
- List<weak Gtk.Widget> children = placeholder.get_children();
- if (children != null && children.data != null) {
- // The toolbar is the first (and only) element
- Gtk.Toolbar toolbar = (Gtk.Toolbar) children.data;
- if (toolbar != null) {
- toolbar.get_style_context().add_class("sidebar");
- toolbar.reset_style();
-
- // Insert a separator to right align the filter
- Gtk.SeparatorToolItem sep = new Gtk.SeparatorToolItem();
- sep.set_draw(false);
- sep.set_expand(true);
- sep.show_all();
- toolbar.insert(sep, -1);
-
- // Insert a filter bar
- Gtk.Box box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
-
- this.filter_entry = new Gtk.Entry();
- this.filter_entry.set_placeholder_text(_("Filter"));
- box.pack_start(this.filter_entry, false, true, 0);
-
- box.pack_start(new Gtk.Label(null), false, false, 0);
- box.show_all();
-
- Gtk.ToolItem item = new Gtk.ToolItem();
- item.add(box);
- item.show_all();
- toolbar.insert(item, -1);
- }
- }
- }
-
+ // The toolbar
+ ((Gtk.Button) builder.get_object("new_item_button")).clicked.connect(on_keymanager_new_button);
+ this.filter_entry = (Gtk.Entry) builder.get_object("filter_entry");
on_filter_changed(this.filter_entry);
- this.filter_entry.set_width_chars(30);
- this.filter_entry.icon_release.connect(() => this.filter_entry.set_text(""));
// For the filtering
this.filter_entry.changed.connect(on_filter_changed);
@@ -193,7 +157,6 @@ public class Seahorse.KeyManager : Catalog {
actions.add_actions(GENERAL_ACTIONS, null);
actions.get_action("app-quit").activate.connect(on_app_quit);
actions.get_action("file-new").activate.connect(on_file_new);
- actions.get_action("new-object").activate.connect(on_file_new);
actions.get_action("file-import").activate.connect(on_key_import_file);
actions.get_action("edit-import-clipboard").activate.connect(on_key_import_clipboard);
include_actions(actions);
@@ -261,16 +224,6 @@ public class Seahorse.KeyManager : Catalog {
private void on_filter_changed(Gtk.Editable entry) {
string? text = this.filter_entry.get_text();
this.store.filter = text;
-
- if (text == null || text == "") {
- this.filter_entry.secondary_icon_name = "edit-find-symbolic";
- this.filter_entry.secondary_icon_activatable = false;
- this.filter_entry.secondary_icon_sensitive = false;
- } else {
- this.filter_entry.secondary_icon_name = "edit-clear-symbolic";
- this.filter_entry.secondary_icon_activatable = true;
- this.filter_entry.secondary_icon_sensitive = true;
- }
}
private void import_files(string[]? uris) {
diff --git a/src/seahorse-key-manager-widgets.ui b/src/seahorse-key-manager-widgets.ui
index e110797..b97f883 100644
--- a/src/seahorse-key-manager-widgets.ui
+++ b/src/seahorse-key-manager-widgets.ui
@@ -33,10 +33,6 @@
</menubar>
- <toolbar name="MainToolbar">
- <toolitem action="new-object"/>
- </toolbar>
-
<popup name="ObjectPopup">
<menuitem action="edit-delete"/>
<separator/>
diff --git a/src/seahorse-key-manager.ui b/src/seahorse-key-manager.ui
index 4e15bf5..7545eed 100644
--- a/src/seahorse-key-manager.ui
+++ b/src/seahorse-key-manager.ui
@@ -41,11 +41,38 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkVBox" id="toolbar-placeholder">
+ <object class="GtkBox">
<property name="visible">True</property>
+ <property name="orientation">horizontal</property>
<property name="can_focus">False</property>
+ <property name="margin_start">12</property>
+ <property name="margin_end">12</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
<child>
- <placeholder/>
+ <object class="GtkButton" id="new_item_button">
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="halign">start</property>
+ <property name="tooltip_text" translatable="yes">Add a new key or item</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon_name">list-add</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSearchEntry" id="filter_entry">
+ <property name="visible">True</property>
+ <property name="width_chars">30</property>
+ <property name="placeholder_text" translatable="yes">Filter</property>
+ </object>
</child>
</object>
<packing>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]