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
21 #include <glib/gi18n.h>
25 #include <ui_newtask_diag.h>
26 #include <ui_projecttree.h>
27 #include <ui_tasktree.h>
29 static GtkComboBox *w_status;
30 static GSettings *gsettings;
31 static GtkWindow *window;
34 int newtask_clicked_cbk(GtkButton *btn, gpointer data)
41 static void save_settings(GtkWindow *window, GSettings *settings)
45 gtk_window_get_size(window, &w, &h);
46 gtk_window_get_position(window, &x, &y);
48 log_debug("save_settings(): x=%d, y=%d, w=%d, h=%d", x, y, w, h);
50 g_settings_set_int(settings, "window-width", w);
51 g_settings_set_int(settings, "window-height", h);
52 g_settings_set_int(settings, "window-x", x);
53 g_settings_set_int(settings, "window-y", y);
55 ui_tasktree_save_settings(settings);
60 int refresh_clicked_cbk(GtkButton *btn, gpointer data)
71 save_settings(window, gsettings);
72 gtk_widget_destroy(GTK_WIDGET(window));
76 static gboolean delete_event_cbk(GtkWidget *w, GdkEvent *evt, gpointer data)
87 static int status_changed_cbk(GtkComboBox *w, gpointer data)
89 log_debug("status_changed_cbk");
95 GtkWindow *create_window(GtkBuilder *builder, GSettings *settings)
101 window = GTK_WINDOW(gtk_builder_get_object(builder, "window"));
103 w_status = GTK_COMBO_BOX(gtk_builder_get_object(builder, "status"));
104 g_signal_connect(w_status,
105 "changed", (GCallback)status_changed_cbk,
108 w = g_settings_get_int(settings, "window-width");
109 h = g_settings_get_int(settings, "window-height");
110 gtk_window_set_default_size(window, w, h);
112 x = g_settings_get_int(settings, "window-x");
113 y = g_settings_get_int(settings, "window-y");
114 gtk_window_move(window, x, y);
116 g_signal_connect(window, "delete_event",
117 G_CALLBACK(delete_event_cbk), settings);
119 ui_tasktree_init(builder);
120 ui_projecttree_init(builder);
122 ui_tasktree_load_settings(settings);
127 const char *ui_get_status_filter()
133 status = gtk_combo_box_get_active_id(w_status);
134 log_fct("status: %d", status);
141 void quit_activate_cbk(GtkWidget *menu_item, gpointer data)
148 void about_activate_cbk(GtkWidget *menu_item, gpointer data)
152 gtk_show_about_dialog
155 _("ptask is a GTK+ task management application"),
157 _("Copyright(c) 2010-2013\njeanfi@gmail.com"),
158 "logo-icon-name", "ptask",
159 "program-name", "ptask",
160 "title", _("About ptask"),
162 "website", PACKAGE_URL,
163 "website-label", _("ptask Homepage"),