[gdm/wip/initial-setup2] initial-setup: A bunch of changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/wip/initial-setup2] initial-setup: A bunch of changes
- Date: Sat, 19 May 2012 22:42:24 +0000 (UTC)
commit 35b390b980d7834e07061a296dba29496af1176f
Author: Matthias Clasen <mclasen redhat com>
Date: Sat May 12 19:39:07 2012 -0400
initial-setup: A bunch of changes
- Remove the sidebar
- Add an initial rebranding mechanism
- Initial implementation of the tour
gui/initial-setup/Makefile.am | 5 +-
gui/initial-setup/gdm-initial-setup.c | 121 +++++++++++++++++++++++++++----
gui/initial-setup/setup.ui | 30 ++++----
gui/initial-setup/welcome-tour.desktop | 6 ++
4 files changed, 131 insertions(+), 31 deletions(-)
---
diff --git a/gui/initial-setup/Makefile.am b/gui/initial-setup/Makefile.am
index 33e0e01..4b39656 100644
--- a/gui/initial-setup/Makefile.am
+++ b/gui/initial-setup/Makefile.am
@@ -41,13 +41,16 @@ gdm_initial_setup_SOURCES = \
$(dbus_built_sources) \
setup_resources.c
+autostartdir = $(sysconfdir)/xdg/autostart
+autostart_DATA = welcome-tour.desktop
EXTRA_DIST = \
$(sys_DATA) \
timedated1-interface.xml \
setup.ui \
welcome-image.png \
- application.gresource.xml
+ application.gresource.xml \
+ welcome-tour.desktop
BUILT_SOURCES = $(dbus_built_sources) setup_resources.c
diff --git a/gui/initial-setup/gdm-initial-setup.c b/gui/initial-setup/gdm-initial-setup.c
index 5645cdd..3b40557 100644
--- a/gui/initial-setup/gdm-initial-setup.c
+++ b/gui/initial-setup/gdm-initial-setup.c
@@ -43,8 +43,8 @@
/* Setup data {{{1 */
typedef struct {
GtkBuilder *builder;
+ GKeyFile *overrides;
GtkAssistant *assistant;
-
GdmGreeterClient *greeter_client;
/* network data */
@@ -90,16 +90,32 @@ typedef struct {
static void
prepare_welcome_page (SetupData *setup)
{
- GtkWidget *widget;
- const gchar *filename;
+ gchar *s;
- widget = WID("welcome-image");
- filename = UIDIR "/welcome-image.png";
- if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
- gtk_image_set_from_file (GTK_IMAGE (widget), filename);
- }
-}
+ s = g_key_file_get_locale_string (setup->overrides,
+ "Welcome", "welcome-image",
+ NULL, NULL);
+
+ if (s && g_file_test (s, G_FILE_TEST_EXISTS))
+ gtk_image_set_from_file (GTK_IMAGE (WID ("welcome-image")), s);
+
+ g_free (s);
+ s = g_key_file_get_locale_string (setup->overrides,
+ "Welcome", "welcome-title",
+ NULL, NULL);
+ if (s)
+ gtk_label_set_text (GTK_LABEL (WID ("welcome-title")), s);
+ g_free (s);
+
+ s = g_key_file_get_locale_string (setup->overrides,
+ "Welcome", "welcome-subtitle",
+ NULL, NULL);
+ if (s)
+ gtk_label_set_text (GTK_LABEL (WID ("welcome-subtitle")), s);
+ g_free (s);
+}
+
/* Network page {{{1 */
enum {
@@ -696,7 +712,7 @@ prepare_network_page (SetupData *setup)
g_timeout_add (80, bump_pulse, setup);
cell = gtk_cell_renderer_text_new ();
- g_object_set (cell, "width-chars", 45, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ g_object_set (cell, "width", 400, "width-chars", 45, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (col), cell, TRUE);
gtk_cell_area_cell_set (gtk_cell_layout_get_area (GTK_CELL_LAYOUT (col)), cell, "align", TRUE, NULL);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (col), cell,
@@ -1330,6 +1346,7 @@ prepare_account_page (SetupData *setup)
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (col), cell, TRUE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (col), cell, "text", PANEL_ACCOUNT_COLUMN_TITLE);
+ g_object_set (cell, "width", 400, NULL);
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (col), cell, FALSE);
@@ -2070,7 +2087,14 @@ byebye_cb (GtkButton *button, SetupData *setup)
static void
tour_cb (GtkButton *button, SetupData *setup)
{
- /* TODO: arrange for tour to begin */
+ gchar *filename;
+
+ /* the tour is triggered by ~/.config/run-welcome-tour */
+ filename = g_build_filename (g_get_home_dir (), ".config", "run-welcome-tour", NULL);
+ g_file_set_contents (filename, "yes", -1, NULL);
+ copy_account_file (setup, ".config/run-welcome-tour");
+ g_free (filename);
+
begin_autologin (setup);
}
@@ -2078,11 +2102,56 @@ static void
prepare_summary_page (SetupData *setup)
{
GtkWidget *button;
-
- button = WID("byebye");
+ gchar *s;
+
+ s = g_key_file_get_locale_string (setup->overrides,
+ "Summary", "summary-title",
+ NULL, NULL);
+ if (s)
+ gtk_label_set_text (GTK_LABEL (WID ("summary-title")), s);
+ g_free (s);
+
+ s = g_key_file_get_locale_string (setup->overrides,
+ "Summary", "summary-details",
+ NULL, NULL);
+ if (s) {
+ g_print ("replacing summary details\n");
+ gtk_label_set_text (GTK_LABEL (WID ("summary-details")), s);
+ }
+ g_free (s);
+
+ s = g_key_file_get_locale_string (setup->overrides,
+ "Summary", "summary-details2",
+ NULL, NULL);
+ if (s)
+ gtk_label_set_text (GTK_LABEL (WID ("summary-details2")), s);
+ g_free (s);
+
+ s = g_key_file_get_locale_string (setup->overrides,
+ "Summary", "summary-start-button",
+ NULL, NULL);
+ if (s)
+ gtk_button_set_label (GTK_BUTTON (WID ("summary-start-button")), s);
+ g_free (s);
+
+ s = g_key_file_get_locale_string (setup->overrides,
+ "Summary", "summary-tour-details",
+ NULL, NULL);
+ if (s)
+ gtk_label_set_text (GTK_LABEL (WID ("summary-tour-details")), s);
+ g_free (s);
+
+ s = g_key_file_get_locale_string (setup->overrides,
+ "Summary", "summary-tour-button",
+ NULL, NULL);
+ if (s)
+ gtk_button_set_label (GTK_BUTTON (WID ("summary-tour-button")), s);
+ g_free (s);
+
+ button = WID("summary-start-button");
g_signal_connect (button, "clicked",
G_CALLBACK (byebye_cb), setup);
- button = WID("byebye-tour");
+ button = WID("summary-tour-button");
g_signal_connect (button, "clicked",
G_CALLBACK (tour_cb), setup);
}
@@ -2104,11 +2173,18 @@ prepare_cb (GtkAssistant *assi, GtkWidget *page, SetupData *setup)
static void
prepare_assistant (SetupData *setup)
{
+ GList *list;
+
setup->assistant = OBJ(GtkAssistant*, "gnome-setup-assistant");
/* small hack to get rid of cancel button */
gtk_assistant_commit (setup->assistant);
+ /* another small hack to hide the sidebar */
+ list = gtk_container_get_children (GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (setup->assistant))));
+ gtk_widget_hide (GTK_WIDGET (list->data));
+ g_list_free (list);
+
g_signal_connect (G_OBJECT (setup->assistant), "prepare",
G_CALLBACK (prepare_cb), setup);
@@ -2153,12 +2229,25 @@ main (int argc, char *argv[])
};
setup->builder = gtk_builder_new ();
- if (!gtk_builder_add_from_resource (setup->builder, "/ui/setup.ui", &error)) {
+ if (g_file_test ("setup.ui", G_FILE_TEST_EXISTS)) {
+ gtk_builder_add_from_file (setup->builder, "setup.ui", &error);
+ }
+ else if (!gtk_builder_add_from_resource (setup->builder, "/ui/setup.ui", &error)) {
g_error ("%s", error->message);
- g_error_free (error);
exit (1);
}
+ setup->overrides = g_key_file_new ();
+ if (!g_key_file_load_from_file (setup->overrides,
+ "overrides.ini",
+ 0, &error)) {
+ if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) {
+ g_error ("%s", error->message);
+ exit (1);
+ }
+ g_error_free (error);
+ }
+
prepare_assistant (setup);
gtk_window_present (GTK_WINDOW (setup->assistant));
diff --git a/gui/initial-setup/setup.ui b/gui/initial-setup/setup.ui
index 34cd0c3..661affd 100644
--- a/gui/initial-setup/setup.ui
+++ b/gui/initial-setup/setup.ui
@@ -337,6 +337,10 @@
<object class="GtkGrid" id="network-page">
<property name="name">network-page</property>
<property name="visible">True</property>
+ <property name="margin-left">48</property>
+ <property name="margin-right">48</property>
+ <property name="margin-bottom">48</property>
+ <property name="halign">center</property>
<child>
<object class="GtkLabel" id="network-title">
<property name="visible">True</property>
@@ -359,10 +363,6 @@
<child>
<object class="GtkScrolledWindow" id="network-scrolledwindow">
<property name="visible">True</property>
- <property name="halign">fill</property>
- <property name="valign">fill</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
<property name="margin-top">0</property>
<property name="margin-bottom">32</property>
<property name="hscrollbar-policy">never</property>
@@ -372,11 +372,10 @@
<object class="GtkTreeView" id="network-list">
<property name="visible">True</property>
<property name="can-focus">True</property>
- <property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="halign">fill</property>
<property name="valign">fill</property>
- <property name="model">liststore-wireless</property>
+ <property name="model">liststore-wireless</property>
<property name="headers-visible">False</property>
<property name="search-column">2</property>
<property name="enable-grid-lines">horizontal</property>
@@ -451,11 +450,11 @@
<object class="GtkGrid" id="account-page">
<property name="name">account-page</property>
<property name="visible">False</property>
+ <property name="halign">center</property>
<child>
<object class="GtkLabel" id="account-title">
<property name="visible">True</property>
<property name="label" translatable="yes">Choose How to Login</property>
- <property name="hexpand">True</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="margin-bottom">18</property>
@@ -476,7 +475,6 @@
<property name="visible">True</property>
<property name="halign">fill</property>
<property name="valign">fill</property>
- <property name="hexpand">True</property>
<property name="vexpand">False</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">never</property>
@@ -485,8 +483,6 @@
<object class="GtkTreeView" id="account-list">
<property name="visible">True</property>
<property name="can-focus">True</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
<property name="halign">fill</property>
<property name="valign">fill</property>
<property name="model">liststore-account</property>
@@ -520,11 +516,15 @@
<object class="GtkGrid" id="location-page">
<property name="name">location-page</property>
<property name="visible">True</property>
+ <property name="halign">center</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
<child>
<object class="GtkLabel" id="location-title">
<property name="visible">True</property>
<property name="label" translatable="yes">Choose your Location</property>
<property name="halign">center</property>
+ <property name="hexpand">False</property>
<property name="valign">start</property>
<property name="margin-bottom">18</property>
<attributes>
@@ -555,7 +555,7 @@
</packing>
</child>
<child>
- <object class="GtkAspectFrame" id="location-map-frame">
+ <object class="GtkFrame" id="location-map-frame">
<property name="visible">True</property>
<property name="halign">fill</property>
<property name="valign">fill</property>
@@ -643,6 +643,7 @@
<object class="GtkGrid" id="online-page">
<property name="name">online-page</property>
<property name="visible">True</property>
+ <property name="halign">center</property>
<child>
<object class="GtkLabel" id="online-title">
<property name="visible">True</property>
@@ -720,6 +721,7 @@
<object class="GtkGrid" id="summary-page">
<property name="name">summary-page</property>
<property name="visible">True</property>
+ <property name="halign">center</property>
<child>
<object class="GtkLabel" id="summary-title">
<property name="visible">True</property>
@@ -768,7 +770,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="byebye">
+ <object class="GtkButton" id="summary-start-button">
<property name="visible">True</property>
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Start using GNOME 3</property>
@@ -785,7 +787,7 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="tour-details">
+ <object class="GtkLabel" id="summary-tour-details">
<property name="visible">True</property>
<property name="label" translatable="yes">New to GNOME 3 and need help finding your way around ?</property>
<property name="halign">center</property>
@@ -799,7 +801,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="byebye-tour">
+ <object class="GtkButton" id="summary-tour-button">
<property name="visible">True</property>
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Take a tour</property>
diff --git a/gui/initial-setup/welcome-tour.desktop b/gui/initial-setup/welcome-tour.desktop
new file mode 100644
index 0000000..b531f96
--- /dev/null
+++ b/gui/initial-setup/welcome-tour.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Type=Application
+Name=Welcome
+Exec=sh -c 'rm -f $HOME/.config/run-welcome-tour; epiphany http://www.gnome3.org'
+AutostartCondition=if-exists run-welcome-tour
+OnlyShowIn=GNOME;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]