[gnome-initial-setup] Introduce a new toplevel API, GisDriver
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] Introduce a new toplevel API, GisDriver
- Date: Thu, 8 Nov 2012 20:08:54 +0000 (UTC)
commit fd2cb84b342d1c92f2adb405f5d70efa4484ae8e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Nov 7 20:27:52 2012 -0500
Introduce a new toplevel API, GisDriver
GisDriver is a GtkApplication designed to replace SetupData, by
being a real object rather than just a struct full of random junk.
gnome-initial-setup/Makefile.am | 1 +
gnome-initial-setup/gis-driver.c | 220 ++++++++++++++++++++
gnome-initial-setup/gis-driver.h | 74 +++++++
gnome-initial-setup/gnome-initial-setup.c | 170 ++--------------
gnome-initial-setup/gnome-initial-setup.h | 27 +--
.../pages/account/gis-account-page.c | 13 +-
.../pages/account/gis-account-page.h | 2 +-
gnome-initial-setup/pages/eulas/gis-eula-pages.c | 17 +-
gnome-initial-setup/pages/eulas/gis-eula-pages.h | 2 +-
gnome-initial-setup/pages/goa/gis-goa-page.c | 14 +-
gnome-initial-setup/pages/goa/gis-goa-page.h | 2 +-
.../pages/language/gis-language-page.c | 12 +-
.../pages/language/gis-language-page.h | 2 +-
.../pages/location/gis-location-page.c | 8 +-
.../pages/location/gis-location-page.h | 2 +-
.../pages/network/gis-network-page.c | 10 +-
.../pages/network/gis-network-page.h | 2 +-
.../pages/summary/gis-summary-page.c | 14 +-
.../pages/summary/gis-summary-page.h | 2 +-
19 files changed, 369 insertions(+), 225 deletions(-)
---
diff --git a/gnome-initial-setup/Makefile.am b/gnome-initial-setup/Makefile.am
index 75696b1..a1a7d73 100644
--- a/gnome-initial-setup/Makefile.am
+++ b/gnome-initial-setup/Makefile.am
@@ -31,6 +31,7 @@ gnome_initial_setup_SOURCES = \
gis-assistant.c gis-assistant.h gis-assistant-private.h \
gis-assistant-gtk.c gis-assistant-gtk.h \
gis-page.c gis-page.h \
+ gis-driver.c gis-driver.h \
$(BUILT_SOURCES)
if HAVE_CLUTTER
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
new file mode 100644
index 0000000..603b45c
--- /dev/null
+++ b/gnome-initial-setup/gis-driver.c
@@ -0,0 +1,220 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2012 Red Hat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Written by:
+ * Jasper St. Pierre <jstpierre mecheye net>
+ */
+
+#include "config.h"
+
+#include "gnome-initial-setup.h"
+
+#include <stdlib.h>
+
+#include "gis-assistant-gtk.h"
+
+#ifdef HAVE_CLUTTER
+#include <clutter-gtk/clutter-gtk.h>
+#include "gis-assistant-clutter.h"
+#endif
+
+#ifdef HAVE_CLUTTER
+#include "gis-assistant-clutter.h"
+#endif
+
+G_DEFINE_TYPE(GisDriver, gis_driver, GTK_TYPE_APPLICATION)
+
+#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GIS_TYPE_DRIVER, GisDriverPrivate))
+
+enum {
+ REBUILD_PAGES,
+ LAST_SIGNAL,
+};
+
+static guint signals[LAST_SIGNAL];
+
+struct _GisDriverPrivate {
+ GtkWindow *main_window;
+ GisAssistant *assistant;
+
+ ActUser *user_account;
+ const gchar *user_password;
+};
+
+static void
+title_changed_cb (GisAssistant *assistant,
+ GParamSpec *gparam,
+ GisDriver *driver)
+{
+ GisDriverPrivate *priv = driver->priv;
+ gtk_window_set_title (priv->main_window, gis_assistant_get_title (assistant));
+}
+
+static void
+recenter_window (GdkScreen *screen, GisDriver *driver)
+{
+ GisDriverPrivate *priv = driver->priv;
+ gtk_window_set_position (priv->main_window, GTK_WIN_POS_CENTER_ALWAYS);
+}
+
+static void
+prepare_main_window (GisDriver *driver)
+{
+ GisDriverPrivate *priv = driver->priv;
+
+ g_signal_connect (gtk_widget_get_screen (GTK_WIDGET (priv->main_window)),
+ "monitors-changed", G_CALLBACK (recenter_window), driver);
+
+ g_signal_connect (priv->assistant, "notify::title",
+ G_CALLBACK (title_changed_cb), driver);
+}
+
+static gboolean
+rebuild_pages (GisDriver *driver)
+{
+ g_signal_emit (G_OBJECT (driver), signals[REBUILD_PAGES], 0);
+ return FALSE;
+}
+
+GisAssistant *
+gis_driver_get_assistant (GisDriver *driver)
+{
+ GisDriverPrivate *priv = driver->priv;
+ return priv->assistant;
+}
+
+void
+gis_driver_set_user_permissions (GisDriver *driver,
+ ActUser *user,
+ const gchar *password)
+{
+ GisDriverPrivate *priv = driver->priv;
+ priv->user_account = user;
+ priv->user_password = password;
+}
+
+void
+gis_driver_get_user_permissions (GisDriver *driver,
+ ActUser **user,
+ const gchar **password)
+{
+ GisDriverPrivate *priv = driver->priv;
+ *user = priv->user_account;
+ *password = priv->user_password;
+}
+
+void
+gis_driver_locale_changed (GisDriver *driver)
+{
+ g_idle_add ((GSourceFunc) rebuild_pages, driver);
+}
+
+static GType
+get_assistant_type (void)
+{
+#ifdef HAVE_CLUTTER
+ gboolean enable_animations;
+ g_object_get (gtk_settings_get_default (),
+ "gtk-enable-animations", &enable_animations,
+ NULL);
+
+ if (enable_animations && g_getenv ("GIS_DISABLE_CLUTTER") == NULL)
+ return GIS_TYPE_ASSISTANT_CLUTTER;
+#endif /* HAVE_CLUTTER */
+
+ return GIS_TYPE_ASSISTANT_GTK;
+}
+
+static void
+gis_driver_activate (GApplication *app)
+{
+ GisDriver *driver = GIS_DRIVER (app);
+ GisDriverPrivate *priv = driver->priv;
+
+ G_APPLICATION_CLASS (gis_driver_parent_class)->activate (app);
+
+ gtk_window_present (GTK_WINDOW (priv->main_window));
+}
+
+static void
+gis_driver_startup (GApplication *app)
+{
+ GisDriver *driver = GIS_DRIVER (app);
+ GisDriverPrivate *priv = driver->priv;
+
+ G_APPLICATION_CLASS (gis_driver_parent_class)->startup (app);
+
+ priv->main_window = g_object_new (GTK_TYPE_APPLICATION_WINDOW,
+ "application", app,
+ "type", GTK_WINDOW_TOPLEVEL,
+ "border-width", 12,
+ "icon-name", "preferences-system",
+ "deletable", FALSE,
+ "resizable", FALSE,
+ "window-position", GTK_WIN_POS_CENTER_ALWAYS,
+ NULL);
+
+ priv->assistant = g_object_new (get_assistant_type (), NULL);
+ gtk_container_add (GTK_CONTAINER (priv->main_window), GTK_WIDGET (priv->assistant));
+
+ gtk_widget_show (GTK_WIDGET (priv->assistant));
+
+ prepare_main_window (driver);
+ rebuild_pages (driver);
+}
+
+static void
+gis_driver_real_rebuild_pages (GisDriver *driver)
+{
+ GisDriverPrivate *priv = driver->priv;
+ gis_assistant_destroy_all_pages (priv->assistant);
+}
+
+static void
+gis_driver_init (GisDriver *driver)
+{
+ driver->priv = GET_PRIVATE (driver);
+}
+
+static void
+gis_driver_class_init (GisDriverClass *klass)
+{
+ GApplicationClass *application_class = G_APPLICATION_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (GisDriverPrivate));
+
+ application_class->startup = gis_driver_startup;
+ application_class->activate = gis_driver_activate;
+
+ klass->rebuild_pages = gis_driver_real_rebuild_pages;
+ signals[REBUILD_PAGES] =
+ g_signal_new ("rebuild-pages",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GisDriverClass, rebuild_pages),
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 0);
+}
+
+GisDriver *
+gis_driver_new (void)
+{
+ return g_object_new (GIS_TYPE_DRIVER,
+ "application-id", "org.gnome.InitialSetup");
+}
diff --git a/gnome-initial-setup/gis-driver.h b/gnome-initial-setup/gis-driver.h
new file mode 100644
index 0000000..dbdde60
--- /dev/null
+++ b/gnome-initial-setup/gis-driver.h
@@ -0,0 +1,74 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2012 Red Hat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Written by:
+ * Jasper St. Pierre <jstpierre mecheye net>
+ */
+
+#ifndef __GIS_DRIVER_H__
+#define __GIS_DRIVER_H__
+
+#include "gis-assistant.h"
+#include "gis-page.h"
+#include <act/act-user-manager.h>
+
+G_BEGIN_DECLS
+
+#define GIS_TYPE_DRIVER (gis_driver_get_type ())
+#define GIS_DRIVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIS_TYPE_DRIVER, GisDriver))
+#define GIS_DRIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIS_TYPE_DRIVER, GisDriverClass))
+#define GIS_IS_DRIVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIS_TYPE_DRIVER))
+#define GIS_IS_DRIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIS_TYPE_DRIVER))
+#define GIS_DRIVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIS_TYPE_DRIVER, GisDriverClass))
+
+typedef struct _GisDriver GisDriver;
+typedef struct _GisDriverClass GisDriverClass;
+typedef struct _GisDriverPrivate GisDriverPrivate;
+
+struct _GisDriver
+{
+ GtkApplication parent;
+
+ GisDriverPrivate *priv;
+};
+
+struct _GisDriverClass
+{
+ GtkApplicationClass parent_class;
+
+ void (* rebuild_pages) (GisDriver *driver);
+};
+
+GType gis_driver_get_type (void);
+
+GisAssistant *gis_driver_get_assistant (GisDriver *driver);
+void gis_driver_locale_changed (GisDriver *driver);
+
+void gis_driver_set_user_permissions (GisDriver *driver,
+ ActUser *user,
+ const gchar *password);
+
+void gis_driver_get_user_permissions (GisDriver *driver,
+ ActUser **user,
+ const gchar **password);
+GisDriver *gis_driver_new (void);
+
+G_END_DECLS
+
+#endif /* __GIS_DRIVER_H__ */
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index cf3da26..0b63ddf 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -25,22 +25,14 @@
#include "gnome-initial-setup.h"
-#include <glib/gi18n.h>
-#include <gio/gio.h>
-
#include <stdlib.h>
-#include <gtk/gtk.h>
+#ifdef HAVE_CLUTTER
#include <clutter-gtk/clutter-gtk.h>
-
-#include "gis-assistant-gtk.h"
+#endif
#include <cheese-gtk.h>
-#ifdef HAVE_CLUTTER
-#include "gis-assistant-clutter.h"
-#endif
-
#include "pages/language/gis-language-page.h"
#include "pages/eulas/gis-eula-pages.h"
#include "pages/location/gis-location-page.h"
@@ -49,148 +41,24 @@
#include "pages/goa/gis-goa-page.h"
#include "pages/summary/gis-summary-page.h"
-/* Setup data {{{1 */
-struct _SetupData {
- GtkWindow *main_window;
- GisAssistant *assistant;
-
- ActUser *user_account;
- const gchar *user_password;
-};
-
-static void
-title_changed_cb (GisAssistant *assistant,
- GParamSpec *gparam,
- SetupData *setup)
-{
- gtk_window_set_title (setup->main_window, gis_assistant_get_title (assistant));
-}
-
-static void
-recenter_window (GdkScreen *screen, SetupData *setup)
-{
- gtk_window_set_position (setup->main_window, GTK_WIN_POS_CENTER_ALWAYS);
-}
-
-static void
-prepare_main_window (SetupData *setup)
-{
- g_signal_connect (gtk_widget_get_screen (GTK_WIDGET (setup->main_window)),
- "monitors-changed", G_CALLBACK (recenter_window), setup);
-
- g_signal_connect (setup->assistant, "notify::title",
- G_CALLBACK (title_changed_cb), setup);
-}
-
-static gboolean
-rebuild_pages (SetupData *setup)
-{
- gis_assistant_destroy_all_pages (setup->assistant);
-
- gis_prepare_language_page (setup);
- gis_prepare_eula_pages (setup);
- gis_prepare_network_page (setup);
- gis_prepare_account_page (setup);
- gis_prepare_location_page (setup);
- gis_prepare_goa_page (setup);
- gis_prepare_summary_page (setup);
-
- return FALSE;
-}
-
-GtkWindow *
-gis_get_main_window (SetupData *setup)
-{
- return setup->main_window;
-}
-
-GisAssistant *
-gis_get_assistant (SetupData *setup)
-{
- return setup->assistant;
-}
-
-void
-gis_set_user_permissions (SetupData *setup,
- ActUser *user,
- const gchar *password)
-{
- setup->user_account = user;
- setup->user_password = password;
-}
-
-void
-gis_get_user_permissions (SetupData *setup,
- ActUser **user,
- const gchar **password)
-{
- *user = setup->user_account;
- *password = setup->user_password;
-}
-
-void
-gis_locale_changed (SetupData *setup)
-{
- g_idle_add ((GSourceFunc) rebuild_pages, setup);
-}
-
-static GType
-get_assistant_type (void)
-{
-#ifdef HAVE_CLUTTER
- gboolean enable_animations;
- g_object_get (gtk_settings_get_default (),
- "gtk-enable-animations", &enable_animations,
- NULL);
-
- if (enable_animations && g_getenv ("GIS_DISABLE_CLUTTER") == NULL)
- return GIS_TYPE_ASSISTANT_CLUTTER;
-#endif /* HAVE_CLUTTER */
-
- return GIS_TYPE_ASSISTANT_GTK;
-}
-
/* main {{{1 */
static void
-activate_cb (GApplication *app,
- gpointer user_data)
+rebuild_pages_cb (GisDriver *driver)
{
- SetupData *setup = user_data;
-
- gtk_window_present (GTK_WINDOW (setup->main_window));
-}
-
-static void
-startup_cb (GApplication *app,
- gpointer user_data)
-{
- SetupData *setup = user_data;
-
- setup->main_window = g_object_new (GTK_TYPE_WINDOW,
- "type", GTK_WINDOW_TOPLEVEL,
- "border-width", 12,
- "icon-name", "preferences-system",
- "deletable", FALSE,
- "resizable", FALSE,
- "window-position", GTK_WIN_POS_CENTER_ALWAYS,
- NULL);
- gtk_application_add_window (GTK_APPLICATION (app), setup->main_window);
-
- setup->assistant = g_object_new (get_assistant_type (), NULL);
- gtk_container_add (GTK_CONTAINER (setup->main_window), GTK_WIDGET (setup->assistant));
-
- gtk_widget_show (GTK_WIDGET (setup->assistant));
-
- prepare_main_window (setup);
- rebuild_pages (setup);
+ gis_prepare_language_page (driver);
+ gis_prepare_eula_pages (driver);
+ gis_prepare_network_page (driver);
+ gis_prepare_account_page (driver);
+ gis_prepare_location_page (driver);
+ gis_prepare_goa_page (driver);
+ gis_prepare_summary_page (driver);
}
int
main (int argc, char *argv[])
{
- SetupData *setup;
- GtkApplication *application;
+ GisDriver *driver;
int status;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
@@ -199,8 +67,6 @@ main (int argc, char *argv[])
cheese_gtk_init (NULL, NULL);
- setup = g_new0 (SetupData, 1);
-
gtk_init (&argc, &argv);
#if HAVE_CLUTTER
@@ -210,16 +76,10 @@ main (int argc, char *argv[])
}
#endif
- application = gtk_application_new ("org.gnome.InitialSetup", G_APPLICATION_FLAGS_NONE);
- g_signal_connect (application, "startup",
- G_CALLBACK (startup_cb), setup);
- g_signal_connect (application, "activate",
- G_CALLBACK (activate_cb), setup);
-
- status = g_application_run (G_APPLICATION (application), argc, argv);
-
- g_object_unref (application);
-
+ driver = gis_driver_new ();
+ g_signal_connect (driver, "rebuild-pages", G_CALLBACK (rebuild_pages_cb), NULL);
+ status = g_application_run (G_APPLICATION (driver), argc, argv);
+ g_object_unref (driver);
return status;
}
diff --git a/gnome-initial-setup/gnome-initial-setup.h b/gnome-initial-setup/gnome-initial-setup.h
index 173a4a4..a153b0d 100644
--- a/gnome-initial-setup/gnome-initial-setup.h
+++ b/gnome-initial-setup/gnome-initial-setup.h
@@ -25,29 +25,16 @@
#define __GNOME_INITIAL_SETUP_H__
#include <gtk/gtk.h>
+#include <gio/gio.h>
+#include <glib/gi18n.h>
+typedef struct _GisDriver GisDriver;
+typedef struct _GisAssistant GisAssistant;
+typedef struct _GisPage GisPage;
+
+#include "gis-driver.h"
#include "gis-assistant.h"
#include "gis-page.h"
-#include <act/act-user-manager.h>
-
-G_BEGIN_DECLS
-
-typedef struct _SetupData SetupData;
-
-GtkWindow *gis_get_main_window (SetupData *setup);
-GisAssistant * gis_get_assistant (SetupData *setup);
-void gis_locale_changed (SetupData *setup);
-
-void gis_set_user_permissions (SetupData *setup,
- ActUser *user,
- const gchar *password);
-
-void gis_get_user_permissions (SetupData *setup,
- ActUser **user,
- const gchar **password);
-
-G_END_DECLS
-
#endif /* __GNOME_INITIAL_SETUP_H__ */
diff --git a/gnome-initial-setup/pages/account/gis-account-page.c b/gnome-initial-setup/pages/account/gis-account-page.c
index bf5a432..38d7612 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.c
+++ b/gnome-initial-setup/pages/account/gis-account-page.c
@@ -54,7 +54,7 @@ typedef enum {
} UmAccountMode;
struct _AccountData {
- SetupData *setup;
+ GisDriver *driver;
GtkWidget *widget;
GtkBuilder *builder;
@@ -190,7 +190,8 @@ page_validate (AccountData *data)
static void
update_account_page_status (AccountData *data)
{
- gis_assistant_set_page_complete (gis_get_assistant (data->setup), data->widget, page_validate (data));
+ gis_assistant_set_page_complete (gis_driver_get_assistant (data->driver),
+ data->widget, page_validate (data));
}
static void
@@ -528,7 +529,7 @@ local_create_user (AccountData *data)
act_user_set_password_mode (data->act_user, data->password_mode);
}
- gis_set_user_permissions (data->setup, data->act_user, password);
+ gis_driver_set_user_permissions (data->driver, data->act_user, password);
data->user_data_unsaved = FALSE;
}
@@ -941,7 +942,7 @@ next_page_cb (GisAssistant *assistant, GtkWidget *page, AccountData *data)
}
void
-gis_prepare_account_page (SetupData *setup)
+gis_prepare_account_page (GisDriver *driver)
{
GtkWidget *fullname_entry;
GtkWidget *username_combo;
@@ -951,9 +952,9 @@ gis_prepare_account_page (SetupData *setup)
GtkWidget *confirm_entry;
GtkWidget *local_account_avatar_button;
AccountData *data = g_slice_new0 (AccountData);
- GisAssistant *assistant = gis_get_assistant (setup);
+ GisAssistant *assistant = gis_driver_get_assistant (driver);
+ data->driver = driver;
data->builder = gis_builder (PAGE_ID);
- data->setup = setup;
data->widget = WID("account-page");
gtk_widget_show (data->widget);
diff --git a/gnome-initial-setup/pages/account/gis-account-page.h b/gnome-initial-setup/pages/account/gis-account-page.h
index e895b9e..8091e16 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.h
+++ b/gnome-initial-setup/pages/account/gis-account-page.h
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
-void gis_prepare_account_page (SetupData *setup);
+void gis_prepare_account_page (GisDriver *driver);
G_END_DECLS
diff --git a/gnome-initial-setup/pages/eulas/gis-eula-pages.c b/gnome-initial-setup/pages/eulas/gis-eula-pages.c
index ac8fd1f..c807e70 100644
--- a/gnome-initial-setup/pages/eulas/gis-eula-pages.c
+++ b/gnome-initial-setup/pages/eulas/gis-eula-pages.c
@@ -35,7 +35,7 @@
typedef struct _EulaPage EulaPage;
struct _EulaPage {
- SetupData *setup;
+ GisDriver *driver;
GtkWidget *widget;
GtkWidget *text_view;
@@ -173,7 +173,7 @@ get_page_complete (EulaPage *page)
static void
sync_page_complete (EulaPage *page)
{
- gis_assistant_set_page_complete (gis_get_assistant (page->setup),
+ gis_assistant_set_page_complete (gis_driver_get_assistant (page->driver),
page->widget, get_page_complete (page));
}
@@ -205,13 +205,14 @@ get_config (GFile *eula,
}
static void
-build_eula_page (SetupData *setup,
+build_eula_page (GisDriver *driver,
GFile *eula)
{
GtkWidget *text_view;
GtkWidget *vbox;
GtkWidget *scrolled_window;
EulaPage *page;
+ GisAssistant *assistant = gis_driver_get_assistant (driver);
gboolean require_checkbox = TRUE;
gboolean require_scroll = FALSE;
@@ -231,7 +232,7 @@ build_eula_page (SetupData *setup,
gtk_container_add (GTK_CONTAINER (vbox), scrolled_window);
page = g_slice_new0 (EulaPage);
- page->setup = setup;
+ page->driver = driver;
page->widget = vbox;
page->text_view = text_view;
page->scrolled_window = scrolled_window;
@@ -269,8 +270,8 @@ build_eula_page (SetupData *setup,
page);
}
- gis_assistant_add_page (gis_get_assistant (setup), vbox);
- gis_assistant_set_page_title (gis_get_assistant (setup), vbox, _("License Agreements"));
+ gis_assistant_add_page (assistant, vbox);
+ gis_assistant_set_page_title (assistant, vbox, _("License Agreements"));
sync_page_complete (page);
@@ -278,7 +279,7 @@ build_eula_page (SetupData *setup,
}
void
-gis_prepare_eula_pages (SetupData *setup)
+gis_prepare_eula_pages (GisDriver *driver)
{
gchar *eulas_dir_path;
GFile *eulas_dir;
@@ -304,7 +305,7 @@ gis_prepare_eula_pages (SetupData *setup)
while ((info = g_file_enumerator_next_file (enumerator, NULL, &error)) != NULL) {
GFile *eula = g_file_get_child (eulas_dir, g_file_info_get_name (info));
- build_eula_page (setup, eula);
+ build_eula_page (driver, eula);
g_object_unref (eula);
}
diff --git a/gnome-initial-setup/pages/eulas/gis-eula-pages.h b/gnome-initial-setup/pages/eulas/gis-eula-pages.h
index ab98055..0bbc5df 100644
--- a/gnome-initial-setup/pages/eulas/gis-eula-pages.h
+++ b/gnome-initial-setup/pages/eulas/gis-eula-pages.h
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
-void gis_prepare_eula_pages (SetupData *setup);
+void gis_prepare_eula_pages (GisDriver *driver);
G_END_DECLS
diff --git a/gnome-initial-setup/pages/goa/gis-goa-page.c b/gnome-initial-setup/pages/goa/gis-goa-page.c
index 052f924..df846e4 100644
--- a/gnome-initial-setup/pages/goa/gis-goa-page.c
+++ b/gnome-initial-setup/pages/goa/gis-goa-page.c
@@ -44,7 +44,7 @@
typedef struct _GoaData GoaData;
struct _GoaData {
- SetupData *setup;
+ GisDriver *driver;
GtkWidget *widget;
GtkBuilder *builder;
@@ -67,7 +67,7 @@ show_online_account_dialog (GtkButton *button,
providers = NULL;
- parent = GTK_WINDOW (gis_get_main_window (data->setup));
+ parent = GTK_WINDOW (gtk_widget_get_toplevel (data->widget));
dialog = goa_panel_add_account_dialog_new (data->goa_client);
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
@@ -129,7 +129,7 @@ remove_account_cb (GoaAccount *account,
if (!goa_account_call_remove_finish (account, res, &error))
{
GtkWidget *dialog;
- dialog = gtk_message_dialog_new (GTK_WINDOW (gis_get_main_window (data->setup)),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (data->widget)),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
@@ -155,7 +155,7 @@ confirm_remove_account (GtkButton *button, gpointer user_data)
object = g_object_get_data (G_OBJECT (button), "goa-object");
- dialog = gtk_message_dialog_new (GTK_WINDOW (gis_get_main_window (data->setup)),
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (data->widget)),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_CANCEL,
@@ -295,13 +295,13 @@ goa_account_removed (GoaClient *client, GoaObject *object, gpointer user_data)
}
void
-gis_prepare_goa_page (SetupData *setup)
+gis_prepare_goa_page (GisDriver *driver)
{
GtkWidget *button;
GError *error = NULL;
GoaData *data = g_slice_new0 (GoaData);
- GisAssistant *assistant = gis_get_assistant (setup);
- data->setup = setup;
+ GisAssistant *assistant = gis_driver_get_assistant (driver);
+ data->driver = driver;
data->builder = gis_builder (PAGE_ID);
data->widget = WID ("goa-page");
data->goa_client = goa_client_new_sync (NULL, &error);
diff --git a/gnome-initial-setup/pages/goa/gis-goa-page.h b/gnome-initial-setup/pages/goa/gis-goa-page.h
index e288441..92bbce1 100644
--- a/gnome-initial-setup/pages/goa/gis-goa-page.h
+++ b/gnome-initial-setup/pages/goa/gis-goa-page.h
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
-void gis_prepare_goa_page (SetupData *setup);
+void gis_prepare_goa_page (GisDriver *driver);
G_END_DECLS
diff --git a/gnome-initial-setup/pages/language/gis-language-page.c b/gnome-initial-setup/pages/language/gis-language-page.c
index c68fb41..2bd6bb8 100644
--- a/gnome-initial-setup/pages/language/gis-language-page.c
+++ b/gnome-initial-setup/pages/language/gis-language-page.c
@@ -43,7 +43,7 @@
typedef struct _LanguageData LanguageData;
struct _LanguageData {
- SetupData *setup;
+ GisDriver *driver;
GtkWidget *widget;
GtkBuilder *builder;
@@ -67,7 +67,7 @@ set_locale_id (LanguageData *data,
gchar *old_locale_id = cc_common_language_get_current_language ();
if (g_strcmp0 (old_locale_id, new_locale_id) != 0) {
setlocale (LC_MESSAGES, new_locale_id);
- gis_locale_changed (data->setup);
+ gis_driver_locale_changed (data->driver);
}
g_free (old_locale_id);
}
@@ -255,16 +255,16 @@ selection_changed (GtkTreeSelection *selection,
}
void
-gis_prepare_language_page (SetupData *setup)
+gis_prepare_language_page (GisDriver *driver)
{
LanguageData *data;
- GisAssistant *assistant = gis_get_assistant (setup);
+ GisAssistant *assistant = gis_driver_get_assistant (driver);
GtkListStore *liststore;
GtkTreeModel *filter;
GtkTreeView *treeview;
data = g_slice_new0 (LanguageData);
- data->setup = setup;
+ data->driver = driver;
data->builder = gis_builder (PAGE_ID);
data->widget = WID ("language-page");
@@ -306,6 +306,6 @@ gis_prepare_language_page (SetupData *setup)
gis_assistant_set_use_unicode_buttons (assistant, data->widget, TRUE);
gis_assistant_set_page_complete (assistant, data->widget, TRUE);
- gis_assistant_set_page_title (gis_get_assistant (data->setup), data->widget, _("Welcome"));
+ gis_assistant_set_page_title (assistant, data->widget, _("Welcome"));
select_current_locale (treeview);
}
diff --git a/gnome-initial-setup/pages/language/gis-language-page.h b/gnome-initial-setup/pages/language/gis-language-page.h
index 57eaa07..878655a 100644
--- a/gnome-initial-setup/pages/language/gis-language-page.h
+++ b/gnome-initial-setup/pages/language/gis-language-page.h
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
-void gis_prepare_language_page (SetupData *setup);
+void gis_prepare_language_page (GisDriver *driver);
G_END_DECLS
diff --git a/gnome-initial-setup/pages/location/gis-location-page.c b/gnome-initial-setup/pages/location/gis-location-page.c
index ab363ef..30bff22 100644
--- a/gnome-initial-setup/pages/location/gis-location-page.c
+++ b/gnome-initial-setup/pages/location/gis-location-page.c
@@ -51,7 +51,7 @@
typedef struct _LocationData LocationData;
struct _LocationData {
- SetupData *setup;
+ GisDriver *driver;
GtkWidget *widget;
GtkBuilder *builder;
@@ -260,9 +260,9 @@ determine_location (GtkWidget *widget,
#endif
void
-gis_prepare_location_page (SetupData *setup)
+gis_prepare_location_page (GisDriver *driver)
{
- GisAssistant *assistant = gis_get_assistant (setup);
+ GisAssistant *assistant = gis_driver_get_assistant (driver);
GtkWidget *frame, *map, *entry;
GWeatherLocation *world;
GError *error;
@@ -270,7 +270,7 @@ gis_prepare_location_page (SetupData *setup)
LocationData *data;
data = g_slice_new0 (LocationData);
- data->setup = setup;
+ data->driver = driver;
data->builder = gis_builder (PAGE_ID);
data->widget = WID ("location-page");
diff --git a/gnome-initial-setup/pages/location/gis-location-page.h b/gnome-initial-setup/pages/location/gis-location-page.h
index 9fd61c0..50a20be 100644
--- a/gnome-initial-setup/pages/location/gis-location-page.h
+++ b/gnome-initial-setup/pages/location/gis-location-page.h
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
-void gis_prepare_location_page (SetupData *setup);
+void gis_prepare_location_page (GisDriver *driver);
G_END_DECLS
diff --git a/gnome-initial-setup/pages/network/gis-network-page.c b/gnome-initial-setup/pages/network/gis-network-page.c
index 7714ca8..ec4c244 100644
--- a/gnome-initial-setup/pages/network/gis-network-page.c
+++ b/gnome-initial-setup/pages/network/gis-network-page.c
@@ -49,7 +49,7 @@ typedef struct _NetworkData NetworkData;
#define WID(name) OBJ(GtkWidget*,name)
struct _NetworkData {
- SetupData *setup;
+ GisDriver *driver;
GtkWidget *widget;
GtkBuilder *builder;
@@ -337,7 +337,7 @@ refresh_without_device (NetworkData *data)
if (nm_client_get_state (data->nm_client) == NM_STATE_CONNECTED_GLOBAL)
/* advance page */
- gis_assistant_next_page (gis_get_assistant (data->setup));
+ gis_assistant_next_page (gis_driver_get_assistant (data->driver));
if (data->nm_device != NULL)
gtk_label_set_text (GTK_LABEL (label), _("Network is not available."));
else
@@ -612,7 +612,7 @@ active_connections_changed (NMClient *client, GParamSpec *pspec, NetworkData *da
}
void
-gis_prepare_network_page (SetupData *setup)
+gis_prepare_network_page (GisDriver *driver)
{
GtkTreeViewColumn *col;
GtkCellRenderer *cell;
@@ -624,9 +624,9 @@ gis_prepare_network_page (SetupData *setup)
DBusGConnection *bus;
GError *error;
NetworkData *data = g_slice_new0 (NetworkData);
- GisAssistant *assistant = gis_get_assistant (setup);
+ GisAssistant *assistant = gis_driver_get_assistant (driver);
- data->setup = setup;
+ data->driver = driver;
data->builder = gis_builder (PAGE_ID);
data->widget = WID ("network-page");
diff --git a/gnome-initial-setup/pages/network/gis-network-page.h b/gnome-initial-setup/pages/network/gis-network-page.h
index 364855e..86975d1 100644
--- a/gnome-initial-setup/pages/network/gis-network-page.h
+++ b/gnome-initial-setup/pages/network/gis-network-page.h
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
-void gis_prepare_network_page (SetupData *setup);
+void gis_prepare_network_page (GisDriver *driver);
G_END_DECLS
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c b/gnome-initial-setup/pages/summary/gis-summary-page.c
index aa080ec..eb969c9 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.c
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c
@@ -46,7 +46,7 @@
typedef struct _SummaryData SummaryData;
struct _SummaryData {
- SetupData *setup;
+ GisDriver *driver;
GtkWidget *widget;
GtkBuilder *builder;
@@ -291,9 +291,9 @@ prepare_cb (GisAssistant *assistant, GtkWidget *page, SummaryData *data)
{
if (page == data->widget)
{
- gis_get_user_permissions (data->setup,
- &data->user_account,
- &data->user_password);
+ gis_driver_get_user_permissions (data->driver,
+ &data->user_account,
+ &data->user_password);
}
}
@@ -328,13 +328,13 @@ get_builder (void)
}
void
-gis_prepare_summary_page (SetupData *setup)
+gis_prepare_summary_page (GisDriver *driver)
{
- GisAssistant *assistant = gis_get_assistant (setup);
+ GisAssistant *assistant = gis_driver_get_assistant (driver);
SummaryData *data;
data = g_slice_new0 (SummaryData);
- data->setup = setup;
+ data->driver = driver;
data->builder = get_builder ();
data->widget = WID ("summary-page");
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.h b/gnome-initial-setup/pages/summary/gis-summary-page.h
index 3f111ab..754419b 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.h
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.h
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
-void gis_prepare_summary_page (SetupData *setup);
+void gis_prepare_summary_page (GisDriver *driver);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]