[gnome-control-center/setup: 1/2] Start of a first-time-setup tool



commit 7352db74ba091fab781909fb6366bfd80016cbb0
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon May 9 10:58:45 2011 -0400

    Start of a first-time-setup tool
    
    This is essentially just a skeleton at this point.

 Makefile.am                                      |    4 +-
 configure.ac                                     |    4 +
 setup/Makefile.am                                |   31 ++++
 setup/gnome-setup-assistant.c                    |   78 +++++++++
 setup/gnome-setup-assistant.desktop              |   14 ++
 setup/org.gnome.control-center.setup.gschema.xml |    8 +
 setup/setup.ui                                   |  194 ++++++++++++++++++++++
 setup/welcome-image.jpg                          |  Bin 0 -> 55997 bytes
 8 files changed, 331 insertions(+), 2 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 56049e7..ca656f5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 
-SUBDIRS = po libgnome-control-center shell panels help
-DIST_SUBDIRS = po help shell panels libgnome-control-center
+SUBDIRS = po libgnome-control-center shell panels setup help
+DIST_SUBDIRS = po help shell panels setup libgnome-control-center
 
 DISTCLEANFILES = \
 	gnome-doc-utils.make
diff --git a/configure.ac b/configure.ac
index 23ee455..472d419 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,6 +91,7 @@ PKG_CHECK_MODULES(LIBGNOME_CONTROL_CENTER, $COMMON_MODULES gconf-2.0)
 PKG_CHECK_MODULES(LIBLANGUAGE, $COMMON_MODULES gnome-desktop-3.0)
 PKG_CHECK_MODULES(LIBSHORTCUTS, $COMMON_MODULES x11)
 PKG_CHECK_MODULES(SHELL, $COMMON_MODULES libgnome-menu gio-unix-2.0)
+PKG_CHECK_MODULES(SETUP, $COMMON_MODULES)
 PKG_CHECK_MODULES(BACKGROUND_PANEL, $COMMON_MODULES libxml-2.0 gnome-desktop-3.0
                   gdk-pixbuf-2.0 >= $GDKPIXBUF_REQUIRED_VERSION)
 PKG_CHECK_MODULES(DATETIME_PANEL, $COMMON_MODULES dbus-glib-1
@@ -200,6 +201,8 @@ fi
 
 AC_SUBST(GLIB_GENMARSHAL)
 
+GLIB_GSETTINGS
+
 dnl =======================================
 dnl Panels
 dnl =======================================
@@ -370,6 +373,7 @@ panels/user-accounts/data/icons/Makefile
 po/Makefile.in
 shell/Makefile
 shell/gnome-control-center.desktop.in
+setup/Makefile
 ])
 
 dnl due to a bug in intltool we need to expand something from the root last control-center.spec
diff --git a/setup/Makefile.am b/setup/Makefile.am
new file mode 100644
index 0000000..f76cbe1
--- /dev/null
+++ b/setup/Makefile.am
@@ -0,0 +1,31 @@
+INCLUDES = $(SETUP_CFLAGS)
+
+LIBS = $(SETUP_LIBS)
+
+bin_PROGRAMS = gnome-setup-assistant
+
+gnome_setup_assistant_sources =	\
+	gnome-setup-assistant.c
+
+AM_CPPFLAGS = \
+	-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
+	-DUIDIR="\"$(uidir)\""
+
+gsettings_SCHEMAS = org.gnome.control-center.setup.gschema.xml
+
+ GSETTINGS_RULES@
+
+uidir = $(pkgdatadir)/ui/setup
+ui_DATA = \
+	setup.ui
+	welcome-image.jpg
+
+sysdir = $(datadir)/applications
+sys_DATA = gnome-setup-assistant.desktop
+
+EXTRA_DIST = \
+	$(ui_DATA) \
+	$(sys_DATA) \
+	org.gnome.control-center.setup.gschema.xml
+
+-include $(top_srcdir)/git.mk
diff --git a/setup/gnome-setup-assistant.c b/setup/gnome-setup-assistant.c
new file mode 100644
index 0000000..3318638
--- /dev/null
+++ b/setup/gnome-setup-assistant.c
@@ -0,0 +1,78 @@
+#include <stdlib.h>
+#include <gtk/gtk.h>
+
+static void
+prepare_cb (GtkAssistant *assi, gpointer data)
+{
+        GtkWidget *page;
+        gint n;
+
+        n = gtk_assistant_get_current_page (assi);
+        page = gtk_assistant_get_nth_page (assi, n);
+
+        gtk_assistant_set_page_complete (assi, page, TRUE);
+}
+
+static void
+disable_autostart (void)
+{
+        GSettings *settings;
+
+        settings = g_settings_new ("org.gnome.control-center.setup");
+        g_settings_set_boolean (settings, "need-setup", FALSE);
+}
+
+static void
+close_cb (GtkAssistant *assi, gpointer data)
+{
+        disable_autostart ();
+
+        gtk_main_quit ();
+}
+
+int
+main (int argc, char *argv[])
+{
+        GtkBuilder *builder;
+        GtkAssistant *assi;
+        GtkWidget *widget;
+        GError *error;
+        const gchar *filename;
+
+        gtk_init (&argc, &argv);
+
+        filename = UIDIR "/setup.ui";
+        if (!g_file_test (filename, G_FILE_TEST_EXISTS))
+                filename = "setup.ui";
+
+        builder = gtk_builder_new ();
+        error = NULL;
+        if (!gtk_builder_add_from_file (builder, filename, &error)) {
+                g_error ("%s", error->message);
+                g_error_free (error);
+                exit (1);
+        }
+
+        assi = (GtkAssistant *) gtk_builder_get_object (builder, "gnome-setup-assistant");
+
+        gtk_assistant_commit (assi);
+
+        g_signal_connect (G_OBJECT (assi), "prepare",
+                          G_CALLBACK (prepare_cb), NULL);
+        g_signal_connect (G_OBJECT (assi), "close",
+                          G_CALLBACK (close_cb), NULL);
+
+        widget = (GtkWidget *) gtk_builder_get_object (builder, "welcome-image");
+        filename = UIDIR "/welcome-image.jpg";
+        if (!g_file_test (filename, G_FILE_TEST_EXISTS))
+                filename = "welcome-image.jpg";
+        gtk_image_set_from_file (GTK_IMAGE (widget), filename);
+
+        gtk_window_present (GTK_WINDOW (assi));
+
+        gtk_main ();
+
+        g_settings_sync ();
+
+        return 0;
+}
diff --git a/setup/gnome-setup-assistant.desktop b/setup/gnome-setup-assistant.desktop
new file mode 100644
index 0000000..bb0cfe9
--- /dev/null
+++ b/setup/gnome-setup-assistant.desktop
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Name=System Setup
+Icon=preferences-system
+Exec=gnome-system-setup
+Terminal=false
+Type=Application
+StartupNotify=true
+Categories=GNOME;GTK;System;
+OnlyShowIn=GNOME;
+AutostartCondition=GSETTINGS org.gnome.control-center.setup need-setup
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-control-center
+X-GNOME-Bugzilla-Component=setup
+X-GNOME-Bugzilla-Version=unknown
diff --git a/setup/org.gnome.control-center.setup.gschema.xml b/setup/org.gnome.control-center.setup.gschema.xml
new file mode 100644
index 0000000..487ae2b
--- /dev/null
+++ b/setup/org.gnome.control-center.setup.gschema.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist>
+  <schema id='org.gnome.control-center.setup' path="/org/gnome/control-center/setup/">
+    <key name='need-setup' type='b'>
+      <default>true</default>
+    </key>
+  </schema>
+</schemalist>
diff --git a/setup/setup.ui b/setup/setup.ui
new file mode 100644
index 0000000..2eca0d9
--- /dev/null
+++ b/setup/setup.ui
@@ -0,0 +1,194 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="3.0"/>
+  <object class="GtkAssistant" id="gnome-setup-assistant">
+    <!-- interface-naming-policy toplevel-contextual -->
+    <property name="border-width">12</property>
+    <property name="title"></property>
+    <property name="icon_name">preferences-system</property>
+    <property name="visible">False</property>
+    <property name="deletable">False</property>
+    <child>
+      <object class="GtkBox" id="welcome-page">
+        <property name="visible">True</property>
+        <property name="border_width">12</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkLabel" id="welcome-title">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Welcome to GNOME</property>
+            <property name="halign">start</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+              <attribute name="scale" value="1.2"/>
+            </attributes>
+          </object>
+        </child>
+        <child>
+          <object class="GtkImage" id="welcome-image">
+            <property name="visible">True</property>
+            <property name="file">welcome-image.jpg</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="welcome-subtitle">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Now let's set up some essentials for your account.</property>
+            <property name="halign">start</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="title" translatable="yes">Introduction</property>
+        <property name="page-type">intro</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkBox" id="network-page">
+        <property name="visible">True</property>
+        <property name="border_width">12</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkLabel" id="network-title">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Connect to the Network</property>
+            <property name="halign">start</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+              <attribute name="scale" value="1.2"/>
+            </attributes>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="network-subtitle">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Select a wireless network</property>
+            <property name="halign">start</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="title" translatable="yes">Network</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkBox" id="account-page">
+        <property name="visible">True</property>
+        <property name="border_width">12</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkLabel" id="account-title">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Create an Account</property>
+            <property name="halign">start</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+              <attribute name="scale" value="1.2"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="title" translatable="yes">Account</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkBox" id="location-page">
+        <property name="visible">True</property>
+        <property name="border_width">12</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkLabel" id="location-title">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Select your Location</property>
+            <property name="halign">start</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+              <attribute name="scale" value="1.2"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="title" translatable="yes">Location</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkBox" id="online-page">
+        <property name="visible">True</property>
+        <property name="border_width">12</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkLabel" id="online-title">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Web Accounts</property>
+            <property name="halign">start</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+              <attribute name="scale" value="1.2"/>
+            </attributes>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="online-subtitle">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Associate your new account with your existing online accounts</property>
+            <property name="halign">start</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="title" translatable="yes">Web Accounts</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkBox" id="page6">
+        <property name="visible">True</property>
+        <property name="border_width">12</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkLabel" id="summary-title">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Enjoy GNOME !</property>
+            <property name="halign">start</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+              <attribute name="scale" value="1.2"/>
+            </attributes>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="summary-details">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Your new account is ready to use. You may change any of these options at any time in the System Settings.</property>
+            <property name="wrap">True</property>
+            <property name="halign">start</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+              <attribute name="scale" value="1.2"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="title" translatable="yes">Summary</property>
+        <property name="page-type">summary</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/setup/welcome-image.jpg b/setup/welcome-image.jpg
new file mode 100644
index 0000000..35ff65a
Binary files /dev/null and b/setup/welcome-image.jpg differ



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