[epiphany] flatpak: Hide download directory option from preferences dialog



commit 0379ed4f795117b420b15f086b92b43ba6f6df8a
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Wed Oct 4 16:05:03 2017 +0200

    flatpak: Hide download directory option from preferences dialog
    
    This option cannot possibly work

 lib/ephy-flatpak-utils.c |   28 ++++++++++++++++++++++++++++
 lib/ephy-flatpak-utils.h |   25 +++++++++++++++++++++++++
 lib/meson.build          |    1 +
 src/prefs-dialog.c       |    6 +++++-
 4 files changed, 59 insertions(+), 1 deletions(-)
---
diff --git a/lib/ephy-flatpak-utils.c b/lib/ephy-flatpak-utils.c
new file mode 100644
index 0000000..84c06f9
--- /dev/null
+++ b/lib/ephy-flatpak-utils.c
@@ -0,0 +1,28 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ *  Copyright © 2017 Igalia S.L.
+ *
+ *  This file is part of Epiphany.
+ *
+ *  Epiphany is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  Epiphany is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with Epiphany.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include "ephy-flatpak-utils.h"
+
+gboolean
+ephy_is_running_inside_flatpak (void)
+{
+  return g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS);
+}
diff --git a/lib/ephy-flatpak-utils.h b/lib/ephy-flatpak-utils.h
new file mode 100644
index 0000000..f70a4f1
--- /dev/null
+++ b/lib/ephy-flatpak-utils.h
@@ -0,0 +1,25 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ *  Copyright © 2017 Igalia S.L.
+ *
+ *  This file is part of Epiphany.
+ *
+ *  Epiphany is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  Epiphany is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with Epiphany.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <glib.h>
+
+gboolean ephy_is_running_inside_flatpak (void);
diff --git a/lib/meson.build b/lib/meson.build
index 6244e70..1af66d1 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -20,6 +20,7 @@ libephymisc_sources = [
   'ephy-favicon-helpers.c',
   'ephy-file-helpers.c',
   'ephy-filters-manager.c',
+  'ephy-flatpak-utils.c',
   'ephy-gui.c',
   'ephy-langs.c',
   'ephy-notification.c',
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 583292f..5312339 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -30,6 +30,7 @@
 #include "ephy-embed-utils.h"
 #include "ephy-file-chooser.h"
 #include "ephy-file-helpers.h"
+#include "ephy-flatpak-utils.h"
 #include "ephy-gui.h"
 #include "ephy-langs.h"
 #include "ephy-prefs.h"
@@ -1716,7 +1717,10 @@ setup_general_page (PrefsDialog *dialog)
                     G_CALLBACK (do_not_track_button_clicked_cb),
                     dialog);
 
-  create_download_path_button (dialog);
+  if (ephy_is_running_inside_flatpak ())
+    gtk_widget_hide (dialog->download_button_label);
+  else
+    create_download_path_button (dialog);
 }
 
 static void


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