[devhelp] Window: new(): take a GtkApplication param



commit 37262e5e26d88006118434dc1fb63df459a8dbf8
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Dec 20 16:05:40 2017 +0100

    Window: new(): take a GtkApplication param
    
    There was a circular dependency between dh-app.h and dh-window.h.
    dh-app.h requires the DhWindow type, and dh-window.h required the DhApp
    type. Now dh-window.h no longer depends on dh-app.h.
    
    The GtkWindow:application property has anyway the GtkApplication type.
    
    Another solution would have been to create dh-app-types.h with only the
    type definitions, like it is done in other GNOME modules.

 src/dh-app.c    |    2 +-
 src/dh-window.c |    4 +++-
 src/dh-window.h |    3 +--
 3 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/dh-app.c b/src/dh-app.c
index 12c4612..6c23927 100644
--- a/src/dh-app.c
+++ b/src/dh-app.c
@@ -36,7 +36,7 @@ new_window_cb (GSimpleAction *action,
         DhApp *app = DH_APP (user_data);
         GtkWidget *window;
 
-        window = dh_window_new (app);
+        window = dh_window_new (GTK_APPLICATION (app));
         gtk_widget_show_all (window);
 }
 
diff --git a/src/dh-window.c b/src/dh-window.c
index d43e596..e7a981a 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -1502,12 +1502,14 @@ window_tab_set_title (DhWindow      *window,
 }
 
 GtkWidget *
-dh_window_new (DhApp *application)
+dh_window_new (GtkApplication *application)
 {
         DhWindow *window;
         DhWindowPrivate *priv;
         DhSettings *settings;
 
+        g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
+
         window = g_object_new (DH_TYPE_WINDOW,
                                "application", application,
                                NULL);
diff --git a/src/dh-window.h b/src/dh-window.h
index bbbe161..f42274a 100644
--- a/src/dh-window.h
+++ b/src/dh-window.h
@@ -22,7 +22,6 @@
 #define DH_WINDOW_H
 
 #include <gtk/gtk.h>
-#include "dh-app.h"
 
 G_BEGIN_DECLS
 
@@ -45,7 +44,7 @@ struct _DhWindowClass {
 };
 
 GType      dh_window_get_type     (void) G_GNUC_CONST;
-GtkWidget *dh_window_new          (DhApp       *application);
+GtkWidget *dh_window_new          (GtkApplication *application);
 void       dh_window_search       (DhWindow    *window,
                                    const gchar *str);
 void       _dh_window_display_uri (DhWindow    *window,


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