[gnome-initial-setup] gis-assistant: Clean up if a page gets destroyed
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] gis-assistant: Clean up if a page gets destroyed
- Date: Tue, 21 Aug 2012 19:37:21 +0000 (UTC)
commit a5ec05d103ab227c5fbe7fafb6cb23013c8a413f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Aug 21 15:05:33 2012 -0400
gis-assistant: Clean up if a page gets destroyed
gnome-initial-setup/gis-assistant.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/gnome-initial-setup/gis-assistant.c b/gnome-initial-setup/gis-assistant.c
index d3adb8e..4c2a27c 100644
--- a/gnome-initial-setup/gis-assistant.c
+++ b/gnome-initial-setup/gis-assistant.c
@@ -84,14 +84,31 @@ get_page_data_for_page (GtkWidget *page)
}
static void
+remove_page_data (PageData *page_data)
+{
+ g_object_set_data (G_OBJECT (page_data->widget), "gis-assistant-page-data", NULL);
+}
+
+static void
free_page_data (PageData *page_data)
{
GisAssistantPrivate *priv = page_data->assistant->priv;
+
priv->pages = g_list_delete_link (priv->pages, page_data->link);
+ if (page_data == priv->current_page)
+ priv->current_page = NULL;
+
g_free (page_data->title);
g_slice_free (PageData, page_data);
}
+static void
+widget_destroyed (GtkWidget *widget,
+ PageData *page_data)
+{
+ remove_page_data (page_data);
+}
+
static PageData *
create_page_data_for_page (GisAssistant *assistant,
GtkWidget *page)
@@ -100,6 +117,7 @@ create_page_data_for_page (GisAssistant *assistant,
page_data->widget = page;
page_data->assistant = assistant;
+ g_signal_connect (page, "destroy", G_CALLBACK (widget_destroyed), page_data);
g_object_set_data_full (G_OBJECT (page), "gis-assistant-page-data",
page_data, (GDestroyNotify) free_page_data);
@@ -328,12 +346,6 @@ gis_assistant_init (GisAssistant *assistant)
}
static void
-remove_page_data (PageData *page_data)
-{
- g_object_set_data (G_OBJECT (page_data->widget), "gis-assistant-page-data", NULL);
-}
-
-static void
gis_assistant_get_property (GObject *object,
guint prop_id,
GValue *value,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]