[rs-commit] r46 - in /redwax-signtext/trunk/src/linux: message.c signtext.c

rs-commit at redwax.eu rs-commit at redwax.eu
Mon Sep 12 22:22:18 CEST 2022


Author: minfrin at redwax.eu
Date: Mon Sep 12 22:22:17 2022
New Revision: 46

Log:
Graceful shutdown when sign is complete.

Modified:
    redwax-signtext/trunk/src/linux/message.c
    redwax-signtext/trunk/src/linux/signtext.c

Modified: redwax-signtext/trunk/src/linux/message.c
==============================================================================
--- redwax-signtext/trunk/src/linux/message.c	(original)
+++ redwax-signtext/trunk/src/linux/message.c	Mon Sep 12 22:22:17 2022
@@ -41,7 +41,6 @@
                             gpointer user_data)
 {
   SignTextInstance *instance = user_data;
-  GList *pages;
 
   g_printerr("message_cancel_clicked\n");
 
@@ -49,16 +48,6 @@
    * Send an error to show we cancelled.
    */
   message_send_error(instance, "error:cancelled");
-
-  gtk_container_remove(GTK_CONTAINER(instance->stack), GTK_WIDGET(instance->box));
-
-  g_object_steal_data(G_OBJECT (instance->signtext->stack), instance->uuid);
-
-  pages = gtk_container_get_children(GTK_CONTAINER(instance->stack));
-  if (!g_list_length(pages)) {
-    gtk_widget_destroy(instance->signtext->window);
-  }
-  g_list_free(pages);
 
   signtext_instance_free(instance);
 
@@ -226,7 +215,8 @@
       else {
 
         /* nak, close everything down */
-// fixme
+        signtext_instance_free(instance);
+
       }
     }
 

Modified: redwax-signtext/trunk/src/linux/signtext.c
==============================================================================
--- redwax-signtext/trunk/src/linux/signtext.c	(original)
+++ redwax-signtext/trunk/src/linux/signtext.c	Mon Sep 12 22:22:17 2022
@@ -16,6 +16,7 @@
 
 
 
+#include <gtk/gtk.h>
 
 #include "signtext.h"
 
@@ -133,6 +134,23 @@
 {
   g_printerr("signtext_instance_free\n");
   if (instance) {
+
+    GList *pages;
+
+#ifdef HAVE_GTK_STACK_REMOVE
+    gtk_stack_remove(instance->signtext->stack, GTK_WIDGET (instance->box));
+#else
+    gtk_container_remove(GTK_CONTAINER(instance->stack), GTK_WIDGET(instance->box));
+#endif
+
+    g_object_steal_data(G_OBJECT (instance->signtext->stack), instance->uuid);
+
+    pages = gtk_container_get_children(GTK_CONTAINER(instance->stack));
+    if (!g_list_length(pages)) {
+      gtk_widget_destroy(instance->signtext->window);
+    }
+    g_list_free(pages);
+
     if (instance->uuid) g_free(instance->uuid);
   g_printerr("signtext_instance_free: 1\n");
     if (instance->uri) g_uri_unref(instance->uri);
@@ -147,9 +165,9 @@
 //    if (instance->buttons) g_object_unref(instance->buttons);
 //    if (instance->cancel) g_object_unref(instance->cancel);
 //    if (instance->sign) g_object_unref(instance->sign);
-    if (instance->box) g_object_unref(instance->box);
+//    if (instance->box) g_object_unref(instance->box);
   g_printerr("signtext_instance_free:4\n");
-    if (instance->certificate) g_object_unref(instance->certificate);
+//    if (instance->certificate) g_object_unref(instance->certificate);
   g_printerr("signtext_instance_free: 5\n");
 
     if (instance->w) {



More information about the rs-commit mailing list