#include "ui_fileops.h"
#include <langinfo.h>
+#include <locale.h>
gdouble get_zoom_increment(void)
{
gchar *message;
gchar *dir;
- message = decode_geo_script(GQ_BIN_DIR, input_text);
+ message = decode_geo_script(gq_bin_dir, input_text);
if (strstr(message, "Error"))
{
g_free(message);
* @brief Returns integer representing first_day_of_week
* @returns Integer in range 1 to 7
*
- * Uses current locale to get first day of week
+ * Uses current locale to get first day of week.
+ * If _NL_TIME_FIRST_WEEKDAY is not available, ISO 8601
+ * states first day of week is Monday.
+ * USA, Mexico and Canada (and others) use Sunday as first day of week.
*
* Sunday == 1
*/
gint date_get_first_day_of_week()
{
+#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
return nl_langinfo(_NL_TIME_FIRST_WEEKDAY)[0];
+#else
+ gchar *dot;
+ gchar *current_locale;
+
+ current_locale = setlocale(LC_ALL, NULL);
+ dot = strstr(current_locale, ".");
+ if ((strncmp(dot - 2, "US", 2) == 0) || (strncmp(dot - 2, "MX", 2) == 0) || (strncmp(dot - 2, "CA", 2) == 0))
+ {
+ return 1;
+ }
+ else
+ {
+ return 2;
+ }
+#endif
}
/**
return ret;
}
+gint get_cpu_cores(void)
+{
+ FILE *cpuinfo = fopen("/proc/cpuinfo", "rb");
+ char *arg = 0;
+ size_t size = 0;
+ int cores = 1;
+ gchar *siblings_line;
+ gchar *siblings_str;
+
+ while(getline(&arg, &size, cpuinfo) != -1)
+ {
+ siblings_line = g_strrstr(arg, "siblings");
+ if (siblings_line)
+ {
+ siblings_str = g_strrstr(siblings_line, ":");
+ if (siblings_str)
+ {
+ cores = g_ascii_strtoll(siblings_str + 1, NULL, 0);
+ }
+ }
+ }
+ free(arg);
+ fclose(cpuinfo);
+
+ return cores;
+}
+
+void tree_path_free_wrapper(void *data, void *useradata)
+{
+ gtk_tree_path_free(data);
+}
+
/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */