Headerbar now updates with the workspace URL

This commit is contained in:
Markus Koch 2017-02-11 18:44:29 +01:00
parent e9ca1ce259
commit f444d40071
3 changed files with 5 additions and 1 deletions

View File

@ -390,7 +390,7 @@
</object> </object>
</child> </child>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar"> <object class="GtkHeaderBar" id="headerBar">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="title">MDiary</property> <property name="title">MDiary</property>

View File

@ -442,6 +442,7 @@ struct mainWindow *mainWindow_new()
mainWindow->checkSearchText = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchText")); mainWindow->checkSearchText = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchText"));
mainWindow->labelSummary = GTK_WIDGET(gtk_builder_get_object(builder, "labelSummary")); mainWindow->labelSummary = GTK_WIDGET(gtk_builder_get_object(builder, "labelSummary"));
mainWindow->buttonClearSearch = GTK_WIDGET(gtk_builder_get_object(builder, "buttonClearSearch")); mainWindow->buttonClearSearch = GTK_WIDGET(gtk_builder_get_object(builder, "buttonClearSearch"));
mainWindow->headerBar = GTK_WIDGET(gtk_builder_get_object(builder, "headerBar"));
mainWindow->entryListView = GTK_TREE_VIEW(gtk_builder_get_object(builder, "entryListView")); mainWindow->entryListView = GTK_TREE_VIEW(gtk_builder_get_object(builder, "entryListView"));
mainWindow->entryListSelection = GTK_TREE_SELECTION(gtk_builder_get_object(builder, "entryListSelection")); mainWindow->entryListSelection = GTK_TREE_SELECTION(gtk_builder_get_object(builder, "entryListSelection"));
mainWindow->textBuffer = GTK_TEXT_BUFFER(gtk_builder_get_object(builder, "entryTextBuffer")); mainWindow->textBuffer = GTK_TEXT_BUFFER(gtk_builder_get_object(builder, "entryTextBuffer"));
@ -716,7 +717,9 @@ void mainWindow_switch_workspace(struct mainWindow *mainWindow, gchar *path)
mdiary_get_time_earliest(), mdiary_get_time_latest(), mdiary_get_time_earliest(), mdiary_get_time_latest(),
FALSE); FALSE);
mainWindow_add_recent_workspace(mainWindow, path, FALSE); mainWindow_add_recent_workspace(mainWindow, path, FALSE);
gtk_header_bar_set_subtitle(GTK_HEADER_BAR(mainWindow->headerBar), path);
} else { } else {
gtk_header_bar_set_subtitle(GTK_HEADER_BAR(mainWindow->headerBar), "No workspace opened.");
mainWindow_show_error(mainWindow, "Could not open workspace or no entries were found in it."); mainWindow_show_error(mainWindow, "Could not open workspace or no entries were found in it.");
} }

View File

@ -29,6 +29,7 @@ struct mainWindow {
GtkWidget *checkSearchText; GtkWidget *checkSearchText;
GtkWidget *labelSummary; GtkWidget *labelSummary;
GtkWidget *buttonClearSearch; GtkWidget *buttonClearSearch;
GtkWidget *headerBar;
GtkTreeView *entryListView; GtkTreeView *entryListView;
GtkTreeSelection *entryListSelection; GtkTreeSelection *entryListSelection;
GtkTextBuffer *textBuffer; GtkTextBuffer *textBuffer;