Added choose Workspace menu

This commit is contained in:
Markus Koch 2017-02-05 14:31:17 +01:00
parent b7e98db42b
commit 538b2c54d9
3 changed files with 98 additions and 9 deletions

View File

@ -2,6 +2,59 @@
<!-- Generated with glade 3.20.0 --> <!-- Generated with glade 3.20.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.20"/> <requires lib="gtk+" version="3.20"/>
<object class="GtkFileChooserWidget" id="chooseDirectoryDialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action">select-folder</property>
</object>
<object class="GtkPopover" id="chooseWorkspacePopover">
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchEntry" id="searchWorkspace">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkListBox" id="listWorkspace">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="buttonOtherWorkspace">
<property name="label" translatable="yes">Other Workspaces ...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkTextBuffer" id="entryTextBuffer"/> <object class="GtkTextBuffer" id="entryTextBuffer"/>
<object class="GtkEntryCompletion" id="searchEntryCompletion"/> <object class="GtkEntryCompletion" id="searchEntryCompletion"/>
<object class="GtkApplicationWindow" id="mainWindow"> <object class="GtkApplicationWindow" id="mainWindow">
@ -339,12 +392,43 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="spacing">4</property> <property name="spacing">4</property>
<child> <child>
<object class="GtkButton" id="buttonChooseWorkspace"> <object class="GtkMenuButton">
<property name="label" translatable="yes">Choose workspace</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
<signal name="clicked" handler="mainWindow_chooseWorkspaceClicked" swapped="no"/> <property name="popover">chooseWorkspacePopover</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Choose Workspace</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkArrow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="arrow_type">down</property>
<property name="shadow_type">in</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>

View File

@ -245,6 +245,11 @@ static void mainWindow_connect_signals(struct mainWindow *mainWindow)
"icon-press", "icon-press",
(GCallback) mainWindow_dateIconPress, (GCallback) mainWindow_dateIconPress,
mainWindow); mainWindow);
g_signal_connect(mainWindow->buttonOtherWorkspace,
"clicked",
(GCallback) mainWindow_otherWorkspaceClicked,
mainWindow);
} }
/** /**
@ -272,7 +277,7 @@ struct mainWindow *mainWindow_new()
mainWindow = malloc(sizeof(struct mainWindow)); mainWindow = malloc(sizeof(struct mainWindow));
mainWindow->mainWindow = GTK_WIDGET(gtk_builder_get_object(builder, "mainWindow")); mainWindow->mainWindow = GTK_WIDGET(gtk_builder_get_object(builder, "mainWindow"));
mainWindow->buttonChooseWorkspace = GTK_WIDGET(gtk_builder_get_object(builder, "buttonChooseWorkspace")); mainWindow->buttonOtherWorkspace = GTK_WIDGET(gtk_builder_get_object(builder, "buttonOtherWorkspace"));
mainWindow->searchEntry = GTK_WIDGET(gtk_builder_get_object(builder, "searchEntry")); mainWindow->searchEntry = GTK_WIDGET(gtk_builder_get_object(builder, "searchEntry"));
mainWindow->dateStart = GTK_WIDGET(gtk_builder_get_object(builder, "dateStart")); mainWindow->dateStart = GTK_WIDGET(gtk_builder_get_object(builder, "dateStart"));
mainWindow->dateEnd = GTK_WIDGET(gtk_builder_get_object(builder, "dateEnd")); mainWindow->dateEnd = GTK_WIDGET(gtk_builder_get_object(builder, "dateEnd"));
@ -323,14 +328,14 @@ void mainWindow_set_meta_information(struct mainWindow *mainWindow, guint time_e
} }
/** /**
* @brief mainWindow_chooseWorkspaceClicked is called when the user clicks the Choose Workspace button. * @brief mainWindow_otherWorkspaceClicked is called when the user clicks the Other Workspace button.
* @param widget N/A * @param widget N/A
* @param event N/A * @param event N/A
* @param user_data struct mainWindow * * @param user_data struct mainWindow *
*/ */
void mainWindow_chooseWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data) void mainWindow_otherWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data)
{ {
printf("Choose workspace.\n"); printf("TODO: Show directory browser dialog.\n");
fflush(stdout); fflush(stdout);
} }

View File

@ -8,7 +8,7 @@
struct mainWindow { struct mainWindow {
GtkWidget *mainWindow; GtkWidget *mainWindow;
GtkWidget *buttonChooseWorkspace; GtkWidget *buttonOtherWorkspace;
GtkWidget *searchEntry; GtkWidget *searchEntry;
GtkWidget *dateStart; GtkWidget *dateStart;
GtkWidget *dateEnd; GtkWidget *dateEnd;
@ -47,7 +47,7 @@ void mainWindow_set_meta_information(struct mainWindow *mainWindow, guint time_e
/* Slots */ /* Slots */
void mainWindow_showPopover(GtkWidget *widget, GdkEvent *event, gpointer user_data); void mainWindow_showPopover(GtkWidget *widget, GdkEvent *event, gpointer user_data);
void mainWindow_chooseWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data); void mainWindow_otherWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data);
void mainWindow_clearSearch(GtkWidget *widget, gpointer user_data); void mainWindow_clearSearch(GtkWidget *widget, gpointer user_data);
void mainWindow_calendarSelected(GtkWidget *widget, gpointer user_data); void mainWindow_calendarSelected(GtkWidget *widget, gpointer user_data);
void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data); void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data);