<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="halign">start</property>
<property name="margin_left">4</property>
<property name="margin_right">4</property>
<property name="margin_top">4</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="diag_tasknew_project">
+ <object class="GtkLabel" id="label8">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">4</property>
<property name="margin_right">4</property>
<property name="margin_top">4</property>
<property name="margin_bottom">4</property>
- <property name="invisible_char">•</property>
+ <property name="label" translatable="yes">Priority:</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label8">
+ <object class="GtkComboBox" id="diag_tasknew_priority">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="halign">start</property>
<property name="margin_left">4</property>
<property name="margin_right">4</property>
<property name="margin_top">4</property>
<property name="margin_bottom">4</property>
- <property name="label" translatable="yes">Priority:</property>
+ <property name="model">prioritystore</property>
+ <property name="active">2</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
</object>
<packing>
- <property name="left_attach">0</property>
+ <property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkComboBox" id="diag_tasknew_priority">
+ <object class="GtkComboBoxText" id="diag_tasknew_project">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_right">4</property>
<property name="margin_top">4</property>
<property name="margin_bottom">4</property>
- <property name="model">prioritystore</property>
- <property name="active">2</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
+ <property name="has_entry">True</property>
+ <child internal-child="entry">
+ <object class="GtkEntry" id="comboboxtext-entry">
+ <property name="can_focus">True</property>
+ </object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
}
}
+static void populate_project(GtkComboBoxText *w)
+{
+ struct task **tasks;
+ struct project **all_prjs, **prjs;
+
+ tasks = tw_get_all_tasks("pending");
+
+ all_prjs = tw_get_projects(tasks);
+
+ prjs = all_prjs;
+ while (*prjs) {
+ if (strcmp((*prjs)->name, "ALL"))
+ gtk_combo_box_text_append_text(w, (*prjs)->name);
+
+ prjs++;
+ }
+
+ tw_task_list_free(tasks);
+ tw_project_list_free(all_prjs);
+}
+
void ui_newtask()
{
gint result;
GtkEntry *entry;
const char *desc, *prj, *prio;
GtkComboBox *combo;
+ GtkComboBoxText *w_prj;
log_debug("ui_newtask()");
diag = GTK_DIALOG(gtk_builder_get_object(builder, "diag_tasknew"));
gtk_builder_connect_signals(builder, NULL);
+ w_prj = GTK_COMBO_BOX_TEXT(gtk_builder_get_object
+ (builder, "diag_tasknew_project"));
+ populate_project(w_prj);
+
result = gtk_dialog_run(diag);
if (result == GTK_RESPONSE_ACCEPT) {
(builder, "diag_tasknew_description"));
desc = gtk_entry_get_text(entry);
- entry = GTK_ENTRY(gtk_builder_get_object
- (builder, "diag_tasknew_project"));
- prj = gtk_entry_get_text(entry);
+ w_prj = GTK_COMBO_BOX_TEXT(gtk_builder_get_object
+ (builder, "diag_tasknew_project"));
+ prj = gtk_combo_box_text_get_active_text(w_prj);
combo = GTK_COMBO_BOX(gtk_builder_get_object
(builder, "diag_tasknew_priority"));