Set window title and subtitle

Title is fixed, set to “Astrognome”
Subtitle is the name on the chart
This commit is contained in:
Gergely Polonkai 2014-07-03 15:31:05 +02:00
parent cddfae951d
commit d95ef75e59
2 changed files with 15 additions and 0 deletions

View File

@ -13,6 +13,7 @@
#include "ag-settings.h"
struct _AgWindowPrivate {
GtkWidget *header_bar;
GtkWidget *grid;
GtkWidget *stack;
GtkWidget *stack_switcher;
@ -551,6 +552,7 @@ ag_window_class_init(AgWindowClass *klass)
gobject_class->dispose = ag_window_dispose;
gtk_widget_class_set_template_from_resource(widget_class, "/eu/polonkai/gergely/astrognome/ag-window.ui");
gtk_widget_class_bind_template_child_private(widget_class, AgWindow, header_bar);
gtk_widget_class_bind_template_child_private(widget_class, AgWindow, name);
gtk_widget_class_bind_template_child_private(widget_class, AgWindow, year);
gtk_widget_class_bind_template_child_private(widget_class, AgWindow, month);
@ -697,3 +699,14 @@ ag_window_change_tab(AgWindow *window, const gchar *tab_name)
g_variant_new_string(tab_name)
);
}
void
ag_window_name_changed_cb(GtkEntry *name_entry, AgWindow *window)
{
const gchar *name;
AgWindowPrivate *priv = ag_window_get_instance_private(window);
name = gtk_entry_get_text(name_entry);
gtk_header_bar_set_subtitle(GTK_HEADER_BAR(priv->header_bar), name);
}

View File

@ -116,6 +116,7 @@
<property name="can_focus">False</property>
<property name="vexpand">False</property>
<property name="show_close_button">True</property>
<property name="title" translatable="yes">Astrognome</property>
<child>
<object class="GtkBox" id="box">
<property name="visible">True</property>
@ -199,6 +200,7 @@
<object class="GtkEntry" id="name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="ag_window_name_changed_cb" object="AgWindow" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>