projects
/
ptask.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
updated copyright
[ptask.git]
/
src
/
main.c
diff --git
a/src/main.c
b/src/main.c
index
bafb3b4
..
95a8054
100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 2012-201
3
jeanfi@gmail.com
+ * Copyright (C) 2012-201
6
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
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@
-16,13
+16,15
@@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
+#include <locale.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <sys/stat.h>
-#include <json
/json
.h>
+#include <json.h>
#include <glib/gi18n.h>
#include <glib/gi18n.h>
@@
-30,6
+32,7
@@
#include <log.h>
#include <note.h>
#include <log.h>
#include <note.h>
+#include <settings.h>
#include <tw.h>
#include <ui.h>
#include <ui_projecttree.h>
#include <tw.h>
#include <ui.h>
#include <ui_projecttree.h>
@@
-38,19
+41,11
@@
static const char *program_name;
static struct task **tasks;
static const char *program_name;
static struct task **tasks;
-static GSettings *settings;
-
-enum {
- COL_ID,
- COL_DESCRIPTION,
- COL_PROJECT,
- COL_UUID,
- COL_PRIORITY
-};
static struct option long_options[] = {
{"version", no_argument, 0, 'v'},
{"help", no_argument, 0, '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}
};
{"debug", required_argument, 0, 'd'},
{0, 0, 0, 0}
};
@@
-64,7
+59,7
@@
static void print_version()
"This is free software: you are free to change and "
" redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.\n"),
"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-201
3
");
+ "2012-201
6
");
}
static void print_help()
}
static void print_help()
@@
-80,7
+75,8
@@
static void print_help()
" -v, --version display version information and exit"));
puts("");
" -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"));
puts(_(" -d, --debug=LEVEL "
"set the debug level, integer between 0 and 3"));
@@
-94,7
+90,7
@@
static void print_help()
void refresh()
{
GtkWidget *dialog;
void refresh()
{
GtkWidget *dialog;
- const char *current_
prj, *current_
uuid;
+ const char *current_uuid;
struct task **old_tasks;
log_fct_enter();
struct task **old_tasks;
log_fct_enter();
@@
-102,12
+98,10
@@
void refresh()
if (tasks) {
old_tasks = tasks;
if (tasks) {
old_tasks = tasks;
- current_prj = ui_projecttree_get_project();
current_uuid = ui_tasktree_get_task_uuid();
current_uuid = ui_tasktree_get_task_uuid();
- ui_tasktree_update(NULL
, NULL
);
+ ui_tasktree_update(NULL);
} else {
old_tasks = NULL;
} else {
old_tasks = NULL;
- current_prj = NULL;
current_uuid = NULL;
}
current_uuid = NULL;
}
@@
-115,7
+109,7
@@
void refresh()
if (tasks) {
ui_projecttree_update(tasks);
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 {
if (current_uuid)
ui_tasktree_set_selected_task(current_uuid);
} else {
@@
-125,7
+119,7
@@
void refresh()
GTK_BUTTONS_CLOSE,
_("Error loading tasks, verify "
"that a supported version of "
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);
}
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
}
@@
-162,7
+156,10
@@
int main(int argc, char **argv)
{
GtkWindow *window;
GtkBuilder *builder;
{
GtkWindow *window;
GtkBuilder *builder;
- int optc, cmdok, opti;
+ int optc, cmdok, opti, ret;
+ GError *err;
+ gchar *msg;
+ GtkMessageDialog *diag;
program_name = argv[0];
program_name = argv[0];
@@
-174,7
+171,7
@@
int main(int argc, char **argv)
#endif
cmdok = 1;
#endif
cmdok = 1;
- while ((optc = getopt_long(argc, argv, "vhd:", long_options,
+ while ((optc = getopt_long(argc, argv, "vh
f
d:", long_options,
&opti)) != -1) {
switch (optc) {
case 'h':
&opti)) != -1) {
switch (optc) {
case 'h':
@@
-187,6
+184,11
@@
int main(int argc, char **argv)
log_level = atoi(optarg);
log_info(_("Enables debug mode."));
break;
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;
default:
cmdok = 0;
break;
@@
-203,18
+205,36
@@
int main(int argc, char **argv)
gtk_init(NULL, NULL);
gtk_init(NULL, NULL);
- settings
= g_settings_new("ptask"
);
+ settings
_init(
);
builder = gtk_builder_new();
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",
(builder,
PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "ptask.glade",
- NULL);
- window = create_window(builder, settings);
+ &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);
+ }
- ui_taskpanel_init(builder);
- ui_tasktree_init(builder);
- ui_projecttree_init(builder);
+ window = create_window(builder);
gtk_builder_connect_signals(builder, NULL);
gtk_builder_connect_signals(builder, NULL);