[krb5-auth-dialog] applet: Quit main loop rather than using separate destroy functions



commit 0d7e71d39f7be8b93b4cc06942459195f1cd4938
Author: Guido Günther <agx sigxcpu org>
Date:   Thu Oct 13 14:05:58 2022 +0200

    applet: Quit main loop rather than using separate destroy functions
    
    Just free resources when we dispose the applet

 src/ka-applet-priv.h |  3 ---
 src/ka-applet.c      | 31 +++++++------------------------
 2 files changed, 7 insertions(+), 27 deletions(-)
---
diff --git a/src/ka-applet-priv.h b/src/ka-applet-priv.h
index ed88456..5132c74 100644
--- a/src/ka-applet-priv.h
+++ b/src/ka-applet-priv.h
@@ -65,9 +65,6 @@ GtkWindow* ka_applet_last_focused_window(KaApplet *self);
 #define KA_PROP_NAME_TGT_RENEWABLE   "tgt-renewable"
 #define KA_PROP_NAME_CONF_TICKETS    "conf-tickets"
 
-/* destroy the applet */
-void ka_applet_destroy (KaApplet *self);
-
 /* update tooltip and icon */
 int ka_applet_update_status (KaApplet *self, krb5_timestamp expiry);
 
diff --git a/src/ka-applet.c b/src/ka-applet.c
index c577cec..3ed3193 100644
--- a/src/ka-applet.c
+++ b/src/ka-applet.c
@@ -111,10 +111,9 @@ ka_applet_command_line (GApplication            *application,
     KaApplet *self = KA_APPLET(application);
     KA_DEBUG ("Evaluating command line");
 
-    if (!self->startup_ccache &&
-        self->auto_run)
-        ka_applet_destroy (self);
-    else
+    if (!self->startup_ccache && self->auto_run) {
+        g_application_quit (G_APPLICATION (self));
+    } else
         ka_applet_activate (application);
     return 0;
 }
@@ -214,7 +213,7 @@ action_quit (GSimpleAction *action G_GNUC_UNUSED,
 {
     KaApplet *self = KA_APPLET (userdata);
 
-    ka_applet_destroy (self);
+    g_application_quit (G_APPLICATION (self));
 }
 
 
@@ -420,6 +419,9 @@ ka_applet_dispose (GObject *object)
     g_clear_pointer (&self->prefs, ka_window_destroy);
     g_clear_object (&self->loader);
 
+    ka_dbus_disconnect ();
+    ka_kerberos_destroy ();
+
     G_OBJECT_CLASS (ka_applet_parent_class)->dispose (object);
 }
 
@@ -760,25 +762,6 @@ ka_applet_signal_emit (KaApplet *this,
 }
 
 
-/* undo what was done on startup() */
-void
-ka_applet_destroy (KaApplet* self)
-{
-    GList *windows, *first;
-
-    ka_dbus_disconnect ();
-    windows = gtk_application_get_windows (GTK_APPLICATION(self));
-    if (windows) {
-        first = g_list_first (windows);
-        gtk_application_remove_window(GTK_APPLICATION (self),
-                                      GTK_WINDOW (first->data));
-    }
-
-
-    ka_kerberos_destroy ();
-}
-
-
 int
 main (int argc, char *argv[])
 {


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