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 -->
<interface>
<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="GtkEntryCompletion" id="searchEntryCompletion"/>
<object class="GtkApplicationWindow" id="mainWindow">
@ -339,12 +392,43 @@
<property name="can_focus">False</property>
<property name="spacing">4</property>
<child>
<object class="GtkButton" id="buttonChooseWorkspace">
<property name="label" translatable="yes">Choose workspace</property>
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="can_focus">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>
<packing>
<property name="expand">False</property>

View File

@ -245,6 +245,11 @@ static void mainWindow_connect_signals(struct mainWindow *mainWindow)
"icon-press",
(GCallback) mainWindow_dateIconPress,
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->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->dateStart = GTK_WIDGET(gtk_builder_get_object(builder, "dateStart"));
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 event N/A
* @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);
}

View File

@ -8,7 +8,7 @@
struct mainWindow {
GtkWidget *mainWindow;
GtkWidget *buttonChooseWorkspace;
GtkWidget *buttonOtherWorkspace;
GtkWidget *searchEntry;
GtkWidget *dateStart;
GtkWidget *dateEnd;
@ -47,7 +47,7 @@ void mainWindow_set_meta_information(struct mainWindow *mainWindow, guint time_e
/* Slots */
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_calendarSelected(GtkWidget *widget, gpointer user_data);
void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data);