[gnome-control-center/wip/privacy: 1/2] Add a privacy panel
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/privacy: 1/2] Add a privacy panel
- Date: Sat, 17 Nov 2012 16:40:16 +0000 (UTC)
commit d3c400bc08719fb661bc2431e0ee8adf894dbca5
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Nov 17 10:23:36 2012 -0500
Add a privacy panel
This adds a panel where we present information and controls
affecting the users privacy. This initial commit just puts
the framework in place, the panel itself is empty.
configure.ac | 3 +
panels/Makefile.am | 3 +-
panels/privacy/Makefile.am | 36 ++++++
panels/privacy/cc-privacy-panel.c | 145 ++++++++++++++++++++++
panels/privacy/cc-privacy-panel.h | 73 +++++++++++
panels/privacy/gnome-privacy-panel.desktop.in.in | 18 +++
panels/privacy/privacy-module.c | 41 ++++++
panels/privacy/privacy.ui | 33 +++++
8 files changed, 351 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d07054b..052c085 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,6 +132,7 @@ PKG_CHECK_MODULES(POWER_PANEL, $COMMON_MODULES upower-glib >= 0.9.1
PKG_CHECK_MODULES(COLOR_PANEL, $COMMON_MODULES colord >= 0.1.8)
PKG_CHECK_MODULES(PRINTERS_PANEL, $COMMON_MODULES
polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION)
+PKG_CHECK_MODULES(PRIVACY_PANEL, $COMMON_MODULES egg-list-box)
PKG_CHECK_MODULES(REGION_PANEL, $COMMON_MODULES
polkit-gobject-1 >= $POLKIT_REQUIRED_VERSION
gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION
@@ -469,6 +470,8 @@ panels/color/icons/256x256/Makefile
panels/color/icons/scalable/Makefile
panels/printers/Makefile
panels/printers/gnome-printers-panel.desktop.in
+panels/privacy/Makefile
+panels/privacy/gnome-privacy-panel.desktop.in
panels/network/Makefile
panels/network/gnome-network-panel.desktop.in
panels/universal-access/Makefile
diff --git a/panels/Makefile.am b/panels/Makefile.am
index 01697fb..a1fa3a4 100644
--- a/panels/Makefile.am
+++ b/panels/Makefile.am
@@ -13,7 +13,8 @@ SUBDIRS= \
keyboard \
universal-access \
user-accounts \
- datetime
+ datetime \
+ privacy
if BUILD_WACOM
SUBDIRS += wacom
diff --git a/panels/privacy/Makefile.am b/panels/privacy/Makefile.am
new file mode 100644
index 0000000..d9c5a72
--- /dev/null
+++ b/panels/privacy/Makefile.am
@@ -0,0 +1,36 @@
+cappletname = privacy
+
+INCLUDES = \
+ $(PANEL_CFLAGS) \
+ $(PRIVACY_PANEL_CFLAGS) \
+ -DGNOMECC_UI_DIR="\"$(uidir)\"" \
+ -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
+ -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \
+ -DDATADIR="\"$(datadir)\"" \
+ -I$(top_srcdir)/panels/common/ \
+ $(NULL)
+
+ccpanelsdir = $(PANELS_DIR)
+ccpanels_LTLIBRARIES = libprivacy.la
+
+libprivacy_la_SOURCES = \
+ privacy-module.c \
+ cc-privacy-panel.c \
+ cc-privacy-panel.h
+
+libprivacy_la_LIBADD = $(PANEL_LIBS) $(PRIVACY_PANEL_LIBS)
+libprivacy_la_LDFLAGS = $(PANEL_LDFLAGS)
+
+uidir = $(pkgdatadir)/ui
+dist_ui_DATA = \
+ privacy.ui
+
+ INTLTOOL_DESKTOP_RULE@
+
+desktopdir = $(datadir)/applications
+desktop_in_files = gnome-privacy-panel.desktop.in
+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+
+CLEANFILES = $(desktop_in_files) $(desktop_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/panels/privacy/cc-privacy-panel.c b/panels/privacy/cc-privacy-panel.c
new file mode 100644
index 0000000..a075c13
--- /dev/null
+++ b/panels/privacy/cc-privacy-panel.c
@@ -0,0 +1,145 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2012 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Matthias Clasen <mclasen redhat com>
+ */
+
+#include "cc-privacy-panel.h"
+
+#include <egg-list-box/egg-list-box.h>
+#include <gio/gdesktopappinfo.h>
+#include <glib/gi18n.h>
+
+CC_PANEL_REGISTER (CcPrivacyPanel, cc_privacy_panel)
+
+#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, s))
+
+struct _CcPrivacyPanelPrivate
+{
+ GtkBuilder *builder;
+ GtkWidget *list_box;
+
+ GSettings *lock_settings;
+};
+
+static void
+cc_privacy_panel_finalize (GObject *object)
+{
+ CcPrivacyPanelPrivate *priv = CC_PRIVACY_PANEL (object)->priv;
+
+ g_clear_object (&priv->builder);
+ g_clear_object (&priv->lock_settings);
+
+ G_OBJECT_CLASS (cc_privacy_panel_parent_class)->finalize (object);
+}
+
+static void
+update_separator_func (GtkWidget **separator,
+ GtkWidget *child,
+ GtkWidget *before,
+ gpointer user_data)
+{
+ if (*separator == NULL)
+ {
+ *separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_widget_show (*separator);
+ }
+}
+
+static void
+activate_child (CcPrivacyPanel *self,
+ GtkWidget *child)
+{
+ GObject *w;
+ const gchar *dialog_id;
+ GtkWidget *toplevel;
+
+ dialog_id = g_object_get_data (G_OBJECT (child), "dialog-id");
+ w = gtk_builder_get_object (self->priv->builder, dialog_id);
+ if (w == NULL)
+ {
+ g_warning ("No such dialog: %s", dialog_id);
+ return;
+ }
+
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
+ gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (toplevel));
+ gtk_window_set_modal (GTK_WINDOW (w), TRUE);
+ gtk_window_present (GTK_WINDOW (w));
+}
+
+static void
+cc_privacy_panel_init (CcPrivacyPanel *self)
+{
+ GError *error;
+ GtkWidget *widget;
+ GtkWidget *scrolled_window;
+ guint res;
+
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CC_TYPE_PRIVACY_PANEL, CcPrivacyPanelPrivate);
+
+ self->priv->builder = gtk_builder_new ();
+
+ error = NULL;
+ res = gtk_builder_add_from_file (self->priv->builder,
+ GNOMECC_UI_DIR "/privacy.ui",
+ &error);
+
+ if (res == 0)
+ {
+ g_warning ("Could not load interface file: %s",
+ (error != NULL) ? error->message : "unknown error");
+ g_clear_error (&error);
+ return;
+ }
+
+ scrolled_window = WID ("scrolled_window");
+ widget = GTK_WIDGET (egg_list_box_new ());
+ egg_list_box_add_to_scrolled (EGG_LIST_BOX (widget), GTK_SCROLLED_WINDOW (scrolled_window));
+ self->priv->list_box = widget;
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (widget, "child-activated",
+ G_CALLBACK (activate_child), self);
+
+ egg_list_box_set_separator_funcs (EGG_LIST_BOX (widget),
+ update_separator_func,
+ NULL, NULL);
+
+ widget = WID ("privacy_vbox");
+ gtk_widget_reparent (widget, (GtkWidget *) self);
+}
+
+static void
+cc_privacy_panel_class_init (CcPrivacyPanelClass *klass)
+{
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
+
+ oclass->finalize = cc_privacy_panel_finalize;
+
+ g_type_class_add_private (klass, sizeof (CcPrivacyPanelPrivate));
+}
+
+void
+cc_privacy_panel_register (GIOModule *module)
+{
+ cc_privacy_panel_register_type (G_TYPE_MODULE (module));
+ g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
+ CC_TYPE_PRIVACY_PANEL,
+ "privacy", 0);
+}
diff --git a/panels/privacy/cc-privacy-panel.h b/panels/privacy/cc-privacy-panel.h
new file mode 100644
index 0000000..d9c6004
--- /dev/null
+++ b/panels/privacy/cc-privacy-panel.h
@@ -0,0 +1,73 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2012 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Matthias Clasen <mclasen redhat com>
+ */
+
+#ifndef _CC_PRIVACY_PANEL_H
+#define _CC_PRIVACY_PANEL_H
+
+#include <shell/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_PRIVACY_PANEL cc_privacy_panel_get_type()
+
+#define CC_PRIVACY_PANEL(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ CC_TYPE_PRIVACY_PANEL, CcPrivacyPanel))
+
+#define CC_PRIVACY_PANEL_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ CC_TYPE_PRIVACY_PANEL, CcPrivacyPanelClass))
+
+#define CC_IS_PRIVACY_PANEL(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ CC_TYPE_PRIVACY_PANEL))
+
+#define CC_IS_PRIVACY_PANEL_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ CC_TYPE_PRIVACY_PANEL))
+
+#define CC_PRIVACY_PANEL_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ CC_TYPE_PRIVACY_PANEL, CcPrivacyPanelClass))
+
+typedef struct _CcPrivacyPanel CcPrivacyPanel;
+typedef struct _CcPrivacyPanelClass CcPrivacyPanelClass;
+typedef struct _CcPrivacyPanelPrivate CcPrivacyPanelPrivate;
+
+struct _CcPrivacyPanel
+{
+ CcPanel parent;
+
+ CcPrivacyPanelPrivate *priv;
+};
+
+struct _CcPrivacyPanelClass
+{
+ CcPanelClass parent_class;
+};
+
+GType cc_privacy_panel_get_type (void) G_GNUC_CONST;
+
+void cc_privacy_panel_register (GIOModule *module);
+
+G_END_DECLS
+
+#endif /* _CC_PRIVACY_PANEL_H */
diff --git a/panels/privacy/gnome-privacy-panel.desktop.in.in b/panels/privacy/gnome-privacy-panel.desktop.in.in
new file mode 100644
index 0000000..11bd9d1
--- /dev/null
+++ b/panels/privacy/gnome-privacy-panel.desktop.in.in
@@ -0,0 +1,18 @@
+[Desktop Entry]
+_Name=Privacy
+_Comment=Privacy settings
+Exec=gnome-control-center privacy
+# FIXME
+Icon=changes-prevent
+Terminal=false
+Type=Application
+StartupNotify=true
+Categories=GNOME;GTK;Settings;DesktopSettings;X-GNOME-Settings-Panel;X-GNOME-PersonalSettings
+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@
+X-GNOME-Settings-Panel=privacy
+# Translators: those are keywords for the search control-center panel
+_Keywords=screen lock;diagnostics;crash;
diff --git a/panels/privacy/privacy-module.c b/panels/privacy/privacy-module.c
new file mode 100644
index 0000000..fd487f4
--- /dev/null
+++ b/panels/privacy/privacy-module.c
@@ -0,0 +1,41 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2012 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Author: Matthias Clasen <mclasen redhat com>
+ */
+
+#include <config.h>
+
+#include "cc-privacy-panel.h"
+
+#include <glib/gi18n-lib.h>
+
+void
+g_io_module_load (GIOModule *module)
+{
+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+ /* register the panel */
+ cc_privacy_panel_register (module);
+}
+
+void
+g_io_module_unload (GIOModule *module)
+{
+}
diff --git a/panels/privacy/privacy.ui b/panels/privacy/privacy.ui
new file mode 100644
index 0000000..620fee4
--- /dev/null
+++ b/panels/privacy/privacy.ui
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkWindow" id="window1">
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox" id="privacy_vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">128</property>
+ <property name="margin_right">128</property>
+ <property name="margin_top">16</property>
+ <property name="margin_bottom">16</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolled_window">
+ <property name="width_request">400</property>
+ <property name="height_request">350</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]