summaryrefslogtreecommitdiffstats
path: root/panels/diagnostics
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:45:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:45:20 +0000
commitae1c76ff830d146d41e88d6fba724c0a54bce868 (patch)
tree3c354bec95af07be35fc71a4b738268496f1a1c4 /panels/diagnostics
parentInitial commit. (diff)
downloadgnome-control-center-ae1c76ff830d146d41e88d6fba724c0a54bce868.tar.xz
gnome-control-center-ae1c76ff830d146d41e88d6fba724c0a54bce868.zip
Adding upstream version 1:43.6.upstream/1%43.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'panels/diagnostics')
-rw-r--r--panels/diagnostics/cc-diagnostics-panel.c143
-rw-r--r--panels/diagnostics/cc-diagnostics-panel.h32
-rw-r--r--panels/diagnostics/cc-diagnostics-panel.ui29
-rw-r--r--panels/diagnostics/diagnostics.gresource.xml6
-rw-r--r--panels/diagnostics/gnome-diagnostics-panel.desktop.in.in19
-rw-r--r--panels/diagnostics/icons/meson.build4
-rw-r--r--panels/diagnostics/icons/scalable/org.gnome.Settings-diagnostics-symbolic.svg8
-rw-r--r--panels/diagnostics/meson.build41
8 files changed, 282 insertions, 0 deletions
diff --git a/panels/diagnostics/cc-diagnostics-panel.c b/panels/diagnostics/cc-diagnostics-panel.c
new file mode 100644
index 0000000..9aeca6e
--- /dev/null
+++ b/panels/diagnostics/cc-diagnostics-panel.c
@@ -0,0 +1,143 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2018 Red Hat, Inc
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Matthias Clasen <mclasen@redhat.com>
+ */
+
+#include "cc-diagnostics-panel.h"
+#include "cc-diagnostics-resources.h"
+#include "cc-util.h"
+#include "shell/cc-application.h"
+
+#include <gio/gdesktopappinfo.h>
+#include <glib/gi18n.h>
+
+struct _CcDiagnosticsPanel
+{
+ CcPanel parent_instance;
+
+ AdwPreferencesGroup *diagnostics_group;
+ GtkSwitch *abrt_switch;
+
+ GSettings *privacy_settings;
+};
+
+CC_PANEL_REGISTER (CcDiagnosticsPanel, cc_diagnostics_panel)
+
+/* Static init function */
+
+static void
+set_panel_visibility (CcPanelVisibility visibility)
+{
+ CcApplication *application;
+
+ application = CC_APPLICATION (g_application_get_default ());
+ cc_shell_model_set_panel_visibility (cc_application_get_model (application),
+ "diagnostics",
+ visibility);
+
+}
+
+static void
+abrt_appeared_cb (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data)
+{
+ g_debug ("ABRT appeared");
+ set_panel_visibility (CC_PANEL_VISIBLE);
+}
+
+static void
+abrt_vanished_cb (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data)
+{
+ g_debug ("ABRT vanished");
+ set_panel_visibility (CC_PANEL_VISIBLE_IN_SEARCH);
+}
+
+void
+cc_diagnostics_panel_static_init_func (void)
+{
+ g_bus_watch_name (G_BUS_TYPE_SYSTEM,
+ "org.freedesktop.problems.daemon",
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ abrt_appeared_cb,
+ abrt_vanished_cb,
+ NULL,
+ NULL);
+
+ set_panel_visibility (CC_PANEL_VISIBLE_IN_SEARCH);
+}
+
+static void
+cc_diagnostics_panel_finalize (GObject *object)
+{
+ CcDiagnosticsPanel *self = CC_DIAGNOSTICS_PANEL (object);
+
+ g_clear_object (&self->privacy_settings);
+
+ G_OBJECT_CLASS (cc_diagnostics_panel_parent_class)->finalize (object);
+}
+
+static void
+cc_diagnostics_panel_class_init (CcDiagnosticsPanelClass *klass)
+{
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ oclass->finalize = cc_diagnostics_panel_finalize;
+
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/diagnostics/cc-diagnostics-panel.ui");
+
+ gtk_widget_class_bind_template_child (widget_class, CcDiagnosticsPanel, diagnostics_group);
+ gtk_widget_class_bind_template_child (widget_class, CcDiagnosticsPanel, abrt_switch);
+}
+
+static void
+cc_diagnostics_panel_init (CcDiagnosticsPanel *self)
+{
+ g_autofree gchar *os_name = NULL;
+ g_autofree gchar *url = NULL;
+ g_autofree gchar *msg = NULL;
+ g_autofree gchar *link = NULL;
+
+ g_resources_register (cc_diagnostics_get_resource ());
+
+ gtk_widget_init_template (GTK_WIDGET (self));
+
+ self->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");
+
+ g_settings_bind (self->privacy_settings, "report-technical-problems",
+ self->abrt_switch, "active",
+ G_SETTINGS_BIND_DEFAULT);
+
+ os_name = g_get_os_info (G_OS_INFO_KEY_NAME);
+ if (!os_name)
+ os_name = g_strdup ("GNOME");
+ url = g_get_os_info (G_OS_INFO_KEY_PRIVACY_POLICY_URL);
+ if (!url)
+ url = g_strdup ("http://www.gnome.org/privacy-policy");
+ /* translators: Text used in link to privacy policy */
+ link = g_strdup_printf ("<a href=\"%s\">%s</a>", url, _("Learn more"));
+ /* translators: The first '%s' is the distributor's name, such as 'Fedora', the second '%s' is a link to the privacy policy */
+ msg = g_strdup_printf (_("Sending reports of technical problems helps us improve %s. Reports "
+ "are sent anonymously and are scrubbed of personal data. %s"),
+ os_name, link);
+ adw_preferences_group_set_description (self->diagnostics_group, msg);
+}
diff --git a/panels/diagnostics/cc-diagnostics-panel.h b/panels/diagnostics/cc-diagnostics-panel.h
new file mode 100644
index 0000000..3875ec5
--- /dev/null
+++ b/panels/diagnostics/cc-diagnostics-panel.h
@@ -0,0 +1,32 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2018 Red Hat, Inc
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Matthias Clasen <mclasen@redhat.com>
+ */
+
+#pragma once
+
+#include <shell/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_DIAGNOSTICS_PANEL (cc_diagnostics_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcDiagnosticsPanel, cc_diagnostics_panel, CC, DIAGNOSTICS_PANEL, CcPanel)
+
+void cc_diagnostics_panel_static_init_func (void);
+
+G_END_DECLS
diff --git a/panels/diagnostics/cc-diagnostics-panel.ui b/panels/diagnostics/cc-diagnostics-panel.ui
new file mode 100644
index 0000000..a08a4ca
--- /dev/null
+++ b/panels/diagnostics/cc-diagnostics-panel.ui
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="CcDiagnosticsPanel" parent="CcPanel">
+ <child type="content">
+ <object class="AdwPreferencesPage">
+ <child>
+ <object class="AdwPreferencesGroup" id="diagnostics_group">
+ <property name="title" translatable="yes">Problem Reporting</property>
+ <child>
+ <object class="AdwActionRow">
+ <property name="title" translatable="yes">_Automatic Problem Reporting</property>
+ <property name="use-underline">True</property>
+ <property name="activatable-widget">abrt_switch</property>
+ <child type="suffix">
+ <object class="GtkSwitch" id="abrt_switch">
+ <property name="valign">center</property>
+ <accessibility>
+ <property name="label" translatable="yes">Enable</property>
+ </accessibility>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/panels/diagnostics/diagnostics.gresource.xml b/panels/diagnostics/diagnostics.gresource.xml
new file mode 100644
index 0000000..541d62c
--- /dev/null
+++ b/panels/diagnostics/diagnostics.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/control-center/diagnostics">
+ <file preprocess="xml-stripblanks">cc-diagnostics-panel.ui</file>
+ </gresource>
+</gresources>
diff --git a/panels/diagnostics/gnome-diagnostics-panel.desktop.in.in b/panels/diagnostics/gnome-diagnostics-panel.desktop.in.in
new file mode 100644
index 0000000..68d4cb0
--- /dev/null
+++ b/panels/diagnostics/gnome-diagnostics-panel.desktop.in.in
@@ -0,0 +1,19 @@
+[Desktop Entry]
+Name=Diagnostics
+Comment=Report your problems
+Exec=gnome-control-center diagnostics
+# FIXME
+# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
+Icon=org.gnome.Settings-diagnostics-symbolic
+Terminal=false
+Type=Application
+NoDisplay=true
+StartupNotify=true
+Categories=GNOME;GTK;Settings;DesktopSettings;X-GNOME-Settings-Panel;X-GNOME-PrivacySettings;
+OnlyShowIn=GNOME;Unity;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-control-center
+X-GNOME-Bugzilla-Component=privacy
+X-GNOME-Bugzilla-Version=@VERSION@
+# Translators: Search terms to find the Diagnostics panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
+Keywords=diagnostics;crash;
diff --git a/panels/diagnostics/icons/meson.build b/panels/diagnostics/icons/meson.build
new file mode 100644
index 0000000..c1b200d
--- /dev/null
+++ b/panels/diagnostics/icons/meson.build
@@ -0,0 +1,4 @@
+install_data(
+ 'scalable/org.gnome.Settings-diagnostics-symbolic.svg',
+ install_dir: join_paths(control_center_icondir, 'hicolor', 'scalable', 'apps')
+)
diff --git a/panels/diagnostics/icons/scalable/org.gnome.Settings-diagnostics-symbolic.svg b/panels/diagnostics/icons/scalable/org.gnome.Settings-diagnostics-symbolic.svg
new file mode 100644
index 0000000..34e4afc
--- /dev/null
+++ b/panels/diagnostics/icons/scalable/org.gnome.Settings-diagnostics-symbolic.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
+ <g fill="#2e3436">
+ <path d="m 3.011719 1 c -1.644531 0 -3.0000002 1.355469 -3.0000002 3 v 6 c 0 1.644531 1.3554692 3 3.0000002 3 h 1.988281 v -2 h -1.988281 c -0.570313 0 -1 -0.429688 -1 -1 v -6 c 0 -0.570312 0.429687 -1 1 -1 h 8.976562 c 0.570313 0 1 0.429688 1 1 v 1 h 2 v -1 c 0 -1.644531 -1.355469 -3 -3 -3 z m 0 0"/>
+ <path d="m 5.011719 14 c -1.105469 0 -2 0.894531 -2 2 h 10 c 0 -1.105469 -0.894531 -2 -2 -2 z m 0 0"/>
+ <path d="m 9.5 4 c -2.484375 0 -4.5 2.015625 -4.5 4.5 s 2.015625 4.5 4.5 4.5 c 0.847656 0 1.675781 -0.242188 2.390625 -0.695312 l 2.402344 2.402343 c 0.390625 0.390625 1.023437 0.390625 1.414062 0 s 0.390625 -1.023437 0 -1.414062 l -2.398437 -2.398438 c 0.449218 -0.71875 0.691406 -1.546875 0.691406 -2.394531 c 0 -2.484375 -2.015625 -4.5 -4.5 -4.5 z m 0 2 c 1.378906 0 2.5 1.121094 2.5 2.5 s -1.121094 2.5 -2.5 2.5 s -2.5 -1.121094 -2.5 -2.5 s 1.121094 -2.5 2.5 -2.5 z m 0 0"/>
+ </g>
+</svg>
diff --git a/panels/diagnostics/meson.build b/panels/diagnostics/meson.build
new file mode 100644
index 0000000..0061d38
--- /dev/null
+++ b/panels/diagnostics/meson.build
@@ -0,0 +1,41 @@
+panels_list += cappletname
+desktop = 'gnome-@0@-panel.desktop'.format(cappletname)
+
+desktop_in = configure_file(
+ input: desktop + '.in.in',
+ output: desktop + '.in',
+ configuration: desktop_conf
+)
+
+i18n.merge_file(
+ type: 'desktop',
+ input: desktop_in,
+ output: desktop,
+ po_dir: po_dir,
+ install: true,
+ install_dir: control_center_desktopdir
+)
+
+sources = files('cc-diagnostics-panel.c')
+
+resource_data = files('cc-diagnostics-panel.ui')
+
+sources += gnome.compile_resources(
+ 'cc-' + cappletname + '-resources',
+ cappletname + '.gresource.xml',
+ c_name: 'cc_' + cappletname,
+ dependencies: resource_data,
+ export: true
+)
+
+cflags += '-DGNOMELOCALEDIR="@0@"'.format(control_center_localedir)
+
+panels_libs += static_library(
+ cappletname,
+ sources: sources,
+ include_directories: [top_inc, common_inc],
+ dependencies: common_deps,
+ c_args: cflags
+)
+
+subdir('icons')