summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@igalia.com>2017-10-04 16:05:03 +0200
committerMichael Catanzaro <mcatanzaro@igalia.com>2017-10-04 16:34:51 +0200
commit0379ed4f795117b420b15f086b92b43ba6f6df8a (patch)
tree5af186c2fd9d17499dd431146371a44957c037fb
parentbb22795370744761cff1b83463490cf0c656863e (diff)
downloadepiphany-0379ed4f795117b420b15f086b92b43ba6f6df8a.tar.gz
flatpak: Hide download directory option from preferences dialog
This option cannot possibly work
-rw-r--r--lib/ephy-flatpak-utils.c28
-rw-r--r--lib/ephy-flatpak-utils.h25
-rw-r--r--lib/meson.build1
-rw-r--r--src/prefs-dialog.c6
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 000000000..84c06f9a6
--- /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 000000000..f70a4f164
--- /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 6244e7033..1af66d131 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 583292faa..531233933 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