summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-03-11 22:20:14 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-03-11 22:20:14 +0000
commit32676b06198998a09c9a38097874ce026d85e3c6 (patch)
tree1b9d0df282391f6871c2da0724ce78b1c50f09fc /src/util.c
parent3ff2af37a446a0bc521a1a8eb1562e075c70d04a (diff)
filter by directory and some filter fixes
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/util.c b/src/util.c
index bd20d14..6cb6e11 100644
--- a/src/util.c
+++ b/src/util.c
@@ -23,6 +23,7 @@
#include <math.h>
#include <string.h>
+#include <gconf/gconf-client.h>
#include <glib/gi18n.h>
#include <glib-object.h>
#include <curl/curl.h>
@@ -36,19 +37,20 @@
GRegex *trg_uri_host_regex_new(void)
{
- return g_regex_new("^[^:/?#]+:?//([^/?#]*)", 0, 0, NULL);
+ return g_regex_new("^[^:/?#]+:?//([^/?#]*)", G_REGEX_OPTIMIZE, 0,
+ NULL);
}
-gchar *trg_uri_host_extract(GRegex *rx, const gchar *uri)
+gchar *trg_gregex_get_first(GRegex * rx, const gchar * src)
{
GMatchInfo *mi = NULL;
- gchar *host = NULL;
- g_regex_match (rx, uri, 0, &mi);
+ gchar *dst = NULL;
+ g_regex_match(rx, src, 0, &mi);
if (mi) {
- host = g_match_info_fetch(mi, 1);
- g_match_info_free (mi);
+ dst = g_match_info_fetch(mi, 1);
+ g_match_info_free(mi);
}
- return host;
+ return dst;
}
void trg_error_dialog(GtkWindow * parent, int status,
@@ -66,6 +68,17 @@ void trg_error_dialog(GtkWindow * parent, int status,
g_free((gpointer) msg);
}
+gboolean gconf_client_get_bool_or_true(GConfClient * gconf, gchar * key)
+{
+ GError *error = NULL;
+ gboolean value = gconf_client_get_bool(gconf, key, &error);
+ if (error) {
+ g_error_free(error);
+ return TRUE;
+ }
+ return value;
+}
+
const gchar *make_error_message(JsonObject * response, int status)
{
if (status == FAIL_JSON_DECODE) {