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;
35 int newtask_clicked_cbk(GtkButton *btn, gpointer data)
42 static void save_settings(GtkWindow *window, GSettings *settings)
46 gtk_window_get_size(window, &w, &h);
47 gtk_window_get_position(window, &x, &y);
49 log_debug("save_settings(): x=%d, y=%d, w=%d, h=%d", x, y, w, h);
51 g_settings_set_int(settings, "window-width", w);
52 g_settings_set_int(settings, "window-height", h);
53 g_settings_set_int(settings, "window-x", x);
54 g_settings_set_int(settings, "window-y", y);
56 ui_tasktree_save_settings(settings);
61 int refresh_clicked_cbk(GtkButton *btn, gpointer data)
72 save_settings(window, gsettings);
73 gtk_widget_destroy(GTK_WIDGET(window));
77 static gboolean delete_event_cbk(GtkWidget *w, GdkEvent *evt, gpointer data)
88 static int status_changed_cbk(GtkComboBox *w, gpointer data)
90 log_debug("status_changed_cbk");
96 GtkWindow *create_window(GtkBuilder *builder, GSettings *settings)
100 gsettings = settings;
102 window = GTK_WINDOW(gtk_builder_get_object(builder, "window"));
104 w_status = GTK_COMBO_BOX(gtk_builder_get_object(builder, "status"));
105 g_signal_connect(w_status,
106 "changed", (GCallback)status_changed_cbk,
109 w = g_settings_get_int(settings, "window-width");
110 h = g_settings_get_int(settings, "window-height");
111 gtk_window_set_default_size(window, w, h);
113 x = g_settings_get_int(settings, "window-x");
114 y = g_settings_get_int(settings, "window-y");
115 gtk_window_move(window, x, y);
117 g_signal_connect(window, "delete_event",
118 G_CALLBACK(delete_event_cbk), settings);
120 ui_taskpanel_init(builder);
121 ui_tasktree_init(builder);
122 ui_projecttree_init(builder);
124 ui_tasktree_load_settings(settings);
129 const char *ui_get_status_filter()
135 status = gtk_combo_box_get_active_id(w_status);
136 log_fct("status: %d", status);
143 void quit_activate_cbk(GtkWidget *menu_item, gpointer data)
150 void about_activate_cbk(GtkWidget *menu_item, gpointer data)
154 gtk_show_about_dialog
157 _("ptask is a GTK+ task management application"),
159 _("Copyright(c) 2010-2013\njeanfi@gmail.com"),
160 "logo-icon-name", "ptask",
161 "program-name", "ptask",
162 "title", _("About ptask"),
164 "website", PACKAGE_URL,
165 "website-label", _("ptask Homepage"),