[gnome-control-center/T20818: 54/54] WIP: Introduce Automatic Updates panel



commit c12fe76471a2dbab8b9f8d9f73138bf9ab9fddb9
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Jan 19 23:55:53 2018 -0200

    WIP: Introduce Automatic Updates panel

 configure.ac                                     |    3 +
 panels/Makefile.am                               |    1 +
 panels/updates/Makefile.am                       |   40 +++
 panels/updates/cc-time-scheduler.c               |   93 +++++++
 panels/updates/cc-time-scheduler.h               |   29 ++
 panels/updates/cc-time-scheduler.ui              |  124 +++++++++
 panels/updates/cc-updates-panel.c                |   85 ++++++
 panels/updates/cc-updates-panel.h                |   33 +++
 panels/updates/cc-updates-panel.ui               |  323 ++++++++++++++++++++++
 panels/updates/gnome-updates-panel.desktop.in.in |   17 ++
 panels/updates/updates.gresource.xml             |    7 +
 shell/Makefile.am                                |    1 +
 shell/cc-panel-list.c                            |    1 +
 shell/cc-panel-loader.c                          |    2 +
 14 files changed, 759 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8a017c3..ee869d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -185,6 +185,7 @@ PKG_CHECK_MODULES(USER_ACCOUNTS_PANEL, $COMMON_MODULES
                   accountsservice >= $ACCOUNTSSERVICE_REQUIRED_VERSION)
 PKG_CHECK_MODULES(SHARING_PANEL, $COMMON_MODULES flatpak)
 PKG_CHECK_MODULES(REMOTE_LOGIN_HELPER, glib-2.0 >= $GLIB_REQUIRED_VERSION gio-2.0)
+PKG_CHECK_MODULES(UPDATES_PANEL, $COMMON_MODULES)
 
 PKG_CHECK_MODULES(GVC, gobject-2.0 libpulse libpulse-mainloop-glib)
 AM_CONDITIONAL(HAVE_INTROSPECTION, false)
@@ -565,6 +566,8 @@ panels/notifications/Makefile
 panels/notifications/gnome-notifications-panel.desktop.in
 panels/universal-access/Makefile
 panels/universal-access/gnome-universal-access-panel.desktop.in
+panels/updates/Makefile
+panels/updates/gnome-updates-panel.desktop.in
 panels/user-accounts/Makefile
 panels/user-accounts/data/Makefile
 panels/user-accounts/data/gnome-user-accounts-panel.desktop.in
diff --git a/panels/Makefile.am b/panels/Makefile.am
index 507cd2f..c06d8c3 100644
--- a/panels/Makefile.am
+++ b/panels/Makefile.am
@@ -17,6 +17,7 @@ SUBDIRS= \
        search \
        privacy \
        sharing \
+       updates \
        printers
 
 if BUILD_WACOM
diff --git a/panels/updates/Makefile.am b/panels/updates/Makefile.am
new file mode 100644
index 0000000..46c4b81
--- /dev/null
+++ b/panels/updates/Makefile.am
@@ -0,0 +1,40 @@
+# This is used in PANEL_CFLAGS
+cappletname = updates
+
+AM_CPPFLAGS =                                          \
+       $(PANEL_CFLAGS)                                 \
+       $(UPDATES_PANEL_CFLAGS)                         \
+       -DGNOMELOCALEDIR="\"$(datadir)/locale\""        \
+       $(NULL)
+
+BUILT_SOURCES =                        \
+       cc-time-scheduler.c     \
+       cc-time-scheduler.h     \
+       cc-updates-resources.c  \
+       cc-updates-resources.h
+
+noinst_LTLIBRARIES = libupdates.la
+
+libupdates_la_SOURCES =        \
+       $(BUILT_SOURCES)                \
+       cc-updates-panel.c              \
+       cc-updates-panel.h
+
+libupdates_properties_la_LIBADD = $(PANEL_LIBS) $(UPDATES_PANEL_LIBS)
+
+resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies 
$(srcdir)/updates.gresource.xml)
+cc-updates-resources.c: updates.gresource.xml $(resource_files)
+       $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name 
cc_updates $<
+cc-updates-resources.h: updates.gresource.xml $(resource_files)
+       $(AM_V_GEN) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name 
cc_updates $<
+
+@INTLTOOL_DESKTOP_RULE@
+
+desktopdir = $(datadir)/applications
+desktop_in_files = gnome-updates-panel.desktop.in
+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+
+CLEANFILES = $(Desktop_in_files) $(desktop_DATA) $(BUILT_SOURCES)
+EXTRA_DIST = $(resource_files) updates.gresource.xml
+
+-include $(top_srcdir)/git.mk
diff --git a/panels/updates/cc-time-scheduler.c b/panels/updates/cc-time-scheduler.c
new file mode 100644
index 0000000..1119530
--- /dev/null
+++ b/panels/updates/cc-time-scheduler.c
@@ -0,0 +1,93 @@
+/* cc-time-scheduler.c
+ *
+ * Copyright © 2018 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ *
+ * 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 3 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/>.
+ */
+
+#include "cc-time-scheduler.h"
+
+struct _CcTimeScheduler
+{
+  GtkGrid             parent;
+};
+
+G_DEFINE_TYPE (CcTimeScheduler, cc_time_scheduler, GTK_TYPE_GRID)
+
+enum
+{
+  PROP_0,
+  PROP_START_DATE,
+  PROP_END_DATE,
+  N_PROPS
+};
+
+static GParamSpec *properties [N_PROPS];
+
+static void
+cc_time_scheduler_finalize (GObject *object)
+{
+  CcTimeScheduler *self = (CcTimeScheduler *)object;
+
+  G_OBJECT_CLASS (cc_time_scheduler_parent_class)->finalize (object);
+}
+
+static void
+cc_time_scheduler_get_property (GObject    *object,
+                                guint       prop_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
+{
+  CcTimeScheduler *self = CC_TIME_SCHEDULER (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+cc_time_scheduler_set_property (GObject      *object,
+                                guint         prop_id,
+                                const GValue *value,
+                                GParamSpec   *pspec)
+{
+  CcTimeScheduler *self = CC_TIME_SCHEDULER (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+cc_time_scheduler_class_init (CcTimeSchedulerClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->finalize = cc_time_scheduler_finalize;
+  object_class->get_property = cc_time_scheduler_get_property;
+  object_class->set_property = cc_time_scheduler_set_property;
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/updates/cc-time-scheduler.ui");
+}
+
+static void
+cc_time_scheduler_init (CcTimeScheduler *self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
\ No newline at end of file
diff --git a/panels/updates/cc-time-scheduler.h b/panels/updates/cc-time-scheduler.h
new file mode 100644
index 0000000..152860b
--- /dev/null
+++ b/panels/updates/cc-time-scheduler.h
@@ -0,0 +1,29 @@
+/* cc-time-scheduler.c
+ *
+ * Copyright © 2018 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ *
+ * 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 3 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/>.
+ */
+
+#pragma once
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_TIME_SCHEDULER (cc_time_scheduler_get_type())
+
+G_DECLARE_FINAL_TYPE (CcTimeScheduler, cc_time_scheduler, CC, TIME_SCHEDULER, GtkGrid)
+
+G_END_DECLS
\ No newline at end of file
diff --git a/panels/updates/cc-time-scheduler.ui b/panels/updates/cc-time-scheduler.ui
new file mode 100644
index 0000000..a1430ea
--- /dev/null
+++ b/panels/updates/cc-time-scheduler.ui
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="3.20"/>
+  <template class="CcTimeScheduler" parent="GtkGrid">
+    <property name="visible">True</property>
+    <property name="can-focus">False</property>
+    <property name="column-spacing">12</property>
+
+    <!-- Start time -->
+    <child>
+      <object class="GtkLabel">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="yalign">0.0</property>
+        <property name="label" translatable="yes">From</property>
+        <style>
+          <class name="dim-label" />
+        </style>
+      </object>
+      <packing>
+        <property name="top-attach">0</property>
+        <property name="left-attach">0</property>
+      </packing>
+    </child>
+
+    <child>
+      <object class="GtkSpinButton">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="orientation">vertical</property>
+      </object>
+      <packing>
+        <property name="top-attach">0</property>
+        <property name="left-attach">1</property>
+      </packing>
+    </child>
+
+    <child>
+      <object class="GtkSpinButton">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="orientation">vertical</property>
+      </object>
+      <packing>
+        <property name="top-attach">0</property>
+        <property name="left-attach">2</property>
+      </packing>
+    </child>
+
+    <child>
+      <object class="GtkComboBoxText">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="valign">center</property>
+        <items>
+          <item translatable="yes" id="am">AM</item>
+          <item translatable="yes" id="pm">PM</item>
+        </items>
+      </object>
+      <packing>
+        <property name="top-attach">0</property>
+        <property name="left-attach">3</property>
+      </packing>
+    </child>
+
+    <!-- End time -->
+    <child>
+      <object class="GtkLabel">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="yalign">0.0</property>
+        <property name="label" translatable="yes">To</property>
+        <style>
+          <class name="dim-label" />
+        </style>
+      </object>
+      <packing>
+        <property name="top-attach">0</property>
+        <property name="left-attach">4</property>
+      </packing>
+    </child>
+
+    <child>
+      <object class="GtkSpinButton">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="orientation">vertical</property>
+      </object>
+      <packing>
+        <property name="top-attach">0</property>
+        <property name="left-attach">5</property>
+      </packing>
+    </child>
+
+    <child>
+      <object class="GtkSpinButton">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="orientation">vertical</property>
+      </object>
+      <packing>
+        <property name="top-attach">0</property>
+        <property name="left-attach">6</property>
+      </packing>
+    </child>
+
+    <child>
+      <object class="GtkComboBoxText">
+        <property name="visible">True</property>
+        <property name="can-focus">False</property>
+        <property name="valign">center</property>
+        <items>
+          <item translatable="yes" id="am">AM</item>
+          <item translatable="yes" id="pm">PM</item>
+        </items>
+      </object>
+      <packing>
+        <property name="top-attach">0</property>
+        <property name="left-attach">7</property>
+      </packing>
+    </child>
+
+  </template>
+</interface>
\ No newline at end of file
diff --git a/panels/updates/cc-updates-panel.c b/panels/updates/cc-updates-panel.c
new file mode 100644
index 0000000..587cd71
--- /dev/null
+++ b/panels/updates/cc-updates-panel.c
@@ -0,0 +1,85 @@
+/* cc-updates-panel.c
+ *
+ * Copyright © 2018 Endless, 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/>.
+ *
+ * Authors: Georges Basile Stavracas Neto <georges endlessm com>
+ */
+
+#include "cc-time-scheduler.h"
+#include "cc-updates-panel.h"
+#include "cc-updates-resources.h"
+
+struct _CcUpdatesPanel
+{
+  CcPanel parent_instance;
+};
+
+G_DEFINE_TYPE (CcUpdatesPanel, cc_updates_panel, CC_TYPE_PANEL)
+
+enum {
+  PROP_0,
+  PROP_PARAMETERS,
+  N_PROPS
+};
+
+static void
+cc_updates_panel_finalize (GObject *object)
+{
+  //CcUpdatesPanel *self = (CcUpdatesPanel *)object;
+
+  G_OBJECT_CLASS (cc_updates_panel_parent_class)->finalize (object);
+}
+
+static void
+cc_updates_panel_set_property (GObject      *object,
+                               guint         prop_id,
+                               const GValue *value,
+                               GParamSpec   *pspec)
+{
+  switch (prop_id)
+    {
+    case PROP_PARAMETERS:
+      /* Nothing to do */
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+cc_updates_panel_class_init (CcUpdatesPanelClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->finalize = cc_updates_panel_finalize;
+  object_class->set_property = cc_updates_panel_set_property;
+
+  g_object_class_override_property (object_class, PROP_PARAMETERS, "parameters");
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/updates/cc-updates-panel.ui");
+
+  g_type_ensure (CC_TYPE_TIME_SCHEDULER);
+}
+
+static void
+cc_updates_panel_init (CcUpdatesPanel *self)
+{
+  g_resources_register (cc_updates_get_resource ());
+
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
\ No newline at end of file
diff --git a/panels/updates/cc-updates-panel.h b/panels/updates/cc-updates-panel.h
new file mode 100644
index 0000000..7ce3bf4
--- /dev/null
+++ b/panels/updates/cc-updates-panel.h
@@ -0,0 +1,33 @@
+/* cc-updates-panel.h
+ *
+ * Copyright © 2018 Endless, 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/>.
+ *
+ * Authors: Georges Basile Stavracas Neto <georges endlessm com>
+ */
+
+#pragma once
+
+#include <shell/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_UPDATES_PANEL (cc_updates_panel_get_type())
+
+G_DECLARE_FINAL_TYPE (CcUpdatesPanel, cc_updates_panel, CC, UPDATES_PANEL, CcPanel)
+
+CcUpdatesPanel *cc_updates_panel_new (void);
+
+G_END_DECLS
\ No newline at end of file
diff --git a/panels/updates/cc-updates-panel.ui b/panels/updates/cc-updates-panel.ui
new file mode 100644
index 0000000..1e79f64
--- /dev/null
+++ b/panels/updates/cc-updates-panel.ui
@@ -0,0 +1,323 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="3.20"/>
+  <template class="CcUpdatesPanel" parent="CcPanel">
+    <property name="visible">True</property>
+    <property name="can-focus">False</property>
+    <child>
+      <object class="GtkScrolledWindow">
+        <property name="visible">True</property>
+        <property name="hscrollbar_policy">never</property>
+
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">18</property>
+            <property name="margin">32</property>
+            <property name="hexpand">True</property>
+            <property name="width-request">300</property>
+
+            <!--
+              Stub boxes to pull the widgets to the middle, and yet allow them to
+              grow and cover a third of the available space
+            -->
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="hexpand">True</property>
+              </object>
+            </child>
+
+            <!-- Content -->
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">18</property>
+
+                <!-- Device header -->
+                <child>
+                  <object class="GtkFrame">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+
+                    <child>
+                      <object class="GtkGrid">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="column-spacing">12</property>
+                        <property name="margin">18</property>
+
+                        <child>
+                          <object class="GtkImage" id="strength_icon">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="pixel_size">48</property>
+                            <property name="icon_name">network-wireless-symbolic</property>
+                            <style>
+                              <class name="dim-label" />
+                            </style>
+                          </object>
+                          <packing>
+                            <property name="top-attach">0</property>
+                            <property name="left-attach">0</property>
+                            <property name="height">2</property>
+                          </packing>
+                        </child>
+
+                        <child>
+                          <object class="GtkLabel" id="network_name_label">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="hexpand">True</property>
+                            <property name="xalign">0.0</property>
+                            <property name="yalign">1.0</property>
+                            <property name="label">Network name</property>
+                            <attributes>
+                              <attribute name="scale" value="1.2" />
+                              <attribute name="weight" value="bold" />
+                            </attributes>
+                          </object>
+                          <packing>
+                            <property name="top-attach">0</property>
+                            <property name="left-attach">1</property>
+                          </packing>
+                        </child>
+
+                        <child>
+                          <object class="GtkLabel" id="metered_data_label">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="hexpand">True</property>
+                            <property name="xalign">0.0</property>
+                            <property name="yalign">0.0</property>
+                            <property name="label">Test metered data label</property>
+                            <style>
+                              <class name="dim-label" />
+                            </style>
+                          </object>
+                          <packing>
+                            <property name="top-attach">1</property>
+                            <property name="left-attach">1</property>
+                          </packing>
+                        </child>
+
+                        <child>
+                          <object class="GtkLabel" id="network_settings_label">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0.0</property>
+                            <property name="label">Change Network Settings...</property>
+                          </object>
+                          <packing>
+                            <property name="top-attach">0</property>
+                            <property name="left-attach">2</property>
+                            <property name="height">2</property>
+                          </packing>
+                        </child>
+
+                      </object>
+                    </child>
+                  </object>
+                </child>
+
+                <!-- Automatic Updates section -->
+                <child>
+                  <object class="GtkFrame">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <style>
+                      <class name="view" />
+                    </style>
+
+                    <child>
+                      <object class="GtkGrid">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="column-spacing">12</property>
+                        <property name="margin">18</property>
+
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="hexpand">True</property>
+                            <property name="xalign">0.0</property>
+                            <property name="label" translatable="yes">Automatic Updates</property>
+                            <attributes>
+                              <attribute name="scale" value="1.2" />
+                              <attribute name="weight" value="bold" />
+                            </attributes>
+                          </object>
+                        </child>
+
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="hexpand">True</property>
+                            <property name="xalign">0.0</property>
+                            <property name="label">Allow system and application updates to happen 
automatically without your request in background.</property>
+                            <property name="wrap">True</property>
+                            <style>
+                              <class name="dim-label" />
+                            </style>
+                          </object>
+                          <packing>
+                            <property name="top-attach">1</property>
+                            <property name="left-attach">0</property>
+                          </packing>
+                        </child>
+
+                        <child>
+                          <object class="GtkSwitch" id="automatic_updates_switch">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="valign">start</property>
+                          </object>
+                          <packing>
+                            <property name="top-attach">0</property>
+                            <property name="left-attach">1</property>
+                            <property name="height">2</property>
+                          </packing>
+                        </child>
+
+                      </object>
+                    </child>
+                  </object>
+                </child>
+
+                <!-- Schedule Updates section -->
+                <child>
+                  <object class="GtkFrame">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <style>
+                      <class name="view" />
+                    </style>
+
+                    <child>
+                      <object class="GtkGrid">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="column-spacing">12</property>
+                        <property name="margin">18</property>
+
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="hexpand">True</property>
+                            <property name="xalign">0.0</property>
+                            <property name="label" translatable="yes">Scheduled Updates</property>
+                            <attributes>
+                              <attribute name="scale" value="1.2" />
+                              <attribute name="weight" value="bold" />
+                            </attributes>
+                          </object>
+                        </child>
+
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="hexpand">True</property>
+                            <property name="xalign">0.0</property>
+                            <property name="label">Create a daily window for updates to happen 
automatically.</property>
+                            <property name="wrap">True</property>
+                            <style>
+                              <class name="dim-label" />
+                            </style>
+                          </object>
+                          <packing>
+                            <property name="top-attach">1</property>
+                            <property name="left-attach">0</property>
+                          </packing>
+                        </child>
+
+                        <child>
+                          <object class="GtkSwitch" id="scheduled_updates_switch">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="valign">start</property>
+                          </object>
+                          <packing>
+                            <property name="top-attach">0</property>
+                            <property name="left-attach">1</property>
+                            <property name="height">2</property>
+                          </packing>
+                        </child>
+
+                        <!-- Period widgets -->
+                        <child>
+                          <object class="GtkRevealer">
+                            <property name="visible">True</property>
+                            <property name="can-focus">False</property>
+                            <property name="transition-type">slide-down</property>
+                            <property name="reveal-child" bind-source="scheduled_updates_switch" 
bind-property="active" bind-flags="default" />
+
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">True</property>
+                                <property name="can-focus">False</property>
+                                <property name="spacing">18</property>
+                                <property name="margin-top">18</property>
+                                <property name="orientation">vertical</property>
+
+                                <child>
+                                  <object class="GtkSeparator">
+                                    <property name="visible">True</property>
+                                    <property name="can-focus">False</property>
+                                    <property name="hexpand">True</property>
+                                  </object>
+                                </child>
+
+                                <child>
+                                  <object class="CcTimeScheduler" id="time_scheduler">
+                                    <property name="visible">True</property>
+                                    <property name="can-focus">False</property>
+                                  </object>
+                                </child>
+
+                              </object>
+                            </child>
+
+                          </object>
+                          <packing>
+                            <property name="top-attach">2</property>
+                            <property name="left-attach">0</property>
+                            <property name="width">2</property>
+                          </packing>
+                        </child>
+
+                      </object>
+                    </child>
+                  </object>
+                </child>
+
+              </object>
+            </child>
+
+            <!--
+              Stub boxes to pull the widgets to the middle, and yet allow them to
+              grow and cover a third of the available space
+            -->
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="hexpand">True</property>
+              </object>
+            </child>
+
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
\ No newline at end of file
diff --git a/panels/updates/gnome-updates-panel.desktop.in.in 
b/panels/updates/gnome-updates-panel.desktop.in.in
new file mode 100644
index 0000000..9bdbe9b
--- /dev/null
+++ b/panels/updates/gnome-updates-panel.desktop.in.in
@@ -0,0 +1,17 @@
+[Desktop Entry]
+_Name=Automatic Updates
+_Comment=Schedule automatic updates
+Exec=gnome-control-center updates
+Icon=software-update-available
+Terminal=false
+Type=Application
+NoDisplay=true
+StartupNotify=true
+Categories=GNOME;GTK;Settings;HardwareSettings;X-GNOME-Settings-Panel;
+OnlyShowIn=GNOME;Unity;
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-control-center
+X-GNOME-Bugzilla-Component=wacom
+X-GNOME-Bugzilla-Version=@VERSION@
+# Translators: those are keywords for the automatic updates control-center panel
+_Keywords=Updates;Automatic;
diff --git a/panels/updates/updates.gresource.xml b/panels/updates/updates.gresource.xml
new file mode 100644
index 0000000..2513731
--- /dev/null
+++ b/panels/updates/updates.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/control-center/updates">
+    <file preprocess="xml-stripblanks">cc-time-scheduler.ui</file>
+    <file preprocess="xml-stripblanks">cc-updates-panel.ui</file>
+  </gresource>
+</gresources>
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 8099330..c463085 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -95,6 +95,7 @@ gnome_control_center_LDADD =                                          \
        $(top_builddir)/panels/sharing/libsharing.la                    \
        $(top_builddir)/panels/sound/libsound.la                        \
        $(top_builddir)/panels/universal-access/libuniversal-access.la  \
+       $(top_builddir)/panels/updates/libupdates.la                    \
        $(top_builddir)/panels/user-accounts/libuser-accounts.la        \
        $(top_builddir)/panels/printers/libprinters.la
 
diff --git a/shell/cc-panel-list.c b/shell/cc-panel-list.c
index db3382f..3aade42 100644
--- a/shell/cc-panel-list.c
+++ b/shell/cc-panel-list.c
@@ -287,6 +287,7 @@ static const gchar * const panel_order[] = {
   "sound",
   "power",
   "network",
+  "updates",
 
   /* Devices page */
   "printers",
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index 8be3bb9..1537a53 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -56,6 +56,7 @@ extern GType cc_search_panel_get_type (void);
 extern GType cc_sharing_panel_get_type (void);
 extern GType cc_sound_panel_get_type (void);
 extern GType cc_ua_panel_get_type (void);
+extern GType cc_updates_panel_get_type (void);
 extern GType cc_user_panel_get_type (void);
 #ifdef BUILD_WACOM
 extern GType cc_wacom_panel_get_type (void);
@@ -102,6 +103,7 @@ static struct {
   PANEL_TYPE("sharing",          cc_sharing_panel_get_type      ),
   PANEL_TYPE("sound",            cc_sound_panel_get_type        ),
   PANEL_TYPE("universal-access", cc_ua_panel_get_type           ),
+  PANEL_TYPE("updates",          cc_updates_panel_get_type      ),
   PANEL_TYPE("user-accounts",    cc_user_panel_get_type         ),
 #ifdef BUILD_WACOM
   PANEL_TYPE("wacom",            cc_wacom_panel_get_type        ),


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