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_taskpanel.h>
28 #include <ui_tasktree.h>
30 static GtkComboBox *w_status;
31 static GSettings *gsettings;
32 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)
98 GtkWindow *create_window(GtkBuilder *builder, GSettings *settings)
102 gsettings = settings;
104 window = GTK_WINDOW(gtk_builder_get_object(builder, "window"));
106 w_status = GTK_COMBO_BOX(gtk_builder_get_object(builder, "status"));
107 g_signal_connect(w_status,
108 "changed", (GCallback)status_changed_cbk,
111 w = g_settings_get_int(settings, "window-width");
112 h = g_settings_get_int(settings, "window-height");
113 gtk_window_set_default_size(window, w, h);
115 x = g_settings_get_int(settings, "window-x");
116 y = g_settings_get_int(settings, "window-y");
117 gtk_window_move(window, x, y);
119 g_signal_connect(window, "delete_event",
120 G_CALLBACK(delete_event_cbk), settings);
122 ui_taskpanel_init(builder);
123 ui_tasktree_init(builder);
124 ui_projecttree_init(builder);
126 ui_tasktree_load_settings(settings);
131 const char *ui_get_status_filter()
137 status = gtk_combo_box_get_active_id(w_status);
138 log_fct("status: %d", status);
145 void quit_activate_cbk(GtkWidget *menu_item, gpointer data)
152 void about_activate_cbk(GtkWidget *menu_item, gpointer data)
156 gtk_show_about_dialog
159 _("ptask is a GTK+ task management application"),
161 _("Copyright(c) 2010-2013\njeanfi@gmail.com"),
162 "logo-icon-name", "ptask",
163 "program-name", "ptask",
164 "title", _("About ptask"),
166 "website", PACKAGE_URL,
167 "website-label", _("ptask Homepage"),