gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30744 - gnunet-gtk/src/namestore


From: gnunet
Subject: [GNUnet-SVN] r30744 - gnunet-gtk/src/namestore
Date: Sat, 16 Nov 2013 16:25:43 +0100

Author: grothoff
Date: 2013-11-16 16:25:43 +0100 (Sat, 16 Nov 2013)
New Revision: 30744

Modified:
   gnunet-gtk/src/namestore/gnunet-namestore-gtk.c
Log:
-fix #3110

Modified: gnunet-gtk/src/namestore/gnunet-namestore-gtk.c
===================================================================
--- gnunet-gtk/src/namestore/gnunet-namestore-gtk.c     2013-11-16 14:45:30 UTC 
(rev 30743)
+++ gnunet-gtk/src/namestore/gnunet-namestore-gtk.c     2013-11-16 15:25:43 UTC 
(rev 30744)
@@ -2403,6 +2403,34 @@
 
 
 /**
+ * The user has selected a response in the dialog asking him
+ * if we should run the import script.  If the response was
+ * positive, run the import script.
+ *
+ * @param dialog the dialog object, should be destroyed
+ * @param response_id response in the dialog
+ * @param user_data NULL
+ */
+static void
+handle_import_dialog_response (GtkDialog *dialog,
+                               gint response_id,
+                               gpointer user_data)
+{
+  gtk_widget_destroy (GTK_WIDGET (dialog));
+  switch (response_id)
+  {
+  case GTK_RESPONSE_YES:
+    system ("gnunet-gns-import.sh");
+    break;
+  default:
+    /* nothing */
+    break;
+  }
+  gtk_widget_show (GTK_WIDGET (get_object 
("gnunet_namestore_gtk_zone_combobox")));
+}
+
+
+/**
  * Method called to switch the model to a new zone.
  *
  * @param name name of the zone
@@ -2425,7 +2453,8 @@
   if (NULL == ego)
   {
     GtkDialog *diag;
-    gint result;
+    GtkWidget *dummy;
+    GtkWidget *toplevel;
 
     diag = GTK_DIALOG (gtk_message_dialog_new (NULL,
                                                GTK_DIALOG_MODAL,
@@ -2435,18 +2464,15 @@
                                                ? _("No zones found.  Should I 
run the import script?")
                                                : _("Zone `%s' not found.  
Should I run the import script?"),
                                                name));
-    result = gtk_dialog_run (diag);
-    gtk_widget_destroy (GTK_WIDGET (diag));
-    switch (result)
-    {
-    case GTK_RESPONSE_YES:
-      system ("gnunet-gns-import.sh");
-      break;
-    default:
-      /* nothing */
-      break;
-    }
-    gtk_widget_show (GTK_WIDGET (get_object 
("gnunet_namestore_gtk_zone_combobox")));
+    dummy = GTK_WIDGET (get_object ("gnunet_namestore_gtk_dialog"));
+    toplevel = gtk_widget_get_toplevel (dummy);
+    if (GTK_IS_WINDOW (toplevel))
+      gtk_window_set_transient_for (GTK_WINDOW (diag), GTK_WINDOW (toplevel));
+    gtk_window_set_modal (GTK_WINDOW (diag), TRUE);
+    g_signal_connect (diag, "response",
+                      G_CALLBACK (handle_import_dialog_response),
+                      NULL);
+    gtk_window_present (GTK_WINDOW (diag));
     return;
   }
   current_zone_option = GNUNET_strdup (name);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]