[gnome-initial-setup] gnome-initial-setup: Add a "finals" system
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] gnome-initial-setup: Add a "finals" system
- Date: Tue, 3 Jul 2012 03:20:16 +0000 (UTC)
commit 99ec992c81f19cdaf285a9cf7aad53805fa1957e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Jun 27 15:45:33 2012 -0400
gnome-initial-setup: Add a "finals" system
A way to run a piece of code on the summary view.
gnome-initial-setup/gnome-initial-setup.c | 36 ++++++++++++++++++++++++++++-
gnome-initial-setup/gnome-initial-setup.h | 1 +
2 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 9af7fc5..2966fb8 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -41,6 +41,14 @@ struct _SetupData {
GisAssistant *assistant;
ActUser *act_user;
+ GSList *finals;
+};
+
+typedef struct _AsyncClosure AsyncClosure;
+
+struct _AsyncClosure {
+ GFunc callback;
+ gpointer user_data;
};
#include "gis-account-page.c"
@@ -65,6 +73,17 @@ copy_account_data (SetupData *setup)
}
static void
+run_finals (SetupData *setup)
+{
+ GSList *l;
+
+ for (l = setup->finals; l != NULL; l = l->next) {
+ AsyncClosure *closure = l->data;
+ closure->callback (setup, closure->user_data);
+ }
+}
+
+static void
prepare_cb (GisAssistant *assi, GtkWidget *page, SetupData *setup)
{
gchar *page_title;
@@ -74,8 +93,10 @@ prepare_cb (GisAssistant *assi, GtkWidget *page, SetupData *setup)
page_title = g_object_get_data (G_OBJECT (page), "gis-page-title");
gtk_window_set_title (setup->main_window, page_title);
- if (g_object_get_data (G_OBJECT (page), "gis-summary"))
+ if (g_object_get_data (G_OBJECT (page), "gis-summary")) {
copy_account_data (setup);
+ run_finals (setup);
+ }
}
static void
@@ -129,6 +150,19 @@ gis_get_act_user (SetupData *setup)
return setup->act_user;
}
+void
+gis_add_summary_callback (SetupData *setup,
+ GFunc callback,
+ gpointer user_data)
+{
+ AsyncClosure *closure = g_slice_new (AsyncClosure);
+
+ closure->callback = callback;
+ closure->user_data = user_data;
+
+ setup->finals = g_slist_append (setup->finals, closure);
+}
+
/* main {{{1 */
int
diff --git a/gnome-initial-setup/gnome-initial-setup.h b/gnome-initial-setup/gnome-initial-setup.h
index c3b7a58..133b346 100644
--- a/gnome-initial-setup/gnome-initial-setup.h
+++ b/gnome-initial-setup/gnome-initial-setup.h
@@ -18,6 +18,7 @@ GtkWindow *gis_get_main_window (SetupData *setup);
GKeyFile *gis_get_overrides (SetupData *setup);
GisAssistant * gis_get_assistant (SetupData *setup);
ActUser * gis_get_act_user (SetupData *setup);
+void gis_add_summary_callback (SetupData *setup, GFunc callback, gpointer user_data);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]