gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r19670 - gnunet-gtk/src/fs


From: gnunet
Subject: [GNUnet-SVN] r19670 - gnunet-gtk/src/fs
Date: Fri, 3 Feb 2012 14:10:02 +0100

Author: grothoff
Date: 2012-02-03 14:10:01 +0100 (Fri, 03 Feb 2012)
New Revision: 19670

Modified:
   gnunet-gtk/src/fs/gnunet-fs-gtk_download-save-as.c
Log:
-cleaner

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_download-save-as.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_download-save-as.c  2012-02-03 13:00:07 UTC 
(rev 19669)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_download-save-as.c  2012-02-03 13:10:01 UTC 
(rev 19670)
@@ -91,25 +91,45 @@
                                            gpointer user_data)
 {
   struct DownloadAsDialogContext *dlc = user_data;
-  GtkBuilder *builder;
+
+  save_as_dialog_free_download_context (dlc->dc);
+  g_object_unref (G_OBJECT (dlc->builder));
+  GNUNET_free (dlc);
+  return FALSE;
+}
+
+
+/**
+ * The user clicked on the 'save as' button of the dialog.
+ * Delete the window and start the download.
+ *
+ * @param dialog the dialog object
+ * @param response_id response_id associated with the button
+ * @param user_data the 'structDownloadAsDialogContext' of the dialog
+ */
+void
+GNUNET_GTK_save_as_dialog_response_cb (GtkDialog * dialog, 
+                                      gint response_id,
+                                       gpointer user_data)
+{
+  struct DownloadAsDialogContext *dlc = user_data;
   struct DownloadContext *dc;
-  GtkWidget *cb;
+  GtkToggleButton *cb;
 
-  builder = dlc->builder;
   dc = dlc->dc;
-  cb = GTK_WIDGET (gtk_builder_get_object
-                   (builder, "GNUNET_GTK_save_as_recursive_check_button"));
   if (GTK_RESPONSE_OK != dlc->response)
   {
     save_as_dialog_free_download_context (dc);
+    gtk_widget_destroy (GTK_WIDGET (dialog));
     g_object_unref (G_OBJECT (dlc->builder));
     GNUNET_free (dlc);
-    return FALSE;
+    return;
   }
-  /* FIXME-UGLY: this code should be in the 'save_as_dialog_response_cb' 
instead */
   GNUNET_free_non_null (dc->filename);
   dc->filename =
       GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER 
(dlc->dialog));
+  cb = GTK_TOGGLE_BUTTON (gtk_builder_get_object
+                         (dlc->builder, 
"GNUNET_GTK_save_as_recursive_check_button"));
   dc->is_recursive =
       (TRUE ==
        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cb))) ? GNUNET_YES :
@@ -117,42 +137,16 @@
   dc->anonymity =
       gtk_spin_button_get_value (GTK_SPIN_BUTTON
                                  (gtk_builder_get_object
-                                  (builder,
+                                  (dlc->builder,
                                    
"GNUNET_GTK_save_as_dialog_anonymity_spin_button")));
-  g_object_unref (G_OBJECT (builder));
+  gtk_widget_destroy (GTK_WIDGET (dialog));
+  g_object_unref (G_OBJECT (dlc->builder));
   GNUNET_free (dlc);
   GNUNET_FS_GTK_download_context_start_download (dc);
-  return FALSE;
 }
 
 
 /**
- * The user clicked on the 'save as' button of the dialog.
- * Delete the window and start the download.
- *
- * @param dialog the dialog object
- * @param response_id response_id associated with the button
- * @param user_data the 'structDownloadAsDialogContext' of the dialog
- */
-void
-GNUNET_GTK_save_as_dialog_response_cb (GtkDialog * dialog, 
-                                      gint response_id,
-                                       gpointer user_data)
-{
-  struct DownloadAsDialogContext *dlc = user_data;
-
-  dlc->response = response_id;
-  /* dialogs don't get delete-event the way normal windows do,
-     call the handler manually */
-  /* FIXME-UGLY: this is a bit ugly; instead, move the code
-     to close the dialog nicely into here! */
-  GNUNET_GTK_save_as_dialog_delete_event_cb (GTK_WIDGET (dialog), NULL,
-                                             user_data);
-  gtk_widget_destroy (GTK_WIDGET (dialog));
-}
-
-
-/**
  * Open the 'save as' dialog for a download.  Calls the 'dc->cb'
  * continutation when the dialog is complete.  Will release the 'dc'
  * resources if the dialog is cancelled.




reply via email to

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