/*
- * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
+ * Copyright (C) 2009-2011 Andy Spencer <andy753421@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 published by
}
}
+static void xdg_open(GtkLinkButton *button, const gchar *link, gpointer user_data)
+{
+ gchar *argv[] = {"xdg-open", (gchar*)link, NULL};
+ g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
+}
+
static void on_log_level_changed(GtkSpinButton *spinner, AWeatherGui *self)
{
g_message("main: log_level_changed");
/* Set time
* Do this before setting setting location
* so that it doesn't refresh twice */
- struct tm tm = {};
- strptime(time, "%Y-%m-%d %H:%M", &tm);
- time_t sec = mktime(&tm);
+ int year, mon, day, hour, min;
+ sscanf(time, "%d-%d-%d %d:%d", &year, &mon, &day, &hour, &min);
+ time_t sec = mktime(&(struct tm){0, year-1900, mon-1, day, hour, min});
if (sec > 0)
grits_viewer_set_time(gui->viewer, sec);
g_debug("date = [%s] == %lu\n", time, sec);
return -1;
}
+ /* Use external handler for link buttons */
+ gtk_link_button_set_uri_hook(xdg_open, NULL, NULL);
+
/* Setup debug level for aweather_gui_new */
g_log_set_handler(NULL, G_LOG_LEVEL_MASK, log_func, NULL);
log_levels = int2log(opt_debug >= 0 ? opt_debug : debug);