/*
- * Copyright (C) 2012-2013 jeanfi@gmail.com
+ * Copyright (C) 2012-2016 jeanfi@gmail.com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
+#include <locale.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static struct option long_options[] = {
{"version", no_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
+ {"force-unsupported-taskwarrior", no_argument, 0, 'f'},
{"debug", required_argument, 0, 'd'},
{0, 0, 0, 0}
};
"This is free software: you are free to change and "
" redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.\n"),
- "2012-2013");
+ "2012-2016");
}
static void print_help()
" -v, --version display version information and exit"));
puts("");
-
+ puts(_(" -f, --force-unsupported-taskwarrior force usage of an"
+ " unsupported version of taskwarrior"));
puts(_(" -d, --debug=LEVEL "
"set the debug level, integer between 0 and 3"));
void refresh()
{
GtkWidget *dialog;
- const char *current_prj, *current_uuid;
+ const char *current_uuid;
struct task **old_tasks;
log_fct_enter();
if (tasks) {
old_tasks = tasks;
- current_prj = ui_projecttree_get_project();
current_uuid = ui_tasktree_get_task_uuid();
- ui_tasktree_update(NULL, NULL);
+ ui_tasktree_update(NULL);
} else {
old_tasks = NULL;
- current_prj = NULL;
current_uuid = NULL;
}
if (tasks) {
ui_projecttree_update(tasks);
- ui_tasktree_update(tasks, current_prj);
+ ui_tasktree_update(tasks);
if (current_uuid)
ui_tasktree_set_selected_task(current_uuid);
} else {
GTK_BUTTONS_CLOSE,
_("Error loading tasks, verify "
"that a supported version of "
- "taskwarrior is installed "));
+ "taskwarrior is installed."));
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
}
{
GtkWindow *window;
GtkBuilder *builder;
- int optc, cmdok, opti;
+ int optc, cmdok, opti, ret;
+ GError *err;
+ gchar *msg;
+ GtkMessageDialog *diag;
program_name = argv[0];
#endif
cmdok = 1;
- while ((optc = getopt_long(argc, argv, "vhd:", long_options,
+ while ((optc = getopt_long(argc, argv, "vhfd:", long_options,
&opti)) != -1) {
switch (optc) {
case 'h':
log_level = atoi(optarg);
log_info(_("Enables debug mode."));
break;
+ case 'f':
+ log_info(_("Force usage of an unsupported version of "
+ "taskwarrior."));
+ tw_enable_check_version(0);
+ break;
default:
cmdok = 0;
break;
settings_init();
builder = gtk_builder_new();
- gtk_builder_add_from_file
+ err = NULL;
+ ret = gtk_builder_add_from_file
(builder,
PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "ptask.glade",
- NULL);
+ &err);
+
+ if (!ret) {
+ msg = g_strdup_printf(_("Failed to load UI: %s"),
+ err->message);
+ log_err(msg);
+
+ diag = GTK_MESSAGE_DIALOG(gtk_message_dialog_new
+ (NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ msg,
+ NULL));
+
+ gtk_dialog_run(GTK_DIALOG(diag));
+
+ g_free(msg);
+
+ exit(EXIT_FAILURE);
+ }
+
window = create_window(builder);
gtk_builder_connect_signals(builder, NULL);