[recipes] Revert "Try the file chooser portal again"
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Revert "Try the file chooser portal again"
- Date: Wed, 18 Jan 2017 10:45:19 +0000 (UTC)
commit 6021c11768ef1f862b0b60912a2211b76df4a346
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jan 18 05:44:51 2017 -0500
Revert "Try the file chooser portal again"
This reverts commit 1281197512f5f9ac334c4731c278db6b229fe816.
Didn't mean to push this yet. It needs to wait for fixes on the
flatpak side.
src/gr-recipe-exporter.c | 55 ++++++++++++++++++---------------------------
1 files changed, 22 insertions(+), 33 deletions(-)
---
diff --git a/src/gr-recipe-exporter.c b/src/gr-recipe-exporter.c
index 0a54c00..c443907 100644
--- a/src/gr-recipe-exporter.c
+++ b/src/gr-recipe-exporter.c
@@ -423,53 +423,42 @@ start_export (GrRecipeExporter *exporter)
}
static void
-file_chooser_response (GtkNativeDialog *dialog,
- int response_id,
- GrRecipeExporter *exporter)
-{
- if (response_id == GTK_RESPONSE_ACCEPT) {
- g_message ("exporting %d recipes now", g_list_length (exporter->recipes));
-
- exporter->output = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
-
- start_export (exporter);
- }
- else {
- g_message ("not exporting now");
- }
-
- gtk_native_dialog_destroy (dialog);
-}
-
-static void
export_dialog_response (GtkWidget *dialog,
int response_id,
GrRecipeExporter *exporter)
{
- gtk_widget_destroy (dialog);
- exporter->dialog_heading = NULL;
-
if (response_id == GTK_RESPONSE_CANCEL) {
g_message ("not exporting now");
}
else if (response_id == GTK_RESPONSE_OK) {
- GtkFileChooserNative *chooser;
+ g_autofree char *path = NULL;
+ int i;
+
+ g_message ("exporting %d recipes now", g_list_length (exporter->recipes));
- chooser = gtk_file_chooser_native_new (_("Select the location"),
- GTK_WINDOW (exporter->window),
- GTK_FILE_CHOOSER_ACTION_SAVE,
- _("_Save"),
- _("_Cancel"));
+ for (i = 0; i < 1000; i++) {
+ g_autofree char *tmp;
+ tmp = g_strdup_printf ("%s/.var/app/org.gnome.Recipes/recipes%d.tar.gz",
g_get_home_dir (), i);
+ if (!g_file_test (tmp, G_FILE_TEST_EXISTS)) {
+ path = g_strdup (tmp);
+ break;
+ }
+ }
- gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (chooser), TRUE);
+ if (!path) {
+ g_autofree char *dir = NULL;
- gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (chooser), TRUE);
- gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (chooser), "recipes.tar.gz");
+ dir = g_dir_make_tmp ("recipesXXXXXX", NULL);
+ path = g_build_filename (dir, "recipes.tar.gz", NULL);
+ }
- g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), exporter);
+ exporter->output = g_file_new_for_path (path);
- gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
+ start_export (exporter);
}
+
+ gtk_widget_destroy (dialog);
+ exporter->dialog_heading = NULL;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]