2 * Copyright (C) 2012-2013 jeanfi@gmail.com
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 static const char *ui_get_priority(GtkComboBox *combo)
30 prio = gtk_combo_box_get_active(combo);
47 static GtkDialog *diag;
50 const char *desc, *prj, *prio;
53 log_debug("ui_newtask()");
55 builder = gtk_builder_new();
56 gtk_builder_add_from_file
58 PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "ptask.glade",
60 diag = GTK_DIALOG(gtk_builder_get_object(builder, "diag_tasknew"));
61 gtk_builder_connect_signals(builder, NULL);
63 result = gtk_dialog_run(diag);
65 if (result == GTK_RESPONSE_ACCEPT) {
66 log_debug("ui_newtask(): ok");
68 entry = GTK_ENTRY(gtk_builder_get_object
69 (builder, "diag_tasknew_description"));
70 desc = gtk_entry_get_text(entry);
72 entry = GTK_ENTRY(gtk_builder_get_object
73 (builder, "diag_tasknew_project"));
74 prj = gtk_entry_get_text(entry);
76 combo = GTK_COMBO_BOX(gtk_builder_get_object
77 (builder, "diag_tasknew_priority"));
78 prio = ui_get_priority(combo);
80 log_debug("ui_newtask(): description=%s project=%s priority=%d",
85 tw_add(desc, prj, prio);
88 log_debug("ui_newtask(): cancel");
91 g_object_unref(G_OBJECT(builder));
93 gtk_widget_destroy(GTK_WIDGET(diag));