[epiphany/gnome-3-26] flatpak: Hide download directory option from preferences dialog



commit 612339d697f6342a9240783ca9a5ed273801e762
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 aa10557..b86317d 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 580292f..493040e 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"
@@ -1709,7 +1710,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]