[seahorse] common: Migrate SeahorseCatalog and SeahorseActions to vala



commit b6544dc54fd6c1da78d8bd368c74ff337e19fb87
Author: Stef Walter <stefw gnome org>
Date:   Thu Jun 20 22:13:50 2013 +0200

    common: Migrate SeahorseCatalog and SeahorseActions to vala

 common/Makefile.am                   |    5 +
 common/actions.vala                  |   81 +++++
 common/catalog.vala                  |  392 +++++++++++++++++++++
 common/config.vapi                   |   23 ++
 common/util.vala                     |   25 ++
 gkr/seahorse-gkr-actions.c           |    2 -
 gkr/seahorse-gkr-item-deleter.c      |    2 +-
 gkr/seahorse-gkr-keyring-deleter.c   |    2 +-
 gkr/seahorse-gkr-keyring.c           |    1 -
 libseahorse/Makefile.am              |    3 -
 libseahorse/seahorse-action.c        |  106 ------
 libseahorse/seahorse-action.h        |   44 ---
 libseahorse/seahorse-actions.c       |  160 ---------
 libseahorse/seahorse-actions.h       |   71 ----
 libseahorse/seahorse-catalog.c       |  619 ----------------------------------
 libseahorse/seahorse-catalog.h       |   83 -----
 libseahorse/seahorse-progress.c      |   23 +-
 libseahorse/seahorse-progress.h      |    7 +-
 pgp/seahorse-gpgme-generate.c        |    1 -
 pgp/seahorse-gpgme-key-deleter.c     |    2 +-
 pgp/seahorse-gpgme-secret-deleter.c  |    2 +-
 pgp/seahorse-keyserver-results.c     |   28 +-
 pgp/seahorse-keyserver-results.h     |    2 +-
 pgp/seahorse-keyserver-results.xml   |   12 +-
 pgp/seahorse-pgp-actions.c           |    3 +-
 pkcs11/seahorse-pkcs11-deleter.c     |    2 +-
 pkcs11/seahorse-pkcs11-generate.c    |    1 -
 pkcs11/seahorse-pkcs11-key-deleter.c |    2 +-
 pkcs11/seahorse-pkcs11-properties.c  |    1 -
 pkcs11/seahorse-pkcs11-request.c     |    1 -
 src/seahorse-generate-select.c       |    1 -
 src/seahorse-generate-select.h       |    2 +-
 src/seahorse-key-manager.c           |   68 ++--
 src/seahorse-key-manager.h           |    2 +-
 src/seahorse-key-manager.xml         |   18 +-
 src/seahorse-sidebar.c               |    2 -
 ssh/seahorse-ssh-actions.c           |    3 +-
 ssh/seahorse-ssh-deleter.c           |    2 +-
 ssh/seahorse-ssh-generate.c          |    1 -
 39 files changed, 598 insertions(+), 1207 deletions(-)
---
diff --git a/common/Makefile.am b/common/Makefile.am
index 067261f..96b10bd 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -1,14 +1,19 @@
 NULL =
 
+uidir = $(datadir)/seahorse/ui/
+
 INCLUDES = -I$(top_builddir) \
        -I$(top_srcdir) \
        -DPKGDATADIR=\""$(pkgdatadir)/"\" \
+       -DUIDIR=\""$(uidir)"\" \
        $(SEAHORSE_CFLAGS)
 
 noinst_LTLIBRARIES = libcommon.la
 
 libcommon_la_SOURCES = \
+       actions.vala \
        backend.vala \
+       catalog.vala \
        deletable.vala \
        delete-dialog.vala \
        deleter.vala \
diff --git a/common/actions.vala b/common/actions.vala
new file mode 100644
index 0000000..24a621d
--- /dev/null
+++ b/common/actions.vala
@@ -0,0 +1,81 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2008 Stefan Walter
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+namespace Seahorse {
+
+public class Action {
+       public static void pre_activate(Gtk.Action action,
+                                       Catalog? catalog,
+                                       Gtk.Window? window) {
+               action.set_data("seahorse-action-window", window);
+               action.set_data("seahorse-action-catalog", catalog);
+       }
+
+       public static void activate_with_window(Gtk.Action action,
+                                               Catalog? catalog,
+                                               Gtk.Window? window) {
+               pre_activate(action, catalog, window);
+               action.activate();
+               post_activate(action);
+       }
+
+       public static void post_activate(Gtk.Action action) {
+               action.set_data("seahorse-action-window", null);
+               action.set_data("seahorse-action-catalog", null);
+       }
+
+       public static Gtk.Window? get_window(Gtk.Action action) {
+               Gtk.Window? window = action.get_data("seahorse-action-window");
+               return window;
+       }
+
+       public static Catalog? get_catalog(Gtk.Action action) {
+               Catalog? catalog = action.get_data("seahorse-action-catalog");
+               return catalog;
+       }
+}
+
+public class Actions : Gtk.ActionGroup {
+       public Catalog? catalog {
+               owned get { return (Catalog)this._catalog.get(); }
+               set { this._catalog.set(value); }
+       }
+
+       public string? definition {
+               get { return this._definition; }
+       }
+
+       private unowned string? _definition;
+       private WeakRef _catalog;
+
+       Actions(string name) {
+               GLib.Object(
+                       name: name
+               );
+       }
+
+       public void register_definition (string definition) {
+               this._definition = definition;
+       }
+}
+
+}
diff --git a/common/catalog.vala b/common/catalog.vala
new file mode 100644
index 0000000..5650eac
--- /dev/null
+++ b/common/catalog.vala
@@ -0,0 +1,392 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2008 Stefan Walter
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+namespace Seahorse {
+
+public abstract class Catalog : Gtk.Window {
+       public static const string MENU_OBJECT = "ObjectPopup";
+
+       /* For compatibility with old code */
+       public Gtk.Window window {
+               get { return this; }
+       }
+
+       /* Set by the derived classes */
+       public string ui_name { construct; get; }
+
+       private Gtk.Builder _builder;
+       private Gtk.UIManager _ui_manager;
+       private GLib.HashTable<Gtk.ActionGroup, weak Gtk.ActionGroup> _actions;
+       private Gtk.Action _edit_delete;
+       private Gtk.Action _properties_object;
+       private Gtk.Action _file_export;
+       private Gtk.Action _edit_copy;
+       private GLib.List<Gtk.ActionGroup> _selection_actions;
+       private bool _disposed;
+       private GLib.Settings _settings;
+
+       public abstract GLib.List<weak Backend> get_backends();
+       public abstract Place? get_focused_place();
+       public abstract GLib.List<weak GLib.Object> get_selected_objects();
+
+       construct {
+               this._builder = Util.load_built_contents(this, this.ui_name);
+
+               this._actions = new GLib.HashTable<Gtk.ActionGroup, weak Gtk.ActionGroup>(GLib.direct_hash, 
GLib.direct_equal);
+               this._ui_manager = new Gtk.UIManager();
+
+               this._ui_manager.add_widget.connect((widget) => {
+                       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);
+                       if (holder != null) {
+                               ((Gtk.Container)holder).add(widget);
+                               widget.show();
+                       } else {
+                               GLib.warning ("no place holder found for: %s", name);
+                       }
+               });
+
+               this._ui_manager.pre_activate.connect((action) => {
+                       Action.pre_activate(action, this, this);
+               });
+
+               this._ui_manager.post_activate.connect((action) => {
+                       Action.post_activate(action);
+               });
+
+               /* Load window size for windows that aren't dialogs */
+               var key = "/apps/seahorse/windows/%s/".printf(this.ui_name);
+               this._settings = new GLib.Settings.with_path("org.gnome.seahorse.window", key);
+               var width = this._settings.get_int("width");
+               var height = this._settings.get_int("height");
+               if (width > 0 && height > 0)
+                       this.resize (width, height);
+
+               /* The widgts get added in an idle loop later */
+               try {
+                       var path = GLib.Path.build_filename(Config.UIDIR, 
"seahorse-%s.ui".printf(this.ui_name));
+                       this._ui_manager.add_ui_from_file(path);
+               } catch (GLib.Error err) {
+                       GLib.warning("couldn't load ui description for '%s': %s",
+                                    this.ui_name, err.message);
+               }
+
+               this.add_accel_group (this._ui_manager.get_accel_group());
+
+               var actions = new Gtk.ActionGroup("main");
+               actions.set_translation_domain(Config.GETTEXT_PACKAGE);
+               actions.add_actions(UI_ENTRIES, this);
+
+               var action = actions.get_action("app-preferences");
+               action.set_visible (Prefs.available());
+               this._edit_delete = actions.get_action("edit-delete");
+               this._properties_object = actions.get_action("properties-object");
+               this._edit_copy = actions.get_action("edit-export-clipboard");
+               this._file_export = actions.get_action("file-export");
+               this._ui_manager.insert_action_group (actions, 0);
+
+               Seahorse.Application.get().add_window(this);
+       }
+
+       public override void dispose() {
+               this._edit_copy = null;
+               this._edit_delete = null;
+               this._file_export = null;
+               this._properties_object = null;
+
+               foreach (var group in this._selection_actions)
+                       this._ui_manager.remove_action_group(group);
+               this._selection_actions = null;
+
+               this._ui_manager = null;
+               this._actions.remove_all();
+
+               if (!this._disposed) {
+                       this._disposed = true;
+
+                       int width, height;
+                       this.get_size(out width, out height);
+                       this._settings.set_int("width", width);
+                       this._settings.set_int("height", height);
+                       Seahorse.Application.get().remove_window (this);
+               }
+
+               base.dispose();
+       }
+
+       public virtual signal void selection_changed() {
+               bool can_properties = false;
+               bool can_delete = false;
+               bool can_export = false;
+
+               var objects = this.get_selected_objects();
+               foreach (var object in objects) {
+                       if (Exportable.can_export(object))
+                               can_export = true;
+                       if (Deletable.can_delete(object))
+                               can_delete = true;
+                       if (Viewable.can_view(object))
+                               can_properties = true;
+                       if (can_export && can_delete && can_properties)
+                               break;
+               }
+
+               this._properties_object.sensitive = can_properties;
+               this._edit_delete.sensitive = can_delete;
+               this._edit_copy.sensitive = can_export;
+               this._file_export.sensitive = can_export;
+
+               foreach (var group in this._selection_actions)
+                       group.visible = false;
+               this._selection_actions = lookup_actions_for_objects(objects);
+               foreach (var group in this._selection_actions)
+                       group.visible = true;
+       }
+
+       public unowned Gtk.Builder get_builder() {
+               return this._builder;
+       }
+
+       public unowned T? get_widget<T>(string name) {
+               return (T)this._builder.get_object(name);
+       }
+
+       public void ensure_updated() {
+               this._ui_manager.ensure_update();
+       }
+
+       public void include_actions(Gtk.ActionGroup group) {
+               this._ui_manager.insert_action_group(group, 10);
+
+               if (group is Actions) {
+                       var actions = (Actions)group;
+                       actions.catalog = this;
+
+                       var definition = actions.definition;
+                       if (definition != null) {
+                               try {
+                                       this._ui_manager.add_ui_from_string (definition, -1);
+                               } catch (GLib.Error err) {
+                                       GLib.warning ("couldn't add ui defintion for action group: %s: %s",
+                                                     actions.name, definition);
+                               }
+                       }
+               }
+
+               this._actions.add(group);
+       }
+
+       public void show_properties(GLib.Object obj) {
+               Viewable.view(obj, this);
+       }
+
+       public void show_context_menu(string name,
+                                     uint button,
+                                     uint time)
+       {
+               var path = "/%s".printf(name);
+               var menu = this._ui_manager.get_widget(path);
+
+               if (menu == null)
+                       return;
+               if (menu is Gtk.Menu) {
+                       ((Gtk.Menu)menu).popup(null, null, null, button, time);
+                       menu.show();
+               } else {
+                       GLib.warning("the object /%s isn't a menu", name);
+               }
+       }
+
+       private GLib.List<Gtk.ActionGroup> lookup_actions_for_objects (GLib.List<GLib.Object> objects) {
+               var table = new GLib.HashTable<Gtk.ActionGroup, weak Gtk.ActionGroup>(GLib.direct_hash, 
GLib.direct_equal);
+               foreach (var object in objects) {
+                       Gtk.ActionGroup? actions = null;
+                       object.get("actions", out actions, null);
+                       if (actions == null)
+                               continue;
+                       if (this._actions.lookup(actions) == null)
+                               this.include_actions(actions);
+                       this._actions.add(actions);
+               }
+
+               var iter = GLib.HashTableIter<Gtk.ActionGroup, weak Gtk.ActionGroup>(table);
+               var results = new GLib.List<Gtk.ActionGroup>();
+               Gtk.ActionGroup group;
+               while (iter.next(out group, null))
+                       results.prepend(group);
+
+               return results;
+       }
+
+       [CCode (instance_pos = -1)]
+       private void on_app_preferences (Gtk.Action action)
+       {
+               Prefs.show(this, null);
+       }
+
+       private static const string[] AUTHORS = {
+               "Jacob Perkins <jap1 users sourceforge net>",
+               "Jose Carlos Garcia Sogo <jsogo users sourceforge net>",
+               "Jean Schurger <yshark schurger org>",
+               "Stef Walter <stef memberwebs com>",
+               "Adam Schreiber <sadam clemson edu>",
+               "",
+               N_("Contributions:"),
+               "Albrecht Dreß <albrecht dress arcor de>",
+               "Jim Pharis <binbrain gmail com>",
+               null
+       };
+
+       private static const string[] DOCUMENTERS = {
+               "Jacob Perkins <jap1 users sourceforge net>",
+               "Adam Schreiber <sadam clemson edu>",
+               "Milo Casagrande <milo_casagrande yahoo it>",
+               null
+       };
+
+       private static const string[] ARTISTS = {
+               "Jacob Perkins <jap1 users sourceforge net>",
+               "Stef Walter <stef memberwebs com>",
+               null
+       };
+
+       [CCode (instance_pos = -1)]
+       private void on_app_about(Gtk.Action action)
+       {
+
+               var about = new Gtk.AboutDialog();
+               about.set_artists(ARTISTS);
+               about.set_authors(AUTHORS);
+               about.set_documenters(DOCUMENTERS);
+               about.set_version(Config.VERSION);
+               about.set_comments(_("Passwords and Keys"));
+               about.set_copyright("Copyright \xc2\xa9 2002 - 2010 Seahorse Project");
+               about.set_translator_credits(_("translator-credits"));
+               about.set_logo_icon_name("seahorse");
+               about.set_website("http://www.gnome.org/projects/seahorse";);
+               about.set_website_label(_("Seahorse Project Homepage"));
+
+               about.response.connect((response) => {
+                       about.hide();
+               });
+
+               about.set_transient_for(this);
+               about.run();
+               about.destroy();
+       }
+
+       [CCode (instance_pos = -1)]
+       private void on_object_delete(Gtk.Action action)
+       {
+               try {
+                       var objects = this.get_selected_objects();
+                       Deletable.delete_with_prompt_wait(objects, this);
+               } catch (GLib.Error err) {
+                       Util.show_error(window, _("Cannot delete"), err.message);
+               }
+       }
+
+       [CCode (instance_pos = -1)]
+       private void on_properties_object(Gtk.Action action) {
+               var objects = get_selected_objects();
+               if (objects.length() > 0)
+                       this.show_properties(objects.data);
+       }
+
+       [CCode (instance_pos = -1)]
+       private void on_properties_place (Gtk.Action action) {
+               var place = this.get_focused_place ();
+               if (place != null)
+                       this.show_properties (place);
+       }
+
+       [CCode (instance_pos = -1)]
+       private void on_key_export_file (Gtk.Action action) {
+               try {
+                       Exportable.export_to_prompt_wait(this.get_selected_objects(), this);
+               } catch (GLib.Error err) {
+                       Util.show_error(window, _("Couldn't export keys"), err.message);
+               }
+       }
+
+       [CCode (instance_pos = -1)]
+       private void on_key_export_clipboard (Gtk.Action action) {
+               uint8[] output;
+               try {
+                       var objects = this.get_selected_objects ();
+                       Exportable.export_to_text_wait (objects, out output);
+               } catch (GLib.Error err) {
+                       Util.show_error(this, _("Couldn't export data"), err.message);
+                       return;
+               }
+
+               /* TODO: Print message if only partially exported */
+
+               var board = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD);
+               board.set_text ((string)output, output.length);
+       }
+
+       [CCode (instance_pos = -1)]
+       private void on_help_show(Gtk.Action action) {
+               try {
+                       var document = "help:%s/introduction".printf(Config.PACKAGE);
+                       GLib.AppInfo.launch_default_for_uri(document, null);
+               } catch (GLib.Error err) {
+                       Util.show_error(this, _("Could not display help: %s"), err.message);
+               }
+       }
+
+       private static const Gtk.ActionEntry[] UI_ENTRIES = {
+               /* Top menu items */
+               { "file-menu", null, N_("_File") },
+               { "file-export", Gtk.Stock.SAVE_AS, N_("E_xport..."), null,
+                 N_("Export to a file"), on_key_export_file },
+               { "edit-menu", null, N_("_Edit") },
+               /*Translators: This text refers to deleting an item from its type's backing store*/
+               { "edit-export-clipboard", Gtk.Stock.COPY, null, "<control>C",
+                 N_("Copy to the clipboard"), on_key_export_clipboard },
+               { "edit-delete", Gtk.Stock.DELETE, N_("_Delete"), null,
+                 N_("Delete selected items"), on_object_delete },
+               { "properties-object", Gtk.Stock.PROPERTIES, null, null,
+                 N_("Show the properties of this item"), on_properties_object },
+               { "properties-keyring", Gtk.Stock.PROPERTIES, null, null,
+                 N_("Show the properties of this keyring"), on_properties_place },
+               { "app-preferences", Gtk.Stock.PREFERENCES, N_("Prefere_nces"), null,
+                 N_("Change preferences for this program"), on_app_preferences },
+               { "view-menu", null, N_("_View") },
+               { "help-menu", null, N_("_Help") },
+               { "app-about", Gtk.Stock.ABOUT, null, null,
+                 N_("About this program"), on_app_about },
+               { "help-show", Gtk.Stock.HELP, N_("_Contents"), "F1",
+                 N_("Show Seahorse help"), on_help_show }
+       };
+
+
+}
+
+}
diff --git a/common/config.vapi b/common/config.vapi
index 1e2ed4c..b814388 100644
--- a/common/config.vapi
+++ b/common/config.vapi
@@ -2,4 +2,27 @@
 namespace Config
 {
        public const string PKGDATADIR;
+       public const string UIDIR;
+
+       public const string VERSION;
+       public const string PACKAGE;
+       public const string GETTEXT_PACKAGE;
+}
+
+/*
+ * TODO: Temporary hacks for interfacing with some very simple C code in
+ * the current C code base. In general we want to port to vala instead of
+ * listing stuff here. Otherwise things will get unmanageable.
+ */
+namespace Seahorse {
+
+namespace Prefs {
+       public void show(Gtk.Window window, string? tabid);
+       public bool available();
+}
+
+namespace Application {
+       public unowned Gtk.Application @get();
+}
+
 }
diff --git a/common/util.vala b/common/util.vala
index beebc7d..96d660a 100644
--- a/common/util.vala
+++ b/common/util.vala
@@ -62,6 +62,31 @@ namespace Util {
                created_date.strftime(buffer, _("%Y-%m-%d"));
                return (string)buffer;
        }
+
+       public Gtk.Builder load_built_contents(Gtk.Container? frame,
+                                              string name) {
+               var builder = new Gtk.Builder();
+               string path = GLib.Path.build_filename(Config.UIDIR, "seahorse-%s.xml".printf(name));
+
+               if (frame != null && frame is Gtk.Dialog)
+                       frame = ((Gtk.Dialog)frame).get_content_area();
+
+               try {
+                       builder.add_from_file(path);
+                       var obj = builder.get_object(name);
+                       if (obj == null) {
+                               GLib.critical("Couldn't find object named %s in %s", name, path);
+                       } else if (frame != null) {
+                               var widget = (Gtk.Widget)obj;
+                               frame.add(widget);
+                               widget.show();
+                       }
+               } catch (GLib.Error err) {
+                       GLib.critical("Couldn't load %s: %s", path, err.message);
+               }
+
+               return builder;
+       }
 }
 
 }
diff --git a/gkr/seahorse-gkr-actions.c b/gkr/seahorse-gkr-actions.c
index 35ca9f0..361b93a 100644
--- a/gkr/seahorse-gkr-actions.c
+++ b/gkr/seahorse-gkr-actions.c
@@ -28,8 +28,6 @@
 #include "seahorse-gkr-keyring-deleter.h"
 #include "seahorse-gkr-dialogs.h"
 
-#include "seahorse-action.h"
-#include "seahorse-actions.h"
 #include "seahorse-common.h"
 #include "seahorse-object-list.h"
 #include "seahorse-progress.h"
diff --git a/gkr/seahorse-gkr-item-deleter.c b/gkr/seahorse-gkr-item-deleter.c
index c4550ba..eedd469 100644
--- a/gkr/seahorse-gkr-item-deleter.c
+++ b/gkr/seahorse-gkr-item-deleter.c
@@ -89,7 +89,7 @@ seahorse_gkr_item_deleter_create_confirm (SeahorseDeleter *deleter,
        dialog = seahorse_delete_dialog_new (parent, "%s", prompt);
        g_free (prompt);
 
-       return dialog;
+       return g_object_ref (dialog);
 }
 
 static GList *
diff --git a/gkr/seahorse-gkr-keyring-deleter.c b/gkr/seahorse-gkr-keyring-deleter.c
index a8ce921..bacf4bc 100644
--- a/gkr/seahorse-gkr-keyring-deleter.c
+++ b/gkr/seahorse-gkr-keyring-deleter.c
@@ -79,7 +79,7 @@ seahorse_gkr_keyring_deleter_create_confirm (SeahorseDeleter *deleter,
        seahorse_delete_dialog_set_check_label (SEAHORSE_DELETE_DIALOG (dialog), _("I understand that all 
items will be permanently deleted."));
        seahorse_delete_dialog_set_check_require (SEAHORSE_DELETE_DIALOG (dialog), TRUE);
 
-       return dialog;
+       return g_object_ref (dialog);
 }
 
 static GList *
diff --git a/gkr/seahorse-gkr-keyring.c b/gkr/seahorse-gkr-keyring.c
index e7313b0..8c3cfbf 100644
--- a/gkr/seahorse-gkr-keyring.c
+++ b/gkr/seahorse-gkr-keyring.c
@@ -29,7 +29,6 @@
 #include "seahorse-gkr-keyring.h"
 #include "seahorse-gkr-actions.h"
 
-#include "seahorse-action.h"
 #include "seahorse-common.h"
 #include "seahorse-progress.h"
 #include "seahorse-util.h"
diff --git a/libseahorse/Makefile.am b/libseahorse/Makefile.am
index 2bb8995..46679f9 100644
--- a/libseahorse/Makefile.am
+++ b/libseahorse/Makefile.am
@@ -43,11 +43,8 @@ KEYSERVER_SRCS =
 endif
 
 libseahorse_la_SOURCES = \
-       seahorse-action.c seahorse-action.h \
-       seahorse-actions.c seahorse-actions.h \
        seahorse-application.c seahorse-application.h \
        seahorse-bind.c seahorse-bind.h \
-       seahorse-catalog.c seahorse-catalog.h \
        seahorse-collection.c seahorse-collection.h \
        seahorse-debug.c seahorse-debug.h \
        seahorse-interaction.c seahorse-interaction.h \
diff --git a/libseahorse/seahorse-progress.c b/libseahorse/seahorse-progress.c
index 25f2f77..61d7bc8 100644
--- a/libseahorse/seahorse-progress.c
+++ b/libseahorse/seahorse-progress.c
@@ -45,7 +45,7 @@ typedef struct {
        GCancellable *cancellable;
        gulong cancelled_sig;
 
-       SeahorseWidget *swidget;
+       GtkBuilder *builder;
        gchar *title;
        gchar *notice;
        gboolean showing;
@@ -135,8 +135,8 @@ tracked_task_free (gpointer data)
        g_queue_free (task->parts);
        g_free (task->title);
        g_free (task->notice);
-       if (task->swidget)
-               g_object_unref (task->swidget);
+       if (task->builder)
+               g_object_unref (task->builder);
        g_free (task);
 }
 
@@ -191,21 +191,20 @@ progress_update_display (TrackedTask *task)
        gdouble fraction;
        guint id;
 
-       if (task->swidget == NULL)
+       if (task->builder == NULL)
                return;
 
        /* Dig out our progress display stuff */
-       widget = seahorse_widget_get_widget (task->swidget, "progress-bar");
+       widget = GTK_WIDGET (gtk_builder_get_object (task->builder, "progress-bar"));
        if (widget == NULL)
-               g_warning ("cannot display progress because seahorse window '%s' has no progress widget",
-                          task->swidget->name);
+               g_warning ("cannot display progress because seahorse window has no progress widget");
        else
                progress = GTK_PROGRESS_BAR (widget);
-       widget = GTK_WIDGET (gtk_builder_get_object (task->swidget->gtkbuilder, "status"));
+       widget = GTK_WIDGET (gtk_builder_get_object (task->builder, "status"));
        if (GTK_IS_STATUSBAR (widget)) {
                status = GTK_STATUSBAR (widget);
        } else {
-               widget = GTK_WIDGET (gtk_builder_get_object (task->swidget->gtkbuilder, "progress-details"));
+               widget = GTK_WIDGET (gtk_builder_get_object (task->builder, "progress-details"));
                if (GTK_IS_LABEL (widget))
                        label = GTK_LABEL (widget);
        }
@@ -563,7 +562,7 @@ on_timeout_show_progress (gpointer user_data)
 
        /* Allow attach to work */
        task->showing = FALSE;
-       seahorse_progress_attach (task->cancellable, swidget);
+       seahorse_progress_attach (task->cancellable, swidget->gtkbuilder);
        gtk_widget_show (GTK_WIDGET (window));
        g_object_unref (swidget);
 
@@ -617,7 +616,7 @@ seahorse_progress_show_with_notice (GCancellable *cancellable,
 
 void
 seahorse_progress_attach (GCancellable *cancellable,
-                          SeahorseWidget *swidget)
+                          GtkBuilder *builder)
 {
        TrackedTask *task;
 
@@ -638,7 +637,7 @@ seahorse_progress_attach (GCancellable *cancellable,
        }
 
        task->showing = TRUE;
-       task->swidget = g_object_ref (swidget);
+       task->builder = g_object_ref (builder);
 
        progress_update_display (task);
 }
diff --git a/libseahorse/seahorse-progress.h b/libseahorse/seahorse-progress.h
index 7cb3e5c..674dead 100644
--- a/libseahorse/seahorse-progress.h
+++ b/libseahorse/seahorse-progress.h
@@ -26,8 +26,7 @@
 #define __SEAHORSE_PROGRESS_H__
 
 #include <gio/gio.h>
-
-#include "seahorse-widget.h"
+#include <gtk/gtk.h>
 
 void          seahorse_progress_prep            (GCancellable *cancellable,
                                                  gconstpointer progress_tag,
@@ -59,7 +58,7 @@ void          seahorse_progress_show_with_notice (GCancellable *cancellable,
                                                  const gchar *notice,
                                                  gboolean delayed);
 
-void          seahorse_progress_attach          (GCancellable *cancellable,
-                                                 SeahorseWidget *swidget);
+void          seahorse_progress_attach           (GCancellable *cancellable,
+                                                  GtkBuilder *builder);
 
 #endif /* __SEAHORSE_PROGRESS_H__ */
diff --git a/pgp/seahorse-gpgme-generate.c b/pgp/seahorse-gpgme-generate.c
index ab65c96..1595da4 100644
--- a/pgp/seahorse-gpgme-generate.c
+++ b/pgp/seahorse-gpgme-generate.c
@@ -29,7 +29,6 @@
  
 #include "egg-datetime.h"
 
-#include "seahorse-action.h"
 #include "seahorse-common.h"
 #include "seahorse-passphrase.h"
 #include "seahorse-progress.h"
diff --git a/pgp/seahorse-gpgme-key-deleter.c b/pgp/seahorse-gpgme-key-deleter.c
index b16450f..99d35d0 100644
--- a/pgp/seahorse-gpgme-key-deleter.c
+++ b/pgp/seahorse-gpgme-key-deleter.c
@@ -87,7 +87,7 @@ seahorse_gpgme_key_deleter_create_confirm (SeahorseDeleter *deleter,
        dialog = seahorse_delete_dialog_new (parent, "%s", prompt);
        g_free (prompt);
 
-       return dialog;
+       return g_object_ref (dialog);
 }
 
 static GList *
diff --git a/pgp/seahorse-gpgme-secret-deleter.c b/pgp/seahorse-gpgme-secret-deleter.c
index 52a7147..a489418 100644
--- a/pgp/seahorse-gpgme-secret-deleter.c
+++ b/pgp/seahorse-gpgme-secret-deleter.c
@@ -83,7 +83,7 @@ seahorse_gpgme_secret_deleter_create_confirm (SeahorseDeleter *deleter,
        seahorse_delete_dialog_set_check_require (SEAHORSE_DELETE_DIALOG (dialog), TRUE);
 
        g_free (prompt);
-       return dialog;
+       return g_object_ref (dialog);
 }
 
 static GList *
diff --git a/pgp/seahorse-keyserver-results.c b/pgp/seahorse-keyserver-results.c
index 66387d2..30eee3f 100644
--- a/pgp/seahorse-keyserver-results.c
+++ b/pgp/seahorse-keyserver-results.c
@@ -35,13 +35,6 @@
 
 #include <string.h>
 
-gboolean              on_key_list_button_pressed           (GtkTreeView* view,
-                                                            GdkEventButton* event,
-                                                            SeahorseKeyserverResults* self);
-
-gboolean              on_key_list_popup_menu               (GtkTreeView* view,
-                                                            SeahorseKeyserverResults* self);
-
 enum {
        PROP_0,
        PROP_SEARCH
@@ -109,7 +102,7 @@ on_row_activated (GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *colum
                seahorse_catalog_show_properties (SEAHORSE_CATALOG (self), obj);
 }
 
-G_MODULE_EXPORT gboolean
+static gboolean
 on_key_list_button_pressed (GtkTreeView* view, GdkEventButton* event, SeahorseKeyserverResults* self)
 {
        g_return_val_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self), FALSE);
@@ -121,7 +114,7 @@ on_key_list_button_pressed (GtkTreeView* view, GdkEventButton* event, SeahorseKe
        return FALSE;
 }
 
-G_MODULE_EXPORT gboolean
+static gboolean
 on_key_list_popup_menu (GtkTreeView* view, SeahorseKeyserverResults* self)
 {
        GList *objects;
@@ -150,7 +143,7 @@ on_app_close (GtkAction* action, SeahorseKeyserverResults* self)
 {
        g_return_if_fail (SEAHORSE_IS_KEYSERVER_RESULTS (self));
        g_return_if_fail (action == NULL || GTK_IS_ACTION (action));
-       seahorse_widget_destroy (SEAHORSE_WIDGET (self));
+       gtk_widget_destroy (GTK_WIDGET (self));
 }
 
 static void
@@ -278,6 +271,7 @@ seahorse_keyserver_results_constructed (GObject *obj)
        GtkActionGroup* actions;
        GtkTreeSelection *selection;
        GtkWindow *window;
+       GtkBuilder *builder;
        char* title;
 
        G_OBJECT_CLASS (seahorse_keyserver_results_parent_class)->constructed (obj);
@@ -289,7 +283,10 @@ seahorse_keyserver_results_constructed (GObject *obj)
        }
 
        window = seahorse_catalog_get_window (SEAHORSE_CATALOG (self));
+       gtk_window_set_default_geometry(window, 640, 476);
+       gtk_widget_set_events (GTK_WIDGET (window), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
        gtk_window_set_title (window, title);
+       gtk_widget_set_visible (GTK_WIDGET (window), TRUE);
        g_free (title);
 
        g_signal_connect (window, "delete-event", G_CALLBACK (on_delete_event), self);
@@ -311,7 +308,8 @@ seahorse_keyserver_results_constructed (GObject *obj)
        seahorse_catalog_include_actions (SEAHORSE_CATALOG (self), self->pv->import_actions);
 
        /* init key list & selection settings */
-       self->pv->view = GTK_TREE_VIEW (seahorse_widget_get_widget (SEAHORSE_WIDGET (self), "key_list"));
+       builder = seahorse_catalog_get_builder (SEAHORSE_CATALOG (self));
+       self->pv->view = GTK_TREE_VIEW (gtk_builder_get_object (builder, "key_list"));
        selection = gtk_tree_view_get_selection (self->pv->view);
        gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
        g_signal_connect_object (selection, "changed", G_CALLBACK (on_view_selection_changed), self, 0);
@@ -325,7 +323,7 @@ seahorse_keyserver_results_constructed (GObject *obj)
 
        /* To avoid flicker */
        seahorse_catalog_ensure_updated (SEAHORSE_CATALOG (self));
-       seahorse_widget_show (SEAHORSE_WIDGET (SEAHORSE_CATALOG (self)));
+       gtk_widget_show (GTK_WIDGET (self));
 
        self->pv->store = seahorse_key_manager_store_new (GCR_COLLECTION (self->pv->collection),
                                                          self->pv->view,
@@ -503,11 +501,12 @@ seahorse_keyserver_results_show (const char* search_text)
 {
        SeahorseKeyserverResults* self;
        GCancellable *cancellable;
+       GtkBuilder *builder;
 
        g_return_if_fail (search_text != NULL);
 
        self = g_object_new (SEAHORSE_TYPE_KEYSERVER_RESULTS,
-                            "name", "keyserver-results",
+                            "ui-name", "keyserver-results",
                             "search", search_text,
                             NULL);
 
@@ -521,7 +520,8 @@ seahorse_keyserver_results_show (const char* search_text)
                                                  cancellable, on_search_completed,
                                                  g_object_ref (self));
 
-       seahorse_progress_attach (cancellable, SEAHORSE_WIDGET (self));
+       builder = seahorse_catalog_get_builder (SEAHORSE_CATALOG (self));
+       seahorse_progress_attach (cancellable, builder);
 
        g_object_unref (cancellable);
 }
diff --git a/pgp/seahorse-keyserver-results.h b/pgp/seahorse-keyserver-results.h
index aa72dcf..76401ca 100644
--- a/pgp/seahorse-keyserver-results.h
+++ b/pgp/seahorse-keyserver-results.h
@@ -27,7 +27,7 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 
-#include "seahorse-catalog.h"
+#include "seahorse-common.h"
 #include "seahorse-object.h"
 
 G_BEGIN_DECLS
diff --git a/pgp/seahorse-keyserver-results.xml b/pgp/seahorse-keyserver-results.xml
index 6e02305..5a3a672 100644
--- a/pgp/seahorse-keyserver-results.xml
+++ b/pgp/seahorse-keyserver-results.xml
@@ -2,13 +2,7 @@
 <interface>
   <requires lib="gtk+" version="2.16"/>
   <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkWindow" id="keyserver-results">
-    <property name="visible">True</property>
-    <property name="title" translatable="yes">window1</property>
-    <property name="default_width">640</property>
-    <property name="default_height">476</property>
-    <child>
-      <object class="GtkVBox" id="vbox2">
+      <object class="GtkVBox" id="keyserver-results">
         <property name="visible">True</property>
         <child>
           <object class="GtkVBox" id="menu-placeholder">
@@ -49,8 +43,6 @@
                     <property name="can_focus">True</property>
                     <property name="border_width">12</property>
                     <property name="rules_hint">True</property>
-                    <signal name="button_press_event" handler="on_key_list_button_pressed"/>
-                    <signal name="popup_menu" handler="on_key_list_popup_menu"/>
                   </object>
                 </child>
               </object>
@@ -92,6 +84,4 @@
           </packing>
         </child>
       </object>
-    </child>
-  </object>
 </interface>
diff --git a/pgp/seahorse-pgp-actions.c b/pgp/seahorse-pgp-actions.c
index c298f23..2e82a91 100644
--- a/pgp/seahorse-pgp-actions.c
+++ b/pgp/seahorse-pgp-actions.c
@@ -34,8 +34,6 @@
 #include "seahorse-keyserver-search.h"
 #include "seahorse-keyserver-sync.h"
 
-#include "seahorse-action.h"
-#include "seahorse-actions.h"
 #include "seahorse-common.h"
 #include "seahorse-object.h"
 #include "seahorse-object-list.h"
@@ -100,6 +98,7 @@ on_remote_sync (GtkAction* action,
                }
                g_list_free (objects);
        }
+       g_object_unref (catalog);
 
        if (keys == NULL) {
                keyring = seahorse_pgp_backend_get_default_keyring (NULL);
diff --git a/pkcs11/seahorse-pkcs11-deleter.c b/pkcs11/seahorse-pkcs11-deleter.c
index b2458fa..36d3577 100644
--- a/pkcs11/seahorse-pkcs11-deleter.c
+++ b/pkcs11/seahorse-pkcs11-deleter.c
@@ -75,7 +75,7 @@ seahorse_pkcs11_deleter_create_confirm (SeahorseDeleter *deleter,
        dialog = seahorse_delete_dialog_new (parent, "%s", prompt);
        g_free (prompt);
 
-       return dialog;
+       return g_object_ref (dialog);
 }
 
 static GList *
diff --git a/pkcs11/seahorse-pkcs11-generate.c b/pkcs11/seahorse-pkcs11-generate.c
index ac5c261..8b39512 100644
--- a/pkcs11/seahorse-pkcs11-generate.c
+++ b/pkcs11/seahorse-pkcs11-generate.c
@@ -26,7 +26,6 @@
 #include "seahorse-pkcs11-generate.h"
 #include "seahorse-token.h"
 
-#include "seahorse-action.h"
 #include "seahorse-common.h"
 #include "seahorse-progress.h"
 #include "seahorse-interaction.h"
diff --git a/pkcs11/seahorse-pkcs11-key-deleter.c b/pkcs11/seahorse-pkcs11-key-deleter.c
index d16ec18..eb33a31 100644
--- a/pkcs11/seahorse-pkcs11-key-deleter.c
+++ b/pkcs11/seahorse-pkcs11-key-deleter.c
@@ -86,7 +86,7 @@ seahorse_pkcs11_key_deleter_create_confirm (SeahorseDeleter *deleter,
        seahorse_delete_dialog_set_check_require (SEAHORSE_DELETE_DIALOG (dialog), TRUE);
 
        g_free (prompt);
-       return dialog;
+       return g_object_ref (dialog);
 }
 
 static gboolean
diff --git a/pkcs11/seahorse-pkcs11-properties.c b/pkcs11/seahorse-pkcs11-properties.c
index e60b539..a8efa84 100644
--- a/pkcs11/seahorse-pkcs11-properties.c
+++ b/pkcs11/seahorse-pkcs11-properties.c
@@ -28,7 +28,6 @@
 #include "seahorse-pkcs11-request.h"
 #include "seahorse-private-key.h"
 
-#include "seahorse-action.h"
 #include "seahorse-common.h"
 #include "seahorse-progress.h"
 #include "seahorse-util.h"
diff --git a/pkcs11/seahorse-pkcs11-request.c b/pkcs11/seahorse-pkcs11-request.c
index dae1df2..69d526c 100644
--- a/pkcs11/seahorse-pkcs11-request.c
+++ b/pkcs11/seahorse-pkcs11-request.c
@@ -25,7 +25,6 @@
 #include "seahorse-pkcs11-request.h"
 #include "seahorse-token.h"
 
-#include "seahorse-action.h"
 #include "seahorse-progress.h"
 #include "seahorse-interaction.h"
 #include "seahorse-util.h"
diff --git a/src/seahorse-generate-select.c b/src/seahorse-generate-select.c
index b3fbbe3..79935c4 100644
--- a/src/seahorse-generate-select.c
+++ b/src/seahorse-generate-select.c
@@ -23,7 +23,6 @@
 
 #include "seahorse-generate-select.h"
 
-#include "seahorse-action.h"
 #include "seahorse-common.h"
 
 #include <glib/gi18n.h>
diff --git a/src/seahorse-generate-select.h b/src/seahorse-generate-select.h
index f3d89cb..6da9c91 100644
--- a/src/seahorse-generate-select.h
+++ b/src/seahorse-generate-select.h
@@ -25,7 +25,7 @@
 #include <glib.h>
 #include <glib-object.h>
 
-#include "seahorse-widget.h"
+#include <gtk/gtk.h>
 
 void               seahorse_generate_select_show       (GtkWindow *parent);
 
diff --git a/src/seahorse-key-manager.c b/src/seahorse-key-manager.c
index 171e37b..d7c0b99 100644
--- a/src/seahorse-key-manager.c
+++ b/src/seahorse-key-manager.c
@@ -22,6 +22,7 @@
 
 #include "config.h"
 
+#include "seahorse-application.h"
 #include "seahorse-generate-select.h"
 #include "seahorse-import-dialog.h"
 #include "seahorse-key-manager.h"
@@ -40,24 +41,6 @@ enum {
        SHOW_TRUSTED,
 };
 
-void           on_keymanager_row_activated              (GtkTreeView* view,
-                                                         GtkTreePath* path,
-                                                         GtkTreeViewColumn* column,
-                                                         SeahorseKeyManager* self);
-
-gboolean       on_keymanager_key_list_button_pressed    (GtkTreeView* view,
-                                                         GdkEventButton* event,
-                                                         SeahorseKeyManager* self);
-
-gboolean       on_keymanager_key_list_popup_menu        (GtkTreeView* view,
-                                                         SeahorseKeyManager* self);
-
-void           on_keymanager_new_button                 (GtkButton* button,
-                                                         SeahorseKeyManager* self);
-
-void           on_keymanager_import_button              (GtkButton* button,
-                                                         SeahorseKeyManager* self);
-
 struct _SeahorseKeyManagerPrivate {
        GtkActionGroup* view_actions;
        GtkRadioAction *show_action;
@@ -105,7 +88,7 @@ on_view_selection_changed (GtkTreeSelection* selection, SeahorseKeyManager* self
        g_idle_add ((GSourceFunc)fire_selection_changed, self);
 }
 
-G_MODULE_EXPORT void
+static void
 on_keymanager_row_activated (GtkTreeView* view, GtkTreePath* path, 
                                   GtkTreeViewColumn* column, SeahorseKeyManager* self) 
 {
@@ -121,7 +104,7 @@ on_keymanager_row_activated (GtkTreeView* view, GtkTreePath* path,
                seahorse_catalog_show_properties (SEAHORSE_CATALOG (self), obj);
 }
 
-G_MODULE_EXPORT gboolean
+static gboolean
 on_keymanager_key_list_button_pressed (GtkTreeView* view, GdkEventButton* event, SeahorseKeyManager* self) 
 {
        g_return_val_if_fail (SEAHORSE_IS_KEY_MANAGER (self), FALSE);
@@ -135,7 +118,7 @@ on_keymanager_key_list_button_pressed (GtkTreeView* view, GdkEventButton* event,
        return FALSE;
 }
 
-G_MODULE_EXPORT gboolean
+static gboolean
 on_keymanager_key_list_popup_menu (GtkTreeView* view, SeahorseKeyManager* self) 
 {
        GList *objects;
@@ -157,7 +140,7 @@ on_file_new (GtkAction* action, SeahorseKeyManager* self)
        seahorse_generate_select_show (seahorse_catalog_get_window (SEAHORSE_CATALOG (self)));
 }
 
-G_MODULE_EXPORT void 
+static void
 on_keymanager_new_button (GtkButton* button, SeahorseKeyManager* self) 
 {
        g_return_if_fail (SEAHORSE_IS_KEY_MANAGER (self));
@@ -179,7 +162,7 @@ on_first_timer (SeahorseKeyManager* self)
         */
 
        if (gcr_collection_get_length (GCR_COLLECTION (self->pv->collection)) == 0) {
-               widget = seahorse_widget_get_widget (SEAHORSE_WIDGET (self), "first-time-box");
+               widget = xxwidget_get_widget (XX_WIDGET (self), "first-time-box");
                gtk_widget_show (widget);
        }
        
@@ -329,7 +312,7 @@ on_key_import_file (GtkAction* action, SeahorseKeyManager* self)
        import_prompt (self);
 }
 
-G_MODULE_EXPORT void 
+static void
 on_keymanager_import_button (GtkButton* button, SeahorseKeyManager* self) 
 {
        g_return_if_fail (SEAHORSE_IS_KEY_MANAGER (self));
@@ -591,11 +574,13 @@ setup_sidebar (SeahorseKeyManager *self)
        GtkActionGroup *actions;
        GtkAction *action;
        GList *backends, *l;
+       GtkBuilder *builder;
 
        self->pv->sidebar = seahorse_sidebar_new ();
 
        self->pv->sidebar_width = g_settings_get_int (self->pv->settings, "sidebar-width");
-       panes = seahorse_widget_get_widget (SEAHORSE_WIDGET (self), "sidebar-panes");
+       builder = seahorse_catalog_get_builder (SEAHORSE_CATALOG (self));
+       panes = GTK_WIDGET (gtk_builder_get_object (builder, "sidebar-panes"));
        gtk_paned_set_position (GTK_PANED (panes), self->pv->sidebar_width);
        g_signal_connect (panes, "realize", G_CALLBACK (on_panes_realize), self);
        g_signal_connect (panes, "unrealize", G_CALLBACK (on_panes_unrealize), self);
@@ -614,7 +599,7 @@ setup_sidebar (SeahorseKeyManager *self)
                }
        }
 
-       area = seahorse_widget_get_widget (SEAHORSE_WIDGET (self), "sidebar-area");
+       area = GTK_WIDGET (gtk_builder_get_object (builder, "sidebar-area"));
        gtk_container_add (GTK_CONTAINER (area), GTK_WIDGET (self->pv->sidebar));
        gtk_widget_show (GTK_WIDGET (self->pv->sidebar));
 
@@ -651,15 +636,21 @@ seahorse_key_manager_constructed (GObject *object)
        GtkTreeSelection *selection;
        GtkWidget* widget;
        GtkAction *action;
+       GtkWindow *window;
+       GtkBuilder *builder;
 
        G_OBJECT_CLASS (seahorse_key_manager_parent_class)->constructed (object);
 
+       window = seahorse_catalog_get_window (SEAHORSE_CATALOG (self));
+       gtk_window_set_default_geometry(window, 640, 476);
+       gtk_widget_set_events (GTK_WIDGET (window), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
        gtk_window_set_title (seahorse_catalog_get_window (SEAHORSE_CATALOG (self)), _("Passwords and Keys"));
 
        self->pv->collection = setup_sidebar (self);
 
        /* Init key list & selection settings */
-       self->pv->view = GTK_TREE_VIEW (seahorse_widget_get_widget (SEAHORSE_WIDGET (self), "key-list"));
+       builder = seahorse_catalog_get_builder (SEAHORSE_CATALOG (self));
+       self->pv->view = GTK_TREE_VIEW (gtk_builder_get_object (builder, "key-list"));
        g_return_if_fail (self->pv->view != NULL);
 
        selection = gtk_tree_view_get_selection (self->pv->view);
@@ -694,17 +685,17 @@ seahorse_key_manager_constructed (GObject *object)
        on_item_filter_changed (self->pv->settings, "item-filter", self);
 
        /* first time signals */
-       g_signal_connect_object (seahorse_widget_get_widget (SEAHORSE_WIDGET (self), "import-button"), 
+       g_signal_connect_object (gtk_builder_get_object (builder, "import-button"),
                                 "clicked", G_CALLBACK (on_keymanager_import_button), self, 0);
 
-       g_signal_connect_object (seahorse_widget_get_widget (SEAHORSE_WIDGET (self), "new-button"), 
+       g_signal_connect_object (gtk_builder_get_object (builder, "new-button"),
                                 "clicked", G_CALLBACK (on_keymanager_new_button), self, 0);
 
        /* Flush all updates */
        seahorse_catalog_ensure_updated (SEAHORSE_CATALOG (self));
        
        /* Find the toolbar */
-       widget = seahorse_widget_get_widget (SEAHORSE_WIDGET (self), "toolbar-placeholder");
+       widget = GTK_WIDGET (gtk_builder_get_object (builder, "toolbar-placeholder"));
        if (widget != NULL) {
                GList* children = gtk_container_get_children ((GTK_CONTAINER (widget)));
                if (children != NULL && children->data != NULL) {
@@ -762,7 +753,7 @@ seahorse_key_manager_constructed (GObject *object)
        g_signal_emit_by_name (self, "selection-changed");
 
        /* To avoid flicker */
-       seahorse_widget_show (SEAHORSE_WIDGET (SEAHORSE_CATALOG (self)));
+       gtk_widget_show (GTK_WIDGET (self));
        
        /* Setup drops */
        gtk_drag_dest_set (GTK_WIDGET (seahorse_catalog_get_window (SEAHORSE_CATALOG (self))),
@@ -775,6 +766,13 @@ seahorse_key_manager_constructed (GObject *object)
        g_signal_connect_object (seahorse_catalog_get_window (SEAHORSE_CATALOG (self)), "drag-data-received",
                                 G_CALLBACK (on_target_drag_data_received), self, 0);
 
+       g_signal_connect (self->pv->view, "button-press-event",
+                         G_CALLBACK (on_keymanager_key_list_button_pressed), self);
+       g_signal_connect (self->pv->view, "row-activated",
+                         G_CALLBACK (on_keymanager_row_activated), self);
+       g_signal_connect (self->pv->view, "popup-menu",
+                         G_CALLBACK (on_keymanager_key_list_popup_menu), self);
+
 #ifdef REFACTOR_FIRST
        /* To show first time dialog */
        g_timeout_add_seconds (1, (GSourceFunc)on_first_timer, self);
@@ -827,11 +825,5 @@ seahorse_key_manager_class_init (SeahorseKeyManagerClass *klass)
 void
 seahorse_key_manager_show (void)
 {
-       SeahorseWidget *self;
-
-       self = seahorse_widget_find ("key-manager");
-       if (self != NULL)
-               gtk_window_present (GTK_WINDOW (seahorse_widget_get_widget (self, self->name)));
-       else
-               g_object_new (SEAHORSE_TYPE_KEY_MANAGER, "name", "key-manager", NULL);
+       g_object_new (SEAHORSE_TYPE_KEY_MANAGER, "ui-name", "key-manager", NULL);
 }
diff --git a/src/seahorse-key-manager.h b/src/seahorse-key-manager.h
index 4f82636..a7e84b5 100644
--- a/src/seahorse-key-manager.h
+++ b/src/seahorse-key-manager.h
@@ -28,7 +28,7 @@
 
 #include <gcr/gcr.h>
 
-#include "seahorse-catalog.h"
+#include "seahorse-common.h"
 
 G_BEGIN_DECLS
 
diff --git a/src/seahorse-key-manager.xml b/src/seahorse-key-manager.xml
index ea8f3d5..4e15bf5 100644
--- a/src/seahorse-key-manager.xml
+++ b/src/seahorse-key-manager.xml
@@ -1,14 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="3.0"/>
-  <object class="GtkWindow" id="key-manager">
-    <property name="can_focus">False</property>
-    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
-    <property name="default_width">640</property>
-    <property name="default_height">476</property>
-    <signal name="delete-event" handler="on_widget_delete_event" swapped="no"/>
-    <child>
-      <object class="GtkVBox" id="vbox1">
+      <object class="GtkVBox" id="key-manager">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <child>
@@ -72,9 +65,6 @@
                         <property name="margin_left">12</property>
                         <property name="margin_right">12</property>
                         <property name="rules_hint">True</property>
-                        <signal name="button-press-event" handler="on_keymanager_key_list_button_pressed" 
swapped="no"/>
-                        <signal name="row-activated" handler="on_keymanager_row_activated" swapped="no"/>
-                        <signal name="popup-menu" handler="on_keymanager_key_list_popup_menu" swapped="no"/>
                         <child internal-child="selection">
                           <object class="GtkTreeSelection" id="treeview-selection"/>
                         </child>
@@ -144,7 +134,6 @@
                                 <property name="receives_default">True</property>
                                 <property name="use_action_appearance">False</property>
                                 <property name="use_stock">True</property>
-                                <signal name="clicked" handler="on_keymanager_new_button" swapped="no"/>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
@@ -174,10 +163,8 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="can_default">True</property>
-                                <property name="has_default">True</property>
                                 <property name="receives_default">True</property>
                                 <property name="use_action_appearance">False</property>
-                                <signal name="clicked" handler="on_keymanager_import_button" swapped="no"/>
                                 <child>
                                   <object class="GtkAlignment" id="alignment6">
                                     <property name="visible">True</property>
@@ -248,7 +235,6 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="can_default">True</property>
-                                <property name="has_default">True</property>
                                 <property name="receives_default">True</property>
                                 <property name="use_action_appearance">False</property>
                                 <property name="use_stock">True</property>
@@ -304,6 +290,4 @@
           </packing>
         </child>
       </object>
-    </child>
-  </object>
 </interface>
diff --git a/src/seahorse-sidebar.c b/src/seahorse-sidebar.c
index b7fcb78..19991d0 100644
--- a/src/seahorse-sidebar.c
+++ b/src/seahorse-sidebar.c
@@ -23,8 +23,6 @@
 
 #include "seahorse-sidebar.h"
 
-#include "seahorse-action.h"
-#include "seahorse-actions.h"
 #include "seahorse-common.h"
 #include "seahorse-interaction.h"
 #include "seahorse-util.h"
diff --git a/ssh/seahorse-ssh-actions.c b/ssh/seahorse-ssh-actions.c
index cfe5b6d..c966742 100644
--- a/ssh/seahorse-ssh-actions.c
+++ b/ssh/seahorse-ssh-actions.c
@@ -27,8 +27,6 @@
 #include "seahorse-ssh-dialogs.h"
 #include "seahorse-ssh-operation.h"
 
-#include "seahorse-action.h"
-#include "seahorse-actions.h"
 #include "seahorse-common.h"
 #include "seahorse-object.h"
 #include "seahorse-object-list.h"
@@ -90,6 +88,7 @@ on_ssh_upload (GtkAction* action,
                }
                g_list_free (objects);
        }
+       g_object_unref (catalog);
 
        seahorse_ssh_upload_prompt (keys, seahorse_action_get_window (action));
        g_list_free (keys);
diff --git a/ssh/seahorse-ssh-deleter.c b/ssh/seahorse-ssh-deleter.c
index 851e91a..5bb5818 100644
--- a/ssh/seahorse-ssh-deleter.c
+++ b/ssh/seahorse-ssh-deleter.c
@@ -103,7 +103,7 @@ seahorse_ssh_deleter_create_confirm (SeahorseDeleter *deleter,
                seahorse_delete_dialog_set_check_require (SEAHORSE_DELETE_DIALOG (dialog), TRUE);
        }
 
-       return dialog;
+       return g_object_ref (dialog);
 }
 
 static GList *
diff --git a/ssh/seahorse-ssh-generate.c b/ssh/seahorse-ssh-generate.c
index a3c4840..4d917fc 100644
--- a/ssh/seahorse-ssh-generate.c
+++ b/ssh/seahorse-ssh-generate.c
@@ -32,7 +32,6 @@
 #include "seahorse-ssh-key.h"
 #include "seahorse-ssh-operation.h"
 
-#include "seahorse-action.h"
 #include "seahorse-common.h"
 #include "seahorse-progress.h"
 #include "seahorse-util.h"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]