* mu: add the 'mu stats' command (WIP) + some refactoring

This commit is contained in:
djcb
2012-10-19 00:51:04 +03:00
parent c1828ab2c8
commit 7915cafdee
9 changed files with 320 additions and 47 deletions

View File

@ -173,35 +173,6 @@ resolve_bookmark (MuConfig *opts, GError **err)
}
gchar*
str_quoted_from_strv (const gchar **params)
{
GString *str;
int i;
g_return_val_if_fail (params, NULL);
if (!params[0])
return g_strdup ("");
str = g_string_sized_new (64); /* just a guess */
for (i = 0; params[i]; ++i) {
if (i > 0)
g_string_append_c (str, ' ');
g_string_append_c (str, '"');
g_string_append (str, params[i]);
g_string_append_c (str, '"');
}
return g_string_free (str, FALSE);
}
static gchar*
get_query (MuConfig *opts, GError **err)
{
@ -221,7 +192,7 @@ get_query (MuConfig *opts, GError **err)
return NULL;
}
query = str_quoted_from_strv ((const gchar**)&opts->params[1]);
query = mu_str_quoted_from_strv ((const gchar**)&opts->params[1]);
if (bookmarkval) {
gchar *tmp;
tmp = g_strdup_printf ("%s %s", bookmarkval, query);