[devhelp/wip/stuff: 12/13] assistant: pass application as property



commit 45e02c59a7cf6e1ed33a908c490634a857cabdf2
Author: Ignacio Casal Quinteiro <ignacio casal nice-software com>
Date:   Thu Jul 25 11:54:04 2013 +0200

    assistant: pass application as property

 src/dh-assistant.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/src/dh-assistant.c b/src/dh-assistant.c
index af6e050..f775c8e 100644
--- a/src/dh-assistant.c
+++ b/src/dh-assistant.c
@@ -30,8 +30,6 @@
 #include "dh-settings.h"
 
 typedef struct {
-        DhApp         *application;
-        GtkWidget     *main_box;
         GtkWidget     *view;
         DhSettings    *settings;
 } DhAssistantPrivate;
@@ -43,11 +41,12 @@ assistant_view_open_uri_cb (DhAssistantView *view,
                             const char      *uri,
                             DhAssistant     *assistant)
 {
-        DhAssistantPrivate *priv;
-        GtkWindow* window;
+        DhApp *app;
+        GtkWindow *window;
 
-        priv = dh_assistant_get_instance_private (assistant);
-        window = dh_app_peek_first_window (priv->application);
+        app = DH_APP (gtk_window_get_application (GTK_WINDOW (assistant)));
+
+        window = dh_app_peek_first_window (app);
         _dh_window_display_uri (DH_WINDOW (window), uri);
 }
 
@@ -82,7 +81,6 @@ dh_assistant_dispose (GObject *object)
         DhAssistant *assistant = DH_ASSISTANT (object);
         DhAssistantPrivate *priv = dh_assistant_get_instance_private (assistant);
 
-        g_clear_object (&priv->application);
         g_clear_object (&priv->settings);
 
         G_OBJECT_CLASS (dh_assistant_parent_class)->dispose (object);
@@ -129,11 +127,9 @@ dh_assistant_new (DhApp *application)
         GtkWidget          *assistant;
         DhAssistantPrivate *priv;
 
-        assistant = g_object_new (DH_TYPE_ASSISTANT, NULL);
+        assistant = g_object_new (DH_TYPE_ASSISTANT, "application", application, NULL);
 
         priv = dh_assistant_get_instance_private (DH_ASSISTANT (assistant));
-        priv->application = g_object_ref (application);
-
         dh_assistant_view_set_book_manager (DH_ASSISTANT_VIEW (priv->view),
                                             dh_app_peek_book_manager (application));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]