[gnome-control-center/wip/privacy-swarm: 6/9] Add a usage panel



commit ba08b6d568e7570ed00b503863441861be40ee74
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Dec 11 14:25:32 2018 -0500

    Add a usage panel
    
    This is a broken out version of the privacy panel dialog.

 panels/usage/cc-usage-panel.c                | 345 ++++++++++++++++++++++++++
 panels/usage/cc-usage-panel.h                |  30 +++
 panels/usage/cc-usage-panel.ui               | 349 +++++++++++++++++++++++++++
 panels/usage/gnome-usage-panel.desktop.in.in |  19 ++
 panels/usage/meson.build                     |  40 +++
 panels/usage/usage.gresource.xml             |   6 +
 6 files changed, 789 insertions(+)
---
diff --git a/panels/usage/cc-usage-panel.c b/panels/usage/cc-usage-panel.c
new file mode 100644
index 000000000..8cc28b38e
--- /dev/null
+++ b/panels/usage/cc-usage-panel.c
@@ -0,0 +1,345 @@
+/* -*- 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 "list-box-helper.h"
+#include "cc-usage-panel.h"
+#include "cc-usage-resources.h"
+#include "cc-util.h"
+
+#include <gio/gdesktopappinfo.h>
+#include <glib/gi18n.h>
+
+struct _CcUsagePanel
+{
+  CcPanel     parent_instance;
+
+  GSettings  *privacy_settings;
+
+  GtkListBox  *usage_list_box;
+  GtkSwitch   *recently_used_switch;
+  GtkComboBox *retain_history_combo;
+
+  GtkListBox  *trash_list_box;
+  GtkSwitch   *purge_trash_switch;
+  GtkSwitch   *purge_temp_switch;
+  GtkComboBox *purge_after_combo;
+  GtkButton   *purge_temp_button;
+  GtkButton   *purge_trash_button;
+};
+
+CC_PANEL_REGISTER (CcUsagePanel, cc_usage_panel)
+
+static void
+purge_after_combo_changed_cb (GtkWidget    *widget,
+                              CcUsagePanel *self)
+{
+  GtkTreeIter iter;
+  GtkTreeModel *model;
+  guint value;
+  gboolean ret;
+
+  /* no selection */
+  ret = gtk_combo_box_get_active_iter (GTK_COMBO_BOX(widget), &iter);
+  if (!ret)
+    return;
+
+  /* get entry */
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX(widget));
+  gtk_tree_model_get (model, &iter,
+                      1, &value,
+                      -1);
+  g_settings_set (self->privacy_settings, "old-files-age", "u", value);
+}
+
+static void
+set_purge_after_value_for_combo (GtkComboBox  *combo_box,
+                                 CcUsagePanel *self)
+{
+  GtkTreeIter iter;
+  GtkTreeModel *model;
+  guint value;
+  gint value_tmp, value_prev;
+  gboolean ret;
+  guint i;
+
+  /* get entry */
+  model = gtk_combo_box_get_model (combo_box);
+  ret = gtk_tree_model_get_iter_first (model, &iter);
+  if (!ret)
+    return;
+
+  value_prev = 0;
+  i = 0;
+
+  /* try to make the UI match the purge setting */
+  g_settings_get (self->privacy_settings, "old-files-age", "u", &value);
+  do
+    {
+      gtk_tree_model_get (model, &iter,
+                          1, &value_tmp,
+                          -1);
+      if (value == value_tmp ||
+          (value_tmp > value_prev && value < value_tmp))
+        {
+          gtk_combo_box_set_active_iter (combo_box, &iter);
+          return;
+        }
+      value_prev = value_tmp;
+      i++;
+    } while (gtk_tree_model_iter_next (model, &iter));
+
+  /* If we didn't find the setting in the list */
+  gtk_combo_box_set_active (combo_box, i - 1);
+}
+
+static gboolean
+run_warning (CcUsagePanel *self,
+             const gchar  *prompt,
+             const gchar  *text,
+             const gchar  *button_title)
+{
+  GtkWindow *parent;
+  GtkWidget *dialog;
+  GtkWidget *button;
+  int result;
+
+  parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
+
+  dialog = gtk_message_dialog_new (parent,
+                                   0,
+                                   GTK_MESSAGE_WARNING,
+                                   GTK_BUTTONS_NONE,
+                                   NULL);
+  g_object_set (dialog,
+                "text", prompt,
+                "secondary-text", text,
+                NULL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_CANCEL);
+  gtk_dialog_add_button (GTK_DIALOG (dialog), button_title, GTK_RESPONSE_OK);
+
+  gtk_dialog_set_default_response (GTK_DIALOG (dialog), FALSE);
+
+  button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+  gtk_style_context_add_class (gtk_widget_get_style_context (button), "destructive-action");
+
+  result = gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_destroy (dialog);
+
+  return result == GTK_RESPONSE_OK;
+}
+
+static void
+empty_trash (CcUsagePanel *self)
+{
+  g_autoptr (GDBusConnection) bus = NULL;
+  gboolean result;
+
+  result = run_warning (self,
+                        _("Empty all items from Trash?"),
+                        _("All items in the Trash will be permanently deleted."),
+                        _("_Empty Trash"));
+
+  if (!result)
+    return;
+
+  bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+  g_dbus_connection_call (bus,
+                          "org.gnome.SettingsDaemon.Housekeeping",
+                          "/org/gnome/SettingsDaemon/Housekeeping",
+                          "org.gnome.SettingsDaemon.Housekeeping",
+                          "EmptyTrash",
+                          NULL, NULL, 0, -1, NULL, NULL, NULL);
+}
+
+static void
+purge_temp (CcUsagePanel *self)
+{
+  g_autoptr (GDBusConnection) bus = NULL;
+  gboolean result;
+
+  result = run_warning (self,
+                        _("Delete all the temporary files?"),
+                        _("All the temporary files will be permanently deleted."),
+                        _("_Purge Temporary Files"));
+
+  if (!result)
+    return;
+
+  bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+  g_dbus_connection_call (bus,
+                          "org.gnome.SettingsDaemon.Housekeeping",
+                          "/org/gnome/SettingsDaemon/Housekeeping",
+                          "org.gnome.SettingsDaemon.Housekeeping",
+                          "RemoveTempFiles",
+                          NULL, NULL, 0, -1, NULL, NULL, NULL);
+}
+
+static void
+cc_usage_panel_finalize (GObject *object)
+{
+  CcUsagePanel *self = CC_USAGE_PANEL (object);
+
+  g_clear_object (&self->privacy_settings);
+
+  G_OBJECT_CLASS (cc_usage_panel_parent_class)->finalize (object);
+}
+
+static void
+retain_history_combo_changed_cb (GtkWidget *widget,
+                                 CcUsagePanel *self)
+{
+  GtkTreeIter iter;
+  GtkTreeModel *model;
+  gint value;
+  gboolean ret;
+
+  ret = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);
+  if (!ret)
+    return;
+
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX(widget));
+  gtk_tree_model_get (model, &iter,
+                      1, &value,
+                      -1);
+  g_settings_set (self->privacy_settings, "recent-files-max-age", "i", value);
+}
+
+static void
+set_retain_history_value_for_combo (GtkComboBox  *combo_box,
+                                    CcUsagePanel *self)
+{
+  GtkTreeIter iter;
+  GtkTreeModel *model;
+  gint value;
+  gint value_tmp, value_prev;
+  gboolean ret;
+  guint i;
+
+  model = gtk_combo_box_get_model (combo_box);
+  ret = gtk_tree_model_get_iter_first (model, &iter);
+  if (!ret)
+    return;
+
+  value_prev = 0;
+  i = 0;
+
+  g_settings_get (self->privacy_settings, "recent-files-max-age", "i", &value);
+  do
+    {
+      gtk_tree_model_get (model, &iter,
+                          1, &value_tmp,
+                          -1);
+      if (value == value_tmp ||
+          (value > 0 && value_tmp > value_prev && value < value_tmp))
+        {
+          gtk_combo_box_set_active_iter (combo_box, &iter);
+          return;
+        }
+      value_prev = value_tmp;
+      i++;
+    } while (gtk_tree_model_iter_next (model, &iter));
+
+  gtk_combo_box_set_active (combo_box, i - 1);
+}
+
+static void
+cc_usage_panel_init (CcUsagePanel *self)
+{
+  g_resources_register (cc_usage_get_resource ());
+
+  gtk_widget_init_template (GTK_WIDGET (self));
+
+  gtk_list_box_set_header_func (self->usage_list_box,
+                                cc_list_box_update_header_func,
+                                NULL, NULL);
+
+  gtk_list_box_set_header_func (self->trash_list_box,
+                                cc_list_box_update_header_func,
+                                NULL, NULL);
+
+  self->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");
+
+  g_settings_bind (self->privacy_settings,
+                   "remember-recent-files",
+                   self->recently_used_switch,
+                   "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  set_retain_history_value_for_combo (self->retain_history_combo, self);
+  g_signal_connect (self->retain_history_combo,
+                    "changed",
+                    G_CALLBACK (retain_history_combo_changed_cb),
+                    self);
+
+  g_settings_bind (self->privacy_settings,
+                   "remember-recent-files",
+                   self->retain_history_combo,
+                   "sensitive",
+                   G_SETTINGS_BIND_GET);
+
+  g_settings_bind (self->privacy_settings, "remove-old-trash-files",
+                   self->purge_trash_switch, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (self->privacy_settings, "remove-old-temp-files",
+                   self->purge_temp_switch, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  set_purge_after_value_for_combo (self->purge_after_combo, self);
+  g_signal_connect (self->purge_after_combo,
+                    "changed",
+                    G_CALLBACK (purge_after_combo_changed_cb),
+                    self);
+
+  g_signal_connect_swapped (self->purge_trash_button, "clicked", G_CALLBACK (empty_trash), self);
+  g_signal_connect_swapped (self->purge_temp_button, "clicked", G_CALLBACK (purge_temp), self);
+}
+
+static void
+clear_recent (CcUsagePanel *self)
+{
+  GtkRecentManager *m;
+
+  m = gtk_recent_manager_get_default ();
+  gtk_recent_manager_purge_items (m, NULL);
+}
+
+static void
+cc_usage_panel_class_init (CcUsagePanelClass *klass)
+{
+  GObjectClass *oclass = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  oclass->finalize = cc_usage_panel_finalize;
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/usage/cc-usage-panel.ui");
+
+  gtk_widget_class_bind_template_child (widget_class, CcUsagePanel, purge_after_combo);
+  gtk_widget_class_bind_template_child (widget_class, CcUsagePanel, purge_temp_switch);
+  gtk_widget_class_bind_template_child (widget_class, CcUsagePanel, purge_trash_button);
+  gtk_widget_class_bind_template_child (widget_class, CcUsagePanel, purge_trash_switch);
+  gtk_widget_class_bind_template_child (widget_class, CcUsagePanel, purge_temp_button);
+  gtk_widget_class_bind_template_child (widget_class, CcUsagePanel, recently_used_switch);
+  gtk_widget_class_bind_template_child (widget_class, CcUsagePanel, retain_history_combo);
+  gtk_widget_class_bind_template_child (widget_class, CcUsagePanel, trash_list_box);
+  gtk_widget_class_bind_template_child (widget_class, CcUsagePanel, usage_list_box);
+
+  gtk_widget_class_bind_template_callback (widget_class, clear_recent);
+}
diff --git a/panels/usage/cc-usage-panel.h b/panels/usage/cc-usage-panel.h
new file mode 100644
index 000000000..83dc6fc82
--- /dev/null
+++ b/panels/usage/cc-usage-panel.h
@@ -0,0 +1,30 @@
+/* -*- 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_USAGE_PANEL (cc_usage_panel_get_type ())
+G_DECLARE_FINAL_TYPE (CcUsagePanel, cc_usage_panel, CC, USAGE_PANEL, CcPanel)
+
+G_END_DECLS
diff --git a/panels/usage/cc-usage-panel.ui b/panels/usage/cc-usage-panel.ui
new file mode 100644
index 000000000..fb132ada4
--- /dev/null
+++ b/panels/usage/cc-usage-panel.ui
@@ -0,0 +1,349 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.1 -->
+<interface>
+  <template class="CcUsagePanel" parent="CcPanel">
+    <property name="visible">True</property>
+    <child>
+      <object class="GtkScrolledWindow">
+        <property name="visible">true</property>
+        <property name="hscrollbar-policy">never</property>
+        <child>
+          <object class="HdyColumn">
+            <property name="visible">True</property>
+            <property name="maximum_width">600</property>
+            <property name="linear_growth_width">400</property>
+            <property name="margin_top">32</property>
+            <property name="margin_bottom">32</property>
+            <property name="margin_start">12</property>
+            <property name="margin_end">12</property>
+
+            <!-- File History -->
+            <child>
+              <object class="GtkBox">
+                <property name="visible">true</property>
+                <property name="orientation">vertical</property>
+                <property name="hexpand">1</property>
+                <property name="spacing">12</property>
+
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">true</property>
+                    <property name="label" translatable="yes">File History</property>
+                    <property name="xalign">0</property>
+                    <attributes>
+                      <attribute name="weight" value="bold" />
+                    </attributes>
+                  </object>
+                </child>
+
+                <child>
+                  <object class="GtkLabel" id="usage_description_label">
+                    <property name="visible">true</property>
+                    <property name="margin-bottom">12</property>
+                    <property name="label" translatable="yes">File history keeps a record of files that you 
have used. This information is shared between applications, and makes it easier to find files that you might 
want to use.</property>
+                    <property name="wrap">1</property>
+                    <property name="max-width-chars">50</property>
+                    <property name="xalign">0</property>
+                  </object>
+                </child>
+
+                <child>
+                  <object class="GtkListBox" id="usage_list_box">
+                    <property name="visible">true</property>
+                    <property name="can-focus">1</property>
+                    <property name="selection-mode">none</property>
+                    <child>
+                      <object class="HdyActionRow">
+                        <property name="visible">true</property>
+                        <property name="title" translatable="yes">File H_istory</property>
+                        <property name="activatable-widget">recently_used_switch</property>
+                        <property name="use-underline">true</property>
+                        <child type="action">
+                          <object class="GtkSwitch" id="recently_used_switch">
+                            <property name="visible">true</property>
+                            <property name="halign">end</property>
+                            <property name="valign">center</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkListBoxRow">
+                        <property name="visible">true</property>
+                        <child>
+                          <object class="GtkBox">
+                            <property name="visible">true</property>
+                            <property name="margin">12</property>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="visible">true</property>
+                                <property name="label" translatable="yes">File _History Duration</property>
+                                <property name="use_underline">1</property>
+                                <property name="mnemonic_widget">retain_history_combo</property>
+                                <property name="sensitive" bind-source="retain_history_combo" 
bind-property="sensitive"/>
+                                <property name="xalign">0</property>
+                                <property name="valign">center</property>
+                              </object>
+                              <packing>
+                                <property name="expand">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBoxText" id="retain_history_combo">
+                                <property name="visible">true</property>
+                                <property name="valign">center</property>
+                                <property name="entry_text_column">0</property>
+                                <property name="model">retain_history_model</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <style>
+                      <class name="view"/>
+                      <class name="frame"/>
+                    </style>
+                  </object>
+                </child>
+
+                <child>
+                  <object class="GtkBox">
+                    <property name="visible">true</property>
+                    <property name="hexpand">true</property>
+                    <property name="halign">end</property>
+                    <property name="homogeneous">true</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <object class="GtkButton" id="clear_recent_button">
+                        <property name="visible">true</property>
+                        <property name="valign">center</property>
+                        <property name="label" translatable="yes">_Clear History…</property>
+                        <property name="use_underline">1</property>
+                        <signal name="clicked" handler="clear_recent" swapped="yes"/>
+                        <style>
+                          <class name="destructive-action"/>
+                        </style>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+
+                <!-- Trash & Temporary Files -->
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">true</property>
+                    <property name="margin-top">18</property>
+                    <property name="label" translatable="yes">Trash &amp; Temporary Files</property>
+                    <property name="xalign">0</property>
+                    <attributes>
+                      <attribute name="weight" value="bold" />
+                    </attributes>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">true</property>
+                    <property name="label" translatable="yes">Trash and temporary files can sometimes 
include personal or sensitive information. Automatically deleting them can help to protect privacy.</property>
+                    <property name="wrap">1</property>
+                    <property name="max-width-chars">50</property>
+                    <property name="xalign">0</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkListBox" id="trash_list_box">
+                    <property name="visible">true</property>
+                    <property name="can-focus">1</property>
+                    <property name="selection-mode">none</property>
+                    <child>
+                      <object class="HdyActionRow">
+                        <property name="visible">true</property>
+                        <property name="title" translatable="yes">Automatically Delete _Trash 
Content</property>
+                        <property name="activatable-widget">purge_trash_switch</property>
+                        <property name="use-underline">true</property>
+                        <child type="action">
+                          <object class="GtkSwitch" id="purge_trash_switch">
+                            <property name="visible">true</property>
+                            <property name="halign">end</property>
+                            <property name="valign">center</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="HdyActionRow">
+                        <property name="visible">true</property>
+                        <property name="title" translatable="yes">Automatically Delete Temporary 
_Files</property>
+                        <property name="activatable-widget">purge_temp_switch</property>
+                        <property name="use-underline">true</property>
+                        <child type="action">
+                          <object class="GtkSwitch" id="purge_temp_switch">
+                            <property name="visible">true</property>
+                            <property name="halign">end</property>
+                            <property name="valign">center</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkListBoxRow">
+                        <property name="visible">true</property>
+                        <child>
+                          <object class="GtkBox">
+                            <property name="visible">true</property>
+                            <property name="margin">12</property>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="visible">true</property>
+                                <property name="label" translatable="yes">Automatically Delete 
_Period</property>
+                                <property name="use_underline">1</property>
+                                <property name="mnemonic_widget">purge_after_combo</property>
+                                <property name="sensitive" bind-source="purge_after_combo" 
bind-property="sensitive"/>
+                                <property name="xalign">0</property>
+                                <property name="valign">center</property>
+                              </object>
+                              <packing>
+                                <property name="expand">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBoxText" id="purge_after_combo">
+                                <property name="visible">true</property>
+                                <property name="valign">center</property>
+                                <property name="entry_text_column">0</property>
+                                <property name="model">purge_after_model</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <style>
+                      <class name="view"/>
+                      <class name="frame"/>
+                    </style>
+                  </object>
+                </child>
+
+                <child>
+                  <object class="GtkBox">
+                    <property name="visible">true</property>
+                    <property name="hexpand">true</property>
+                    <property name="halign">end</property>
+                    <property name="homogeneous">true</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <object class="GtkButton" id="purge_trash_button">
+                        <property name="visible">true</property>
+                        <property name="halign">end</property>
+                        <property name="valign">center</property>
+                        <property name="label" translatable="yes">_Empty Trash…</property>
+                        <property name="use-underline">true</property>
+                        <style>
+                          <class name="destructive-action"/>
+                        </style>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="purge_temp_button">
+                        <property name="visible">true</property>
+                        <property name="halign">end</property>
+                        <property name="valign">center</property>
+                        <property name="label" translatable="yes">_Delete Temporary Files…</property>
+                        <property name="use-underline">true</property>
+                          <style>
+                            <class name="destructive-action"/>
+                          </style>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+
+              </object>
+            </child>
+
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+
+  <object class="GtkListStore" id="purge_after_model">
+    <columns>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+      <!-- column-name value -->
+      <column type="guint"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes" context="purge_files" comments="Translators: Option for &quot;Purge 
After&quot; in &quot;Purge Trash &amp; Temporary Files&quot; dialog.">1 hour</col>
+        <col id="1">0</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="purge_files" comments="Translators: Option for &quot;Purge 
After&quot; in &quot;Purge Trash &amp; Temporary Files&quot; dialog.">1 day</col>
+        <col id="1">1</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="purge_files" comments="Translators: Option for &quot;Purge 
After&quot; in &quot;Purge Trash &amp; Temporary Files&quot; dialog.">2 days</col>
+        <col id="1">2</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="purge_files" comments="Translators: Option for &quot;Purge 
After&quot; in &quot;Purge Trash &amp; Temporary Files&quot; dialog.">3 days</col>
+        <col id="1">3</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="purge_files" comments="Translators: Option for &quot;Purge 
After&quot; in &quot;Purge Trash &amp; Temporary Files&quot; dialog.">4 days</col>
+        <col id="1">4</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="purge_files" comments="Translators: Option for &quot;Purge 
After&quot; in &quot;Purge Trash &amp; Temporary Files&quot; dialog.">5 days</col>
+        <col id="1">5</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="purge_files" comments="Translators: Option for &quot;Purge 
After&quot; in &quot;Purge Trash &amp; Temporary Files&quot; dialog.">6 days</col>
+        <col id="1">6</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="purge_files" comments="Translators: Option for &quot;Purge 
After&quot; in &quot;Purge Trash &amp; Temporary Files&quot; dialog.">7 days</col>
+        <col id="1">7</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="purge_files" comments="Translators: Option for &quot;Purge 
After&quot; in &quot;Purge Trash &amp; Temporary Files&quot; dialog.">14 days</col>
+        <col id="1">14</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="purge_files" comments="Translators: Option for &quot;Purge 
After&quot; in &quot;Purge Trash &amp; Temporary Files&quot; dialog.">30 days</col>
+        <col id="1">30</col>
+      </row>
+    </data>
+  </object>
+
+  <object class="GtkListStore" id="retain_history_model">
+    <columns>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+      <!-- column-name value -->
+      <column type="gint"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes" context="retain_history" comments="Translators: Option for 
&quot;Retain History&quot; in &quot;Usage &amp; History&quot; dialog.">1 day</col>
+        <col id="1">1</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="retain_history" comments="Translators: Option for 
&quot;Retain History&quot; in &quot;Usage &amp; History&quot; dialog.">7 days</col>
+        <col id="1">7</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="retain_history" comments="Translators: Option for 
&quot;Retain History&quot; in &quot;Usage &amp; History&quot; dialog.">30 days</col>
+        <col id="1">30</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes" context="retain_history" comments="Translators: Option for 
&quot;Retain History&quot; in &quot;Usage &amp; History&quot; dialog.">Forever</col>
+        <col id="1">-1</col>
+      </row>
+    </data>
+  </object>
+
+</interface>
diff --git a/panels/usage/gnome-usage-panel.desktop.in.in b/panels/usage/gnome-usage-panel.desktop.in.in
new file mode 100644
index 000000000..a693364ee
--- /dev/null
+++ b/panels/usage/gnome-usage-panel.desktop.in.in
@@ -0,0 +1,19 @@
+[Desktop Entry]
+Name=File History & Trash
+Comment=Don't leave traces
+Exec=gnome-control-center usage
+# FIXME
+# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
+Icon=system-file-manager
+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 Privacy panel. Do NOT translate or localize the semicolons! The list 
MUST also end with a semicolon!
+Keywords=screen;lock;diagnostics;crash;private;recent;temporary;tmp;index;name;network;identity;
diff --git a/panels/usage/meson.build b/panels/usage/meson.build
new file mode 100644
index 000000000..74f720ecd
--- /dev/null
+++ b/panels/usage/meson.build
@@ -0,0 +1,40 @@
+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(
+  desktop,
+  type: 'desktop',
+  input: desktop_in,
+  output: desktop,
+  po_dir: po_dir,
+  install: true,
+  install_dir: control_center_desktopdir
+)
+
+sources = files('cc-usage-panel.c')
+
+resource_data = files('cc-usage-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
+)
diff --git a/panels/usage/usage.gresource.xml b/panels/usage/usage.gresource.xml
new file mode 100644
index 000000000..3f55dbff0
--- /dev/null
+++ b/panels/usage/usage.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/control-center/usage">
+    <file preprocess="xml-stripblanks">cc-usage-panel.ui</file>
+  </gresource>
+</gresources>


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