[tepl/wip/file-loading: 1/4] AppWindow: add is_main_window()



commit 5ee3410f803bc615da75c4e125a8d9ad30750659
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Oct 8 17:01:12 2017 +0200

    AppWindow: add is_main_window()

 docs/reference/tepl-3.0-sections.txt |    1 +
 tepl/tepl-application-window.c       |   29 +++++++++++++++++++++++++++++
 tepl/tepl-application-window.h       |    2 ++
 3 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/tepl-3.0-sections.txt b/docs/reference/tepl-3.0-sections.txt
index bb45e96..fe85a80 100644
--- a/docs/reference/tepl-3.0-sections.txt
+++ b/docs/reference/tepl-3.0-sections.txt
@@ -214,6 +214,7 @@ TeplApplicationWindow
 tepl_application_window_get_from_gtk_application_window
 tepl_application_window_get_application_window
 tepl_application_window_set_tab_group
+tepl_application_window_is_main_window
 tepl_application_window_get_handle_title
 tepl_application_window_set_handle_title
 tepl_application_window_open_file
diff --git a/tepl/tepl-application-window.c b/tepl/tepl-application-window.c
index c096b8f..8fc3ed5 100644
--- a/tepl/tepl-application-window.c
+++ b/tepl/tepl-application-window.c
@@ -1145,6 +1145,35 @@ tepl_application_window_set_tab_group (TeplApplicationWindow *tepl_window,
 }
 
 /**
+ * tepl_application_window_is_main_window:
+ * @gtk_window: a #GtkApplicationWindow.
+ *
+ * Returns %TRUE iff @gtk_window has an associated #TeplTabGroup (i.e. if
+ * tepl_application_window_set_tab_group() has been called).
+ *
+ * This function takes a #GtkApplicationWindow parameter to avoid creating the
+ * #TeplApplicationWindow object if it hasn't been created.
+ *
+ * Returns: whether @gtk_window is considered a main application window.
+ * Since: 3.2
+ */
+gboolean
+tepl_application_window_is_main_window (GtkApplicationWindow *gtk_window)
+{
+       TeplApplicationWindow *tepl_window;
+
+       g_return_val_if_fail (GTK_IS_APPLICATION_WINDOW (gtk_window), FALSE);
+
+       tepl_window = g_object_get_data (G_OBJECT (gtk_window), TEPL_APPLICATION_WINDOW_KEY);
+       if (tepl_window == NULL)
+       {
+               return FALSE;
+       }
+
+       return tepl_window->priv->tab_group != NULL;
+}
+
+/**
  * tepl_application_window_get_handle_title:
  * @tepl_window: a #TeplApplicationWindow.
  *
diff --git a/tepl/tepl-application-window.h b/tepl/tepl-application-window.h
index 49e70a9..147f5d1 100644
--- a/tepl/tepl-application-window.h
+++ b/tepl/tepl-application-window.h
@@ -62,6 +62,8 @@ GtkApplicationWindow *        tepl_application_window_get_application_window          
(TeplAppl
 void                   tepl_application_window_set_tab_group                   (TeplApplicationWindow 
*tepl_window,
                                                                                 TeplTabGroup          
*tab_group);
 
+gboolean               tepl_application_window_is_main_window                  (GtkApplicationWindow 
*gtk_window);
+
 gboolean               tepl_application_window_get_handle_title                (TeplApplicationWindow 
*tepl_window);
 
 void                   tepl_application_window_set_handle_title                (TeplApplicationWindow 
*tepl_window,


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