[gnome-todo/wip/gbsneto/plugins] window: add function to set title
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo/wip/gbsneto/plugins] window: add function to set title
- Date: Mon, 4 Jan 2016 05:09:26 +0000 (UTC)
commit d87b815fa543d1149c1b4c466212a1a597071157
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Jan 4 03:06:19 2016 -0200
window: add function to set title
Used by the next commit.
src/gtd-window.c | 32 ++++++++++++++++++++++++++++++++
src/gtd-window.h | 4 ++++
2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/src/gtd-window.c b/src/gtd-window.c
index ce0d267..ada465b 100644
--- a/src/gtd-window.c
+++ b/src/gtd-window.c
@@ -800,3 +800,35 @@ gtd_window_set_mode (GtdWindow *window,
g_object_notify (G_OBJECT (window), "mode");
}
}
+
+/**
+ * gtd_window_set_custom_title:
+ * @window: a #GtdWindow
+ * @title: (nullable): the #GtkHeaderBar title
+ * @subtitle: (nullable): the #GtkHeaderBar subtitle
+ *
+ * Sets the #GtdWindow's headerbar title and subtitle. If @title is %NULL,
+ * the header will be set to the stack switcher.
+ */
+void
+gtd_window_set_custom_title (GtdWindow *window,
+ const gchar *title,
+ const gchar *subtitle)
+{
+ GtdWindowPrivate *priv;
+
+ g_return_if_fail (GTD_IS_WINDOW (window));
+
+ priv = window->priv;
+
+ if (title)
+ {
+ gtk_header_bar_set_custom_title (priv->headerbar, NULL);
+ gtk_header_bar_set_title (priv->headerbar, title);
+ gtk_header_bar_set_subtitle (window->priv->headerbar, subtitle);
+ }
+ else
+ {
+ gtk_header_bar_set_custom_title (priv->headerbar, GTK_WIDGET (priv->stack_switcher));
+ }
+}
diff --git a/src/gtd-window.h b/src/gtd-window.h
index 2c96d36..5cc690e 100644
--- a/src/gtd-window.h
+++ b/src/gtd-window.h
@@ -45,6 +45,10 @@ GtdWindowMode gtd_window_get_mode (GtdWindow
void gtd_window_set_mode (GtdWindow *window,
GtdWindowMode mode);
+void gtd_window_set_custom_title (GtdWindow *window,
+ const gchar *title,
+ const gchar *subtitle);
+
G_END_DECLS
#endif /* GTD_WINDOW_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]