tracker r2931 - in trunk: . src/tracker-utils
- From: mr svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2931 - in trunk: . src/tracker-utils
- Date: Mon, 16 Feb 2009 17:18:26 +0000 (UTC)
Author: mr
Date: Mon Feb 16 17:18:25 2009
New Revision: 2931
URL: http://svn.gnome.org/viewvc/tracker?rev=2931&view=rev
Log:
* src/tracker-utils/tracker-services.c: Also sorted all properties
returned by tracker-services.
* src/tracker-utils/tracker-files.c:
* src/tracker-utils/tracker-info.c:
* src/tracker-utils/tracker-meta-folder.c:
* src/tracker-utils/tracker-query.c:
* src/tracker-utils/tracker-search.c:
* src/tracker-utils/tracker-tag.c:
* src/tracker-utils/tracker-unique.c: Added extra warning to all
utils which have a --limit option so the user knows that there are
more results if the limit is reached and not listed to stdout.
Fixed the singular/plural issues with "Results".
Modified:
trunk/ChangeLog
trunk/src/tracker-utils/tracker-files.c
trunk/src/tracker-utils/tracker-info.c
trunk/src/tracker-utils/tracker-meta-folder.c
trunk/src/tracker-utils/tracker-query.c
trunk/src/tracker-utils/tracker-search.c
trunk/src/tracker-utils/tracker-services.c
trunk/src/tracker-utils/tracker-tag.c
trunk/src/tracker-utils/tracker-unique.c
Modified: trunk/src/tracker-utils/tracker-files.c
==============================================================================
--- trunk/src/tracker-utils/tracker-files.c (original)
+++ trunk/src/tracker-utils/tracker-files.c Mon Feb 16 17:18:25 2009
@@ -101,7 +101,8 @@
if (service) {
gchar **array;
- gchar **p_strarray;
+ gchar **p;
+ gint length;
type = tracker_service_name_to_type (service);
@@ -133,11 +134,31 @@
return EXIT_FAILURE;
}
- g_print ("%s:\n",
- _("Results"));
+ length = g_strv_length (array);
- for (p_strarray = array; *p_strarray; p_strarray++) {
- g_print (" %s\n", *p_strarray);
+ g_print (g_dngettext (NULL,
+ _("Result: %d"),
+ _("Results: %d"),
+ length),
+ length);
+ g_print ("\n");
+
+ for (p = array; *p; p++) {
+ g_print (" %s\n", *p);
+ }
+
+ if (length >= limit) {
+ /* Display '...' so the user thinks there is
+ * more items.
+ */
+ g_print (" ...\n");
+
+ /* Display warning so the user knows this is
+ * not the WHOLE data set.
+ */
+ g_printerr ("\n"
+ "%s\n",
+ _("NOTE: Limit was reached, there are more items in the database not listed here"));
}
g_strfreev (array);
@@ -146,6 +167,7 @@
if (mimes) {
gchar **array;
gchar **p;
+ gint length;
array = tracker_files_get_by_mime_type (client,
time (NULL),
@@ -170,13 +192,33 @@
return EXIT_FAILURE;
}
- g_print ("%s:\n",
- _("Results"));
+ length = g_strv_length (array);
+ g_print (g_dngettext (NULL,
+ _("Result: %d"),
+ _("Results: %d"),
+ length),
+ length);
+ g_print ("\n");
+
for (p = array; *p; p++) {
g_print (" %s\n", *p);
}
+ if (length >= limit) {
+ /* Display '...' so the user thinks there is
+ * more items.
+ */
+ g_print (" ...\n");
+
+ /* Display warning so the user knows this is
+ * not the WHOLE data set.
+ */
+ g_printerr ("\n"
+ "%s\n",
+ _("NOTE: Limit was reached, there are more items in the database not listed here"));
+ }
+
g_strfreev (array);
}
Modified: trunk/src/tracker-utils/tracker-info.c
==============================================================================
--- trunk/src/tracker-utils/tracker-info.c (original)
+++ trunk/src/tracker-utils/tracker-info.c Mon Feb 16 17:18:25 2009
@@ -54,7 +54,7 @@
pair = value;
- g_print ("%s - %s\n", pair[0], pair[1]);
+ g_print (" '%s' = '%s'\n", pair[0], pair[1]);
}
int
@@ -146,8 +146,16 @@
g_print ("%s\n",
_("No metadata available for that uri"));
} else {
- g_print ("%s\n",
- _("Results:"));
+ gint length;
+
+ length = results->len;
+
+ g_print (g_dngettext (NULL,
+ _("Result: %d"),
+ _("Results: %d"),
+ length),
+ length);
+ g_print ("\n");
g_ptr_array_foreach (results, (GFunc) print_property_value, NULL);
g_ptr_array_foreach (results, (GFunc) g_strfreev, NULL);
Modified: trunk/src/tracker-utils/tracker-meta-folder.c
==============================================================================
--- trunk/src/tracker-utils/tracker-meta-folder.c (original)
+++ trunk/src/tracker-utils/tracker-meta-folder.c Mon Feb 16 17:18:25 2009
@@ -167,7 +167,7 @@
summary = g_strconcat (_("To use multiple meta-data types simply list them, for example:"),
"\n"
"\n"
- " -p ", _("PATH"), " File:Size File:Type",
+ " -p ", _("PATH"), " File:Size",
NULL);
g_option_context_set_summary (context, summary);
@@ -259,9 +259,17 @@
g_print ("%s\n",
_("No meta-data found for files in that directory"));
} else {
- g_print ("%s:\n",
- _("Results"));
+ gint length;
+ length = array->len;
+
+ g_print (g_dngettext (NULL,
+ _("Result: %d"),
+ _("Results: %d"),
+ length),
+ length);
+ g_print ("\n");
+
print_header (fields_resolved);
g_ptr_array_foreach (array,
Modified: trunk/src/tracker-utils/tracker-query.c
==============================================================================
--- trunk/src/tracker-utils/tracker-query.c (original)
+++ trunk/src/tracker-utils/tracker-query.c Mon Feb 16 17:18:25 2009
@@ -240,8 +240,33 @@
g_print ("%s\n",
_("No results found matching your query"));
} else {
+ gint length;
+
+ length = array->len;
+
+ g_print (g_dngettext (NULL,
+ _("Result: %d"),
+ _("Results: %d"),
+ length),
+ length);
+ g_print ("\n");
+
g_ptr_array_foreach (array, (GFunc) get_meta_table_data, NULL);
g_ptr_array_free (array, TRUE);
+
+ if (length >= limit) {
+ /* Display '...' so the user thinks there is
+ * more items.
+ */
+ g_print (" ...\n");
+
+ /* Display warning so the user knows this is
+ * not the WHOLE data set.
+ */
+ g_printerr ("\n"
+ "%s\n",
+ _("NOTE: Limit was reached, there are more items in the database not listed here"));
+ }
}
tracker_disconnect (client);
Modified: trunk/src/tracker-utils/tracker-search.c
==============================================================================
--- trunk/src/tracker-utils/tracker-search.c (original)
+++ trunk/src/tracker-utils/tracker-search.c Mon Feb 16 17:18:25 2009
@@ -216,8 +216,16 @@
g_print ("%s\n",
_("No results found matching your query"));
} else {
- g_print ("%s\n",
- _("Results:"));
+ gint length;
+
+ length = g_strv_length (strv);
+
+ g_print (g_dngettext (NULL,
+ _("Result: %d"),
+ _("Results: %d"),
+ length),
+ length);
+ g_print ("\n");
g_ptr_array_foreach (array, (GFunc) get_meta_table_data, NULL);
g_ptr_array_free (array, TRUE);
@@ -247,8 +255,16 @@
g_print ("%s\n",
_("No results found matching your query"));
} else {
- g_print ("%s:\n",
- _("Results"));
+ gint length;
+
+ length = g_strv_length (strv);
+
+ g_print (g_dngettext (NULL,
+ _("Result: %d"),
+ _("Results: %d"),
+ length),
+ length);
+ g_print ("\n");
for (p = strv; *p; p++) {
gchar *s;
@@ -263,6 +279,21 @@
g_free (s);
}
+
+ if (length >= limit) {
+ /* Display '...' so the user thinks there is
+ * more items.
+ */
+ g_print (" ...\n");
+
+ /* Display warning so the user knows this is
+ * not the WHOLE data set.
+ */
+ g_printerr ("\n"
+ "%s\n",
+ _("NOTE: Limit was reached, there are more items in the database not listed here"));
+ }
+
g_free (strv);
}
}
Modified: trunk/src/tracker-utils/tracker-services.c
==============================================================================
--- trunk/src/tracker-utils/tracker-services.c (original)
+++ trunk/src/tracker-utils/tracker-services.c Mon Feb 16 17:18:25 2009
@@ -46,19 +46,6 @@
{ NULL }
};
-
-static void
-print_strv (gchar **values)
-{
- guint i;
-
- for (i = 0; values[i] != NULL; i++) {
- g_print (" - %s\n", values[i]);
- }
-
- g_print ("\n");
-}
-
int
main (int argc, char **argv)
{
@@ -89,6 +76,7 @@
return EXIT_FAILURE;
}
+
g_option_context_free (context);
client = tracker_connect (FALSE);
@@ -115,16 +103,20 @@
g_print ("%s\n",
_("No services available"));
} else {
- g_print ("%s\n\n",
- _("Service types available in Tracker:"));
+ gchar **p;
+
+ g_print ("%s:\n",
+ _("Service types available in Tracker"));
- print_strv (array);
+ for (p = array; *p; p++) {
+ g_print (" %s\n", *p);
+ }
+
g_strfreev (array);
}
}
if (properties) {
-
array = tracker_metadata_get_registered_types (client, "*", &error);
if (error) {
@@ -140,14 +132,28 @@
g_print ("%s\n",
_("No properties available"));
} else {
- g_print ("%s\n\n",
- _("Properties available in Tracker:"));
+ GList *sorted, *l;
+ gchar **p;
+
+ g_print ("%s:\n",
+ _("Properties available in Tracker"));
+
+ for (p = array; *p; p++) {
+ sorted = g_list_insert_sorted (sorted,
+ *p,
+ (GCompareFunc) strcmp);
+ }
- print_strv (array);
+ for (l = sorted; l; l = g_list_next (l)) {
+ g_print (" %s\n", (const gchar*) l->data);
+ }
+
+ g_list_free (sorted);
g_strfreev (array);
}
}
+
tracker_disconnect (client);
return EXIT_SUCCESS;
Modified: trunk/src/tracker-utils/tracker-tag.c
==============================================================================
--- trunk/src/tracker-utils/tracker-tag.c (original)
+++ trunk/src/tracker-utils/tracker-tag.c Mon Feb 16 17:18:25 2009
@@ -307,8 +307,7 @@
if ((files && list) ||
(files && (!add && !remove && !remove_all))) {
- g_print ("%s:\n",
- _("Tags found"));
+ g_print ("%s:\n", _("Found"));
for (i = 0, j = 0; files_resolved[i] != NULL; i++) {
gchar **tags;
@@ -374,12 +373,37 @@
g_print ("%s\n",
_("No tags found"));
} else {
+ gint length;
+
+ length = g_strv_length (results);
+
+ g_print (g_dngettext (NULL,
+ _("Result: %d"),
+ _("Results: %d"),
+ length),
+ length);
+ g_print ("\n");
+
for (i = 0; results[i] != NULL; i++) {
g_print (" %s\n", results[i]);
}
- }
- g_strfreev (results);
+ if (length >= limit) {
+ /* Display '...' so the user thinks there is
+ * more items.
+ */
+ g_print (" ...\n");
+
+ /* Display warning so the user knows this is
+ * not the WHOLE data set.
+ */
+ g_printerr ("\n"
+ "%s\n",
+ _("NOTE: Limit was reached, there are more items in the database not listed here"));
+ }
+
+ g_strfreev (results);
+ }
}
finish:
Modified: trunk/src/tracker-utils/tracker-unique.c
==============================================================================
--- trunk/src/tracker-utils/tracker-unique.c (original)
+++ trunk/src/tracker-utils/tracker-unique.c Mon Feb 16 17:18:25 2009
@@ -216,8 +216,16 @@
g_print ("%s\n",
_("No results found matching your query"));
} else {
- g_print ("%s:\n",
- _("Results"));
+ gint length;
+
+ length = array->len;
+
+ g_print (g_dngettext (NULL,
+ _("Result: %d"),
+ _("Results: %d"),
+ length),
+ length);
+ g_print ("\n");
g_ptr_array_foreach (array, (GFunc) get_meta_table_data, NULL);
g_ptr_array_free (array, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]