[seahorse/wip/nielsdg/pgp-keyserver-search: 2/2] pgp: KeyserverSearch: use GtkTemplate



commit 18f8c4e8707e784397b8a1b58fa03fe97ae9c265
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Tue Jan 29 08:09:28 2019 +0100

    pgp: KeyserverSearch: use GtkTemplate
    
    This also means we need to define a proper GtkDialog subclass

 pgp/seahorse-keyserver-search.c  | 283 ++++++++++++++++-----------------------
 pgp/seahorse-keyserver-search.h  |   7 +-
 pgp/seahorse-keyserver-search.ui |  16 +--
 pgp/seahorse-pgp-actions.c       |   7 +-
 4 files changed, 133 insertions(+), 180 deletions(-)
---
diff --git a/pgp/seahorse-keyserver-search.c b/pgp/seahorse-keyserver-search.c
index 7f88525e..3fba45af 100644
--- a/pgp/seahorse-keyserver-search.c
+++ b/pgp/seahorse-keyserver-search.c
@@ -37,11 +37,16 @@
  * keyserver.
  **/
 
-void            on_keyserver_search_control_changed         (GtkWidget *widget,
-                                                             SeahorseWidget *swidget);
+struct _SeahorseKeyserverSearch {
+       GtkDialog parent_instance;
 
-void            on_keyserver_search_ok_clicked              (GtkButton *button,
-                                                             SeahorseWidget *swidget);
+       GtkWidget *search_entry;
+       GtkWidget *key_server_list;
+       GtkWidget *shared_keys_list;
+       GtkWidget *searchbutton;
+};
+
+G_DEFINE_TYPE (SeahorseKeyserverSearch, seahorse_keyserver_search, GTK_TYPE_DIALOG)
 
 /**
  * KeyserverSelection:
@@ -87,18 +92,15 @@ get_checks (GtkWidget *widget, KeyserverSelection *selection)
 }
 
 /**
- * swidget: the window/main widget
- *
  * extracts all keyservers in the sub-widgets "key-server-list" and
  * "shared-keys-list" and fills a KeyserverSelection structure.
  *
  * returns the selection
  **/
 static KeyserverSelection*
-get_keyserver_selection (SeahorseWidget *swidget)
+get_keyserver_selection (SeahorseKeyserverSearch *self)
 {
        KeyserverSelection *selection;
-       GtkWidget *widget;
 
        selection = g_new0 (KeyserverSelection, 1);
        selection->all = TRUE;
@@ -106,14 +108,9 @@ get_keyserver_selection (SeahorseWidget *swidget)
        selection->names = g_ptr_array_new_with_free_func (g_free);
 
        /* Key servers */
-       widget = seahorse_widget_get_widget (swidget, "key-server-list");
-       g_return_val_if_fail (widget != NULL, selection);
-       gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback)get_checks, selection);
-
+       gtk_container_foreach (GTK_CONTAINER (self->key_server_list), (GtkCallback)get_checks, selection);
        /* Shared Key */
-       widget = seahorse_widget_get_widget (swidget, "shared-keys-list");
-       g_return_val_if_fail (widget != NULL, selection);
-       gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback)get_checks, selection);
+       gtk_container_foreach (GTK_CONTAINER (self->shared_keys_list), (GtkCallback)get_checks, selection);
 
        g_ptr_array_add (selection->uris, NULL);
        g_ptr_array_add (selection->names, NULL);
@@ -151,62 +148,42 @@ have_checks (GtkWidget *widget, gboolean *checked)
     }
 }
 
-/**
- * swidget: sub widgets in here will be  checked
- *
- * returns TRUE if at least one of the CHECK_BUTTONS in "key-server-list" or
- * "shared-keys-list" is TRUE
- **/
+/* returns TRUE if at least one of the key servers was selected */
 static gboolean
-have_keyserver_selection (SeahorseWidget *swidget)
+have_keyserver_selection (SeahorseKeyserverSearch *self)
 {
-    GtkWidget *w;
     gboolean checked = FALSE;
 
     /* Key servers */
-    w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "key-server-list"));
-    g_return_val_if_fail (w != NULL, FALSE);
-    gtk_container_foreach (GTK_CONTAINER (w), (GtkCallback)have_checks, &checked);
-
+    gtk_container_foreach (GTK_CONTAINER (self->key_server_list), (GtkCallback)have_checks, &checked);
     /* Shared keys */
-    w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "shared-keys-list"));
-    g_return_val_if_fail (w != NULL, FALSE);
-    gtk_container_foreach (GTK_CONTAINER (w), (GtkCallback)have_checks, &checked);
+    gtk_container_foreach (GTK_CONTAINER (self->shared_keys_list), (GtkCallback)have_checks, &checked);
 
     return checked;
 }
 
-/**
- * on_keyserver_search_control_changed:
- * @widget: ignored
- * @swidget: main widget
- *
- *
- * Enables the "search" button if the edit-field contains text and at least a
- * server is selected
- */
-G_MODULE_EXPORT void
-on_keyserver_search_control_changed (GtkWidget *widget, SeahorseWidget *swidget)
+/* Enables the "search" button if the edit-field contains text and at least a
+ * server is selected */
+static void
+on_keyserver_search_control_changed (GtkWidget *widget, gpointer user_data)
 {
+       SeahorseKeyserverSearch *self = SEAHORSE_KEYSERVER_SEARCH (user_data);
     gboolean enabled = TRUE;
-    GtkWidget *w;
-    gchar *text;
 
     /* Need to have at least one key server selected ... */
-    if (!have_keyserver_selection (swidget))
+    if (!have_keyserver_selection (self)) {
         enabled = FALSE;
 
     /* ... and some search text */
-    else {
-        w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "search-text"));
-        text = gtk_editable_get_chars (GTK_EDITABLE (w), 0, -1);
+       } else {
+               g_autofree gchar *text = NULL;
+
+        text = gtk_editable_get_chars (GTK_EDITABLE (self->search_entry), 0, -1);
         if (!text || !text[0])
             enabled = FALSE;
-        g_free (text);
     }
 
-    w = GTK_WIDGET (seahorse_widget_get_widget (swidget, "searchbutton"));
-    gtk_widget_set_sensitive (w, enabled);
+    gtk_widget_set_sensitive (self->searchbutton, enabled);
 }
 
 /* Initial Selection -------------------------------------------------------- */
@@ -215,55 +192,46 @@ static void
 foreach_child_select_checks (GtkWidget *widget, gpointer user_data)
 {
        gchar **names = user_data;
-       gboolean checked;
-       gchar *name;
        guint i;
 
        if (GTK_IS_CHECK_BUTTON (widget)) {
+               g_autofree gchar *name = NULL;
+               gboolean checked;
+
                name = g_utf8_casefold (gtk_button_get_label (GTK_BUTTON (widget)), -1);
-               checked = names != NULL && names[0] != NULL ? FALSE : TRUE;
+               checked = !(names != NULL && names[0] != NULL);
                for (i = 0; names && names[i] != NULL; i++) {
                        if (g_utf8_collate (names[i], name) == 0) {
                                checked = TRUE;
                                break;
                        }
                }
-               g_free (name);
                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), checked);
        }
 }
 
-/**
- * swidget: the main widget
- *
- * Reads key servers from settings and updates the UI content.
- *
- **/
+/* Reads key servers from settings and updates the UI content. */
 static void
-select_inital_keyservers (SeahorseWidget *swidget)
+select_inital_keyservers (SeahorseKeyserverSearch *self)
 {
+       SeahorseAppSettings *app_settings;
        gchar **names;
-       GtkWidget *widget;
-       gchar *name;
        guint i;
 
-       names = g_settings_get_strv (G_SETTINGS (seahorse_app_settings_instance ()),
-                                                               "last-search-servers");
+       app_settings = seahorse_app_settings_instance ();
+       names = seahorse_app_settings_get_last_search_servers (app_settings, NULL);
 
        /* We do case insensitive matches */
        for (i = 0; names[i] != NULL; i++) {
+               gchar *name;
+
                name = g_utf8_casefold (names[i], -1);
                g_free (names[i]);
                names[i] = name;
        }
 
-       widget = seahorse_widget_get_widget (swidget, "key-server-list");
-       g_return_if_fail (widget != NULL);
-       gtk_container_foreach (GTK_CONTAINER (widget), foreach_child_select_checks, names);
-
-       widget = seahorse_widget_get_widget (swidget, "shared-keys-list");
-       g_return_if_fail (widget != NULL);
-       gtk_container_foreach (GTK_CONTAINER (widget), foreach_child_select_checks, names);
+       gtk_container_foreach (GTK_CONTAINER (self->key_server_list), foreach_child_select_checks, names);
+       gtk_container_foreach (GTK_CONTAINER (self->shared_keys_list), foreach_child_select_checks, names);
 }
 
 /* Populating Lists --------------------------------------------------------- */
@@ -290,7 +258,6 @@ remove_checks (GtkWidget *widget, GHashTable *unchecked)
 }
 
 /**
-* swidget: the main widget
 * box: the GTK_CONTAINER with the checkboxes
 * uris: the uri list of the keyservers
 * names: the keyserver names
@@ -299,7 +266,7 @@ remove_checks (GtkWidget *widget, GHashTable *unchecked)
 * of already existing check boxes is not changed.
 **/
 static void
-populate_keyserver_list (SeahorseWidget *swidget, GtkWidget *box, gchar **uris,
+populate_keyserver_list (SeahorseKeyserverSearch *self, GtkWidget *box, gchar **uris,
                          gchar **names)
 {
        GtkContainer *cont = GTK_CONTAINER (box);
@@ -320,7 +287,7 @@ populate_keyserver_list (SeahorseWidget *swidget, GtkWidget *box, gchar **uris,
                check = gtk_check_button_new_with_label (names[i]);
                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
                                              g_hash_table_lookup (unchecked, names[i]) == NULL);
-               g_signal_connect (check, "toggled", G_CALLBACK (on_keyserver_search_control_changed), 
swidget);
+               g_signal_connect (check, "toggled", G_CALLBACK (on_keyserver_search_control_changed), self);
                gtk_widget_show (check);
 
                /* Save URI and set it as the tooltip */
@@ -333,35 +300,24 @@ populate_keyserver_list (SeahorseWidget *swidget, GtkWidget *box, gchar **uris,
        g_hash_table_destroy (unchecked);
 
        /* Only display the container if we had some checks */
-       if (any)
-               gtk_widget_show (box);
-       else
-               gtk_widget_hide (box);
+       gtk_widget_set_visible (box, any);
 }
 
 static void
 on_settings_keyservers_changed (GSettings *settings, const gchar *key, gpointer user_data)
 {
-       SeahorseWidget *swidget = SEAHORSE_WIDGET (user_data);
-       GtkWidget *widget;
-       gchar **keyservers;
-       gchar **names;
-
-       widget = seahorse_widget_get_widget (swidget, "key-server-list");
-       g_return_if_fail (widget != NULL);
+       SeahorseKeyserverSearch *self = SEAHORSE_KEYSERVER_SEARCH (user_data);
+       g_auto(GStrv) keyservers = NULL;
+       g_auto(GStrv) names = NULL;
 
        keyservers = seahorse_servers_get_uris ();
        names = seahorse_servers_get_names ();
-       populate_keyserver_list (swidget, widget, keyservers, names);
-
-       g_strfreev (keyservers);
-       g_strfreev (names);
+       populate_keyserver_list (self, self->key_server_list, keyservers, names);
 }
 
 /**
 * ssd: the SeahorseServiceDiscovery. List-data is read from there
 * name: ignored
-* swidget: The SeahorseWidget
 *
 * refreshes the "shared-keys-list"
 *
@@ -369,53 +325,36 @@ on_settings_keyservers_changed (GSettings *settings, const gchar *key, gpointer
 static void
 refresh_shared_keys (SeahorseDiscovery *ssd,
                      const gchar *name,
-                     SeahorseWidget *swidget)
+                     gpointer user_data)
 {
-       gchar **keyservers;
-       gchar **names;
-       GtkWidget *widget;
-
-       widget = seahorse_widget_get_widget (swidget, "shared-keys-list");
-       g_return_if_fail (widget != NULL);
+       SeahorseKeyserverSearch *self = SEAHORSE_KEYSERVER_SEARCH (user_data);
+       g_auto(GStrv) keyservers = NULL;
+       g_auto(GStrv) names = NULL;
 
        names = seahorse_discovery_list (ssd);
        keyservers = seahorse_discovery_get_uris (ssd, (const gchar **)names);
-       populate_keyserver_list (swidget, widget, keyservers, names);
-
-       g_strfreev (keyservers);
-       g_strfreev (names);
+       populate_keyserver_list (self, self->shared_keys_list, keyservers, names);
 }
 
 /* -------------------------------------------------------------------------- */
 
-/**
- * on_keyserver_search_ok_clicked:
- * @button: ignored
- * @swidget: The SeahorseWidget to work with
- *
- * Extracts data, stores it in settings and starts a search using the entered
- * search data.
- *
- * This function gets the things done
- */
-G_MODULE_EXPORT void
-on_keyserver_search_ok_clicked (GtkButton *button, SeahorseWidget *swidget)
+/* Extracts data, stores it in settings and starts a search using the entered
+ * search data. */
+static void
+on_keyserver_search_ok_clicked (GtkButton *button, gpointer user_data)
 {
+       SeahorseKeyserverSearch *self = SEAHORSE_KEYSERVER_SEARCH (user_data);
        KeyserverSelection *selection;
        const gchar *search;
-       GtkWidget *widget;
        GtkWindow *parent;
 
-       widget = seahorse_widget_get_widget (swidget, "search-text");
-       g_return_if_fail (widget != NULL);
-
        /* Get search text and save it for next time */
-       search = gtk_entry_get_text (GTK_ENTRY (widget));
+       search = gtk_entry_get_text (GTK_ENTRY (self->search_entry));
        g_return_if_fail (search != NULL && search[0] != 0);
        seahorse_app_settings_set_last_search_text (seahorse_app_settings_instance (), search);
 
        /* The keyservers to search, and save for next time */
-       selection = get_keyserver_selection (swidget);
+       selection = get_keyserver_selection (self);
        g_return_if_fail (selection->uris != NULL);
        g_settings_set_strv (G_SETTINGS (seahorse_app_settings_instance ()), "last-search-servers",
                             selection->all ? NULL : (const gchar * const*)selection->uris->pdata);
@@ -424,76 +363,84 @@ on_keyserver_search_ok_clicked (GtkButton *button, SeahorseWidget *swidget)
         * parent (Seahorse's primary window), not ourselves, as *we* will
         * disappear when "OK" is clicked.
         */
-       parent = gtk_window_get_transient_for (GTK_WINDOW (seahorse_widget_get_widget (swidget, 
swidget->name)));
+       parent = gtk_window_get_transient_for (GTK_WINDOW (self));
        seahorse_keyserver_results_show (search, parent);
 
        free_keyserver_selection (selection);
-       seahorse_widget_destroy (swidget);
 }
 
-/**
-* widget: ignored
-* swidget: the SeahorseWidget to remove the signals from
-*
-* Disconnects the added/removed signals
-*
-**/
 static void
-cleanup_signals (GtkWidget *widget, SeahorseWidget *swidget)
+cleanup_signals (GtkWidget *widget, gpointer user_data)
 {
+       SeahorseKeyserverSearch *self = SEAHORSE_KEYSERVER_SEARCH (user_data);
        SeahorseDiscovery *ssd = seahorse_pgp_backend_get_discovery (NULL);
-       g_signal_handlers_disconnect_by_func (ssd, refresh_shared_keys, swidget);
+       g_signal_handlers_disconnect_by_func (ssd, refresh_shared_keys, self);
 }
 
-
-/**
- * seahorse_keyserver_search_show:
- * @parent: the parent window to connect this window to
- *
- * Shows a remote search window.
- *
- * Returns: the new window.
- */
-GtkWindow*
-seahorse_keyserver_search_show (GtkWindow *parent)
+static void
+seahorse_keyserver_search_init (SeahorseKeyserverSearch *self)
 {
-       SeahorseDiscovery *ssd;
-       SeahorseWidget *swidget;
-       GtkWindow *window;
-       GtkWidget *widget;
+       g_autofree gchar *search_text = NULL;
        SeahorsePgpSettings *settings;
-       gchar *search;
-
-       swidget = seahorse_widget_new ("keyserver-search", parent);
-       g_return_val_if_fail (swidget != NULL, NULL);
-
-       window = GTK_WINDOW (seahorse_widget_get_widget (swidget, swidget->name));
+       SeahorseDiscovery *ssd;
 
-       widget = seahorse_widget_get_widget (swidget, "search-text");
-       g_return_val_if_fail (widget != NULL, window);
+       gtk_widget_init_template (GTK_WIDGET (self));
 
-       search = seahorse_app_settings_get_last_search_text (seahorse_app_settings_instance ());
-       if (search != NULL) {
-               gtk_entry_set_text (GTK_ENTRY (widget), search);
-               gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
-               g_free (search);
+       search_text = seahorse_app_settings_get_last_search_text (seahorse_app_settings_instance ());
+       if (search_text != NULL) {
+               gtk_entry_set_text (GTK_ENTRY (self->search_entry), search_text);
+               gtk_editable_select_region (GTK_EDITABLE (self->search_entry), 0, -1);
        }
 
        /* The key servers to list */
        settings = seahorse_pgp_settings_instance ();
-       on_settings_keyservers_changed (G_SETTINGS (settings), "keyservers", swidget);
+       on_settings_keyservers_changed (G_SETTINGS (settings), "keyservers", self);
        g_signal_connect_object (settings, "changed::keyservers",
-                                G_CALLBACK (on_settings_keyservers_changed), swidget, 0);
+                                G_CALLBACK (on_settings_keyservers_changed), self, 0);
 
        /* Any shared keys to list */
        ssd = seahorse_pgp_backend_get_discovery (NULL);
-       refresh_shared_keys (ssd, NULL, swidget);
-       g_signal_connect (ssd, "added", G_CALLBACK (refresh_shared_keys), swidget);
-       g_signal_connect (ssd, "removed", G_CALLBACK (refresh_shared_keys), swidget);
-       g_signal_connect (window, "destroy", G_CALLBACK (cleanup_signals), swidget);
+       refresh_shared_keys (ssd, NULL, self);
+       g_signal_connect (ssd, "added", G_CALLBACK (refresh_shared_keys), self);
+       g_signal_connect (ssd, "removed", G_CALLBACK (refresh_shared_keys), self);
+       g_signal_connect (GTK_WINDOW (self), "destroy", G_CALLBACK (cleanup_signals), self);
+
+       select_inital_keyservers (self);
+       on_keyserver_search_control_changed (NULL, self);
+}
+
+static void
+seahorse_keyserver_search_class_init (SeahorseKeyserverSearchClass *klass)
+{
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+       gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/Seahorse/seahorse-keyserver-search.ui");
+
+       gtk_widget_class_bind_template_child (widget_class, SeahorseKeyserverSearch, search_entry);
+       gtk_widget_class_bind_template_child (widget_class, SeahorseKeyserverSearch, key_server_list);
+       gtk_widget_class_bind_template_child (widget_class, SeahorseKeyserverSearch, shared_keys_list);
+       gtk_widget_class_bind_template_child (widget_class, SeahorseKeyserverSearch, searchbutton);
+
+       gtk_widget_class_bind_template_callback (widget_class, on_keyserver_search_control_changed);
+       gtk_widget_class_bind_template_callback (widget_class, on_keyserver_search_ok_clicked);
+}
+
+/**
+ * seahorse_keyserver_search_show:
+ * @parent: the parent window to connect this window to
+ *
+ * Shows a remote search window.
+ *
+ * Returns: the new window.
+ */
+SeahorseKeyserverSearch *
+seahorse_keyserver_search_new (GtkWindow *parent)
+{
+       g_autoptr(SeahorseKeyserverSearch) self = NULL;
 
-       select_inital_keyservers (swidget);
-       on_keyserver_search_control_changed (NULL, swidget);
+       self = g_object_new (SEAHORSE_TYPE_KEYSERVER_SEARCH,
+                            "use-header-bar", 1,
+                            NULL);
 
-       return window;
+       return g_steal_pointer (&self);
 }
diff --git a/pgp/seahorse-keyserver-search.h b/pgp/seahorse-keyserver-search.h
index 9650b1e4..ba98d9f2 100644
--- a/pgp/seahorse-keyserver-search.h
+++ b/pgp/seahorse-keyserver-search.h
@@ -23,4 +23,9 @@
 
 #include <gtk/gtk.h>
 
-GtkWindow *  seahorse_keyserver_search_show      (GtkWindow *parent);
+#define SEAHORSE_TYPE_KEYSERVER_SEARCH (seahorse_keyserver_search_get_type ())
+G_DECLARE_FINAL_TYPE (SeahorseKeyserverSearch, seahorse_keyserver_search,
+                      SEAHORSE, KEYSERVER_SEARCH,
+                      GtkDialog)
+
+SeahorseKeyserverSearch *         seahorse_keyserver_search_new      (GtkWindow *parent);
diff --git a/pgp/seahorse-keyserver-search.ui b/pgp/seahorse-keyserver-search.ui
index 522e6ddb..275d94b5 100644
--- a/pgp/seahorse-keyserver-search.ui
+++ b/pgp/seahorse-keyserver-search.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <interface>
   <requires lib="gtk+" version="3.22"/>
-  <object class="GtkDialog" id="keyserver-search">
+  <template class="SeahorseKeyserverSearch" parent="GtkDialog">
     <property name="visible">True</property>
     <property name="border_width">6</property>
     <property name="use_header_bar">1</property>
@@ -51,11 +51,11 @@
                 <property name="visible">True</property>
                 <property name="label" translatable="yes">_Search for keys containing: </property>
                 <property name="use_underline">True</property>
-                <property name="mnemonic_widget">search-text</property>
+                <property name="mnemonic_widget">search_entry</property>
               </object>
             </child>
             <child>
-              <object class="GtkEntry" id="search-text">
+              <object class="GtkEntry" id="search_entry">
                 <property name="visible">True</property>
                 <property name="hexpand">True</property>
                 <property name="can_focus">True</property>
@@ -92,7 +92,7 @@
                 <property name="visible">True</property>
                 <property name="orientation">vertical</property>
                 <child>
-                  <object class="GtkBox" id="key-server-list">
+                  <object class="GtkBox" id="key_server_list">
                     <property name="visible">True</property>
                     <property name="orientation">vertical</property>
                     <property name="border_width">6</property>
@@ -106,7 +106,7 @@
                   </object>
                 </child>
                 <child>
-                  <object class="GtkBox" id="shared-keys-list">
+                  <object class="GtkBox" id="shared_keys_list">
                     <property name="visible">True</property>
                     <property name="orientation">vertical</property>
                     <property name="border_width">6</property>
@@ -127,13 +127,11 @@
     </child>
     <child type="action">
       <object class="GtkButton" id="cancelbutton">
-        <property name="label">gtk-cancel</property>
+        <property name="label" translatable="yes">Cancel</property>
         <property name="visible">True</property>
         <property name="can_focus">True</property>
         <property name="can_default">True</property>
         <property name="receives_default">False</property>
-        <property name="use_stock">True</property>
-        <signal name="clicked" handler="on_widget_closed"/>
       </object>
     </child>
     <child type="action">
@@ -152,5 +150,5 @@
       <action-widget response="-6">cancelbutton</action-widget>
       <action-widget response="-5" default="true">searchbutton</action-widget>
     </action-widgets>
-  </object>
+  </template>
 </interface>
diff --git a/pgp/seahorse-pgp-actions.c b/pgp/seahorse-pgp-actions.c
index a39e2653..1982044f 100644
--- a/pgp/seahorse-pgp-actions.c
+++ b/pgp/seahorse-pgp-actions.c
@@ -64,10 +64,13 @@ on_remote_find (GSimpleAction *action,
                 gpointer user_data)
 {
   SeahorseActionGroup *actions = SEAHORSE_ACTION_GROUP (user_data);
-  SeahorseCatalog *catalog;
+  SeahorseCatalog *catalog = NULL;
+  g_autoptr(SeahorseKeyserverSearch) search = NULL;
 
   catalog = seahorse_action_group_get_catalog (actions);
-  seahorse_keyserver_search_show (GTK_WINDOW (catalog));
+  search = seahorse_keyserver_search_new (GTK_WINDOW (catalog));
+  gtk_dialog_run (GTK_DIALOG (search));
+  gtk_widget_destroy (GTK_WIDGET (g_steal_pointer (&search)));
   g_clear_object (&catalog);
 }
 


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