[gnome-initial-setup] Stop using ugly hacks to get at attributes of private structs
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] Stop using ugly hacks to get at attributes of private structs
- Date: Tue, 12 Jun 2012 05:20:37 +0000 (UTC)
commit cf1e8572f9b186859f5bf43e6e7ca103a6bd3ed3
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Jun 12 00:52:21 2012 -0400
Stop using ugly hacks to get at attributes of private structs
gnome-initial-setup/gis-eula-pages.c | 7 ++++---
gnome-initial-setup/gnome-initial-setup.c | 13 ++++++++++++-
gnome-initial-setup/gnome-initial-setup.h | 12 +++---------
3 files changed, 19 insertions(+), 13 deletions(-)
---
diff --git a/gnome-initial-setup/gis-eula-pages.c b/gnome-initial-setup/gis-eula-pages.c
index 54cae78..fa12dc7 100644
--- a/gnome-initial-setup/gis-eula-pages.c
+++ b/gnome-initial-setup/gis-eula-pages.c
@@ -74,7 +74,7 @@ static void
eula_checkbox_toggled (GtkToggleButton *checkbox,
SetupData *setup)
{
- gtk_assistant_set_page_complete (setup->assistant,
+ gtk_assistant_set_page_complete (gis_get_assistant (setup),
g_object_get_data (G_OBJECT (checkbox), "assistant-page"),
gtk_toggle_button_get_active (checkbox));
}
@@ -87,6 +87,7 @@ build_eula_page (SetupData *setup,
GtkWidget *vbox;
GtkWidget *scrolled_window;
GtkWidget *checkbox;
+ GtkAssistant *assistant = gis_get_assistant (setup);
text_view = build_eula_text_view (eula);
if (text_view == NULL)
@@ -109,8 +110,8 @@ build_eula_page (SetupData *setup,
/* XXX: 1 is the location after the welcome page.
* Remove this hardcoded thing. */
- gtk_assistant_insert_page (setup->assistant, vbox, 1);
- gtk_assistant_set_page_complete (setup->assistant, vbox, FALSE);
+ gtk_assistant_insert_page (assistant, vbox, 1);
+ gtk_assistant_set_page_complete (assistant, vbox, FALSE);
gtk_widget_show_all (GTK_WIDGET (vbox));
g_signal_connect (checkbox, "toggled",
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 2df73a8..294f0e4 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -2,7 +2,6 @@
#include "config.h"
-#define GIS_COMP
#include "gnome-initial-setup.h"
#include <glib/gi18n.h>
@@ -151,6 +150,18 @@ gis_get_overrides (SetupData *data)
return g_key_file_ref (data->overrides);
}
+GtkBuilder *
+gis_get_builder (SetupData *data)
+{
+ return data->builder;
+}
+
+GtkAssistant *
+gis_get_assistant (SetupData *data)
+{
+ return data->assistant;
+}
+
/* main {{{1 */
int
diff --git a/gnome-initial-setup/gnome-initial-setup.h b/gnome-initial-setup/gnome-initial-setup.h
index 74ca51e..4060d9b 100644
--- a/gnome-initial-setup/gnome-initial-setup.h
+++ b/gnome-initial-setup/gnome-initial-setup.h
@@ -9,17 +9,11 @@ G_BEGIN_DECLS
typedef struct _SetupData SetupData;
-/* ugly hacks ugghh */
-#ifndef GIS_COMP
-struct _SetupData {
- GtkBuilder *builder;
- GtkAssistant *assistant;
-};
-#endif
-
+GtkBuilder *gis_get_builder (SetupData *data);
+GtkAssistant *gis_get_assistant (SetupData *data);
GKeyFile *gis_get_overrides (SetupData *data);
-#define OBJ(type,name) ((type)gtk_builder_get_object(setup->builder,(name)))
+#define OBJ(type,name) ((type)gtk_builder_get_object(gis_get_builder(setup),(name)))
#define WID(name) OBJ(GtkWidget*,name)
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]