[tracker/libtracker-sparql-porting: 37/46] tracker-utils: Whitespace fixes for tracker-sparql.c
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/libtracker-sparql-porting: 37/46] tracker-utils: Whitespace fixes for tracker-sparql.c
- Date: Fri, 13 Aug 2010 08:48:03 +0000 (UTC)
commit 2144f43caacec8431d0800738432b23d9e805805
Author: Philip Van Hoof <philip codeminded be>
Date: Fri Aug 6 16:53:44 2010 +0200
tracker-utils: Whitespace fixes for tracker-sparql.c
src/tracker-utils/tracker-sparql.c | 151 ++++++++++++++++++------------------
1 files changed, 74 insertions(+), 77 deletions(-)
---
diff --git a/src/tracker-utils/tracker-sparql.c b/src/tracker-utils/tracker-sparql.c
index 5de9358..5fcba98 100644
--- a/src/tracker-utils/tracker-sparql.c
+++ b/src/tracker-utils/tracker-sparql.c
@@ -29,10 +29,10 @@
#include <libtracker-sparql/tracker-sparql.h>
-#define ABOUT \
+#define ABOUT \
"Tracker " PACKAGE_VERSION "\n"
-#define LICENSE \
+#define LICENSE \
"This program is free software and comes without any warranty.\n" \
"It is licensed under version 2 or later of the General Public " \
"License which can be viewed at:\n" \
@@ -128,18 +128,18 @@ get_class_from_prefix (TrackerSparqlConnection *connection,
return NULL;
}
- while (tracker_sparql_cursor_next (cursor, NULL, NULL) && !found) {
+ while (tracker_sparql_cursor_next (cursor, NULL, NULL) && !found) {
const gchar *class_prefix, *class_name;
- class_prefix = tracker_sparql_cursor_get_string (cursor, 0, NULL);
- class_name = tracker_sparql_cursor_get_string (cursor, 1, NULL);
+ class_prefix = tracker_sparql_cursor_get_string (cursor, 0, NULL);
+ class_name = tracker_sparql_cursor_get_string (cursor, 1, NULL);
if (strcmp (class_prefix, prefix) == 0) {
found = g_strdup (class_name);
}
}
- g_object_unref (cursor);
+ g_object_unref (cursor);
return found;
}
@@ -150,13 +150,13 @@ parse_list_notifies (const gchar *option_name,
gpointer data,
GError **error)
{
- if (!value) {
- list_notifies = g_strdup ("");
- } else {
- list_notifies = g_strdup (value);
- }
+ if (!value) {
+ list_notifies = g_strdup ("");
+ } else {
+ list_notifies = g_strdup (value);
+ }
- return TRUE;
+ return TRUE;
}
static void
@@ -165,58 +165,55 @@ print_cursor (TrackerSparqlCursor *cursor,
const gchar *heading,
gboolean only_first_col)
{
- if (!cursor) {
- g_print ("%s\n", none_found);
- } else {
- gint count = 0;
-
- g_print ("%s:\n", heading);
-
- if (only_first_col) {
- while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
- g_print (" %s\n",
- tracker_sparql_cursor_get_string (cursor, 0, NULL));
- count++;
- }
- } else {
- gint n_cols;
-
- n_cols = tracker_sparql_cursor_get_n_columns (cursor);
-
- while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
- gint col;
-
- for (col = 0; col < n_cols; col++) {
- if (col == 0) {
- g_print (" %s",
- tracker_sparql_cursor_get_string (cursor, col, NULL));
- } else {
- g_print (", %s",
- tracker_sparql_cursor_get_string (cursor, col, NULL));
- }
- }
-
- g_print ("\n");
-
- count++;
- }
- }
-
- if (count == 0) {
- g_print (" %s\n", _("None"));
- }
-
- g_print ("\n");
-
- g_object_unref (cursor);
- }
+ if (!cursor) {
+ g_print ("%s\n", none_found);
+ } else {
+ gint count = 0;
+
+ g_print ("%s:\n", heading);
+
+ if (only_first_col) {
+ while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
+ g_print (" %s\n", tracker_sparql_cursor_get_string (cursor, 0, NULL));
+ count++;
+ }
+ } else {
+ gint n_cols;
+
+ n_cols = tracker_sparql_cursor_get_n_columns (cursor);
+
+ while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
+ gint col;
+
+ for (col = 0; col < n_cols; col++) {
+ if (col == 0) {
+ g_print (" %s", tracker_sparql_cursor_get_string (cursor, col, NULL));
+ } else {
+ g_print (", %s", tracker_sparql_cursor_get_string (cursor, col, NULL));
+ }
+ }
+
+ g_print ("\n");
+
+ count++;
+ }
+ }
+
+ if (count == 0) {
+ g_print (" %s\n", _("None"));
+ }
+
+ g_print ("\n");
+
+ g_object_unref (cursor);
+ }
}
int
main (int argc, char **argv)
{
TrackerSparqlConnection *connection;
- TrackerSparqlCursor *cursor;
+ TrackerSparqlCursor *cursor;
GOptionContext *context;
GError *error = NULL;
const gchar *error_message;
@@ -283,7 +280,7 @@ main (int argc, char **argv)
const gchar *query;
query = "SELECT ?c WHERE { ?c a rdfs:Class }";
- cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
+ cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
if (error) {
g_printerr ("%s, %s\n",
@@ -295,19 +292,19 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
- print_cursor (cursor, _("No classes were found"), _("Classes"), TRUE);
+ print_cursor (cursor, _("No classes were found"), _("Classes"), TRUE);
}
if (list_class_prefixes) {
const gchar *query;
query = "SELECT ?prefix ?ns "
- "WHERE {"
- " ?ns a tracker:Namespace ;"
- " tracker:prefix ?prefix "
- "}";
+ "WHERE {"
+ " ?ns a tracker:Namespace ;"
+ " tracker:prefix ?prefix "
+ "}";
- cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
+ cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
if (error) {
g_printerr ("%s, %s\n",
@@ -319,7 +316,7 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
- print_cursor (cursor, _("No class prefixes were found"), _("Prefixes"), FALSE);
+ print_cursor (cursor, _("No class prefixes were found"), _("Prefixes"), FALSE);
}
if (list_properties) {
@@ -372,7 +369,7 @@ main (int argc, char **argv)
"}",
class_name);
- cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
+ cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
g_free (query);
g_free (class_name);
@@ -386,7 +383,7 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
- print_cursor (cursor, _("No properties were found"), _("Properties"), TRUE);
+ print_cursor (cursor, _("No properties were found"), _("Properties"), TRUE);
}
if (list_notifies) {
@@ -409,7 +406,7 @@ main (int argc, char **argv)
list_notifies);
}
- cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
+ cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
g_free (query);
if (error) {
@@ -422,7 +419,7 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
- print_cursor (cursor, _("No notifies were found"), _("Notifies"), TRUE);
+ print_cursor (cursor, _("No notifies were found"), _("Notifies"), TRUE);
}
if (search) {
@@ -435,7 +432,7 @@ main (int argc, char **argv)
" FILTER regex (?c, \"%s\", \"i\") "
"}",
search);
- cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
+ cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
g_free (query);
if (error) {
@@ -448,7 +445,7 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
- print_cursor (cursor, _("No classes were found to match search term"), _("Classes"), TRUE);
+ print_cursor (cursor, _("No classes were found to match search term"), _("Classes"), TRUE);
/* Second list properties */
query = g_strdup_printf ("SELECT ?p "
@@ -458,7 +455,7 @@ main (int argc, char **argv)
"}",
search);
- cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
+ cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
g_free (query);
if (error) {
@@ -471,7 +468,7 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
- print_cursor (cursor, _("No properties were found to match search term"), _("Properties"), TRUE);
+ print_cursor (cursor, _("No properties were found to match search term"), _("Properties"), TRUE);
}
if (file) {
@@ -519,7 +516,7 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
- g_print ("%s\n", _("Done"));
+ g_print ("%s\n", _("Done"));
#if 0
if (results) {
@@ -550,7 +547,7 @@ main (int argc, char **argv)
}
#endif
} else {
- cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
+ cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
if (error) {
g_printerr ("%s, %s\n",
@@ -561,7 +558,7 @@ main (int argc, char **argv)
return EXIT_FAILURE;
}
- print_cursor (cursor, _("No results found matching your query"), _("Results"), FALSE);
+ print_cursor (cursor, _("No results found matching your query"), _("Results"), FALSE);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]