[gtk+] GtkWindow: Add a getter for the custom titlebar



commit c5c21bb1cfa27c6058f68360a761caab62b7e0fc
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Oct 18 12:42:29 2014 -0400

    GtkWindow: Add a getter for the custom titlebar
    
    This is needed for the glade integration of CSD windows.

 docs/reference/gtk/gtk3-sections.txt |    1 +
 gtk/gtkwindow.c                      |   25 +++++++++++++++++++++++++
 gtk/gtkwindow.h                      |    2 ++
 3 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index cf16a5b..570832e 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -5741,6 +5741,7 @@ gtk_window_get_application
 gtk_window_set_application
 gtk_window_set_has_user_ref_count
 gtk_window_set_titlebar
+gtk_window_get_titlebar
 gtk_window_set_interactive_debugging
 
 <SUBSECTION Standard>
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index d177b23..2328591 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -4007,6 +4007,31 @@ out:
     gtk_widget_map (widget);
 }
 
+/**
+ * gtk_window_get_titlebar:
+ * @window: a #GtkWindow
+ *
+ * Returns the custom titlebar that has been set with
+ * gtk_window_set_titlebar().
+ *
+ * Returns: (transfer none): the custom titlebar, or %NULL
+ *
+ * Since: 3.16
+ */
+GtkWidget *
+gtk_window_get_titlebar (GtkWindow *window)
+{
+  GtkWindowPrivate *priv = window->priv;
+
+  g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
+
+  /* Don't return the internal titlebar */
+  if (priv->title_box == priv->titlebar)
+    return NULL;
+
+  return priv->title_box;
+}
+
 gboolean
 _gtk_window_titlebar_shows_app_menu (GtkWindow *window)
 {
diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h
index 687b312..4d97020 100644
--- a/gtk/gtkwindow.h
+++ b/gtk/gtkwindow.h
@@ -482,6 +482,8 @@ gboolean gtk_window_get_resize_grip_area   (GtkWindow    *window,
 GDK_AVAILABLE_IN_3_10
 void     gtk_window_set_titlebar           (GtkWindow    *window,
                                             GtkWidget    *titlebar);
+GDK_AVAILABLE_IN_3_16
+GtkWidget *gtk_window_get_titlebar         (GtkWindow    *window);
 
 GDK_AVAILABLE_IN_3_12
 gboolean gtk_window_is_maximized           (GtkWindow    *window);


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