[tracker/libtracker-sparql-porting: 37/42] tracker-utils: Fixed whitespace problems in tracker-info.c



commit 83a2c89a2bda1b1c7a8bae94daa4198c9b0c5094
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Aug 6 16:20:39 2010 +0200

    tracker-utils: Fixed whitespace problems in tracker-info.c

 src/tracker-utils/tracker-info.c |  126 +++++++++++++++++++-------------------
 1 files changed, 62 insertions(+), 64 deletions(-)
---
diff --git a/src/tracker-utils/tracker-info.c b/src/tracker-utils/tracker-info.c
index c406c9a..7779e50 100644
--- a/src/tracker-utils/tracker-info.c
+++ b/src/tracker-utils/tracker-info.c
@@ -30,10 +30,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" \
@@ -61,7 +61,7 @@ static GOptionEntry entries[] = {
 
 static gchar *
 get_shorthand (GHashTable  *prefixes,
-	       const gchar *namespace)
+               const gchar *namespace)
 {
 	gchar *hash;
 
@@ -104,14 +104,14 @@ static GHashTable *
 get_prefixes (TrackerSparqlConnection *connection)
 {
 	TrackerSparqlCursor *cursor;
-        GError *error = NULL;
+	GError *error = NULL;
 	GHashTable *retval;
 	const gchar *query;
 
 	retval = g_hash_table_new_full (g_str_hash,
-					g_str_equal,
-					NULL,
-					NULL);
+	                                g_str_equal,
+	                                NULL,
+	                                NULL);
 
 	/* FIXME: Would like to get this in the same SPARQL that we
 	 * use to get the info, but doesn't seem possible at the
@@ -119,31 +119,31 @@ get_prefixes (TrackerSparqlConnection *connection)
 	 * support in SPARQL.
 	 */
 	query = "SELECT ?ns ?prefix "
-		"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);
 
-        while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
-                const gchar *key, *value;
+	while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
+		const gchar *key, *value;
 
-                key = tracker_sparql_cursor_get_string (cursor, 0, NULL);
-                value = tracker_sparql_cursor_get_string (cursor, 1, NULL);
+		key = tracker_sparql_cursor_get_string (cursor, 0, NULL);
+		value = tracker_sparql_cursor_get_string (cursor, 1, NULL);
 
-                if (!key || !value) {
-                        continue;
-                }
+		if (!key || !value) {
+			continue;
+		}
 
-                g_hash_table_insert (retval,
-                                     g_strndup (key, strlen (key) - 1),
-                                     g_strdup (value));
-        }
+		g_hash_table_insert (retval,
+		                     g_strndup (key, strlen (key) - 1),
+		                     g_strdup (value));
+	}
 
-        if (cursor) {
-                g_object_unref (cursor);
-        }
+	if (cursor) {
+		g_object_unref (cursor);
+	}
 
 	return retval;
 }
@@ -153,7 +153,7 @@ main (int argc, char **argv)
 {
 	TrackerSparqlConnection *connection;
 	GOptionContext *context;
-        GError *error = NULL;
+	GError *error = NULL;
 	GHashTable *prefixes;
 	gchar **p;
 
@@ -220,9 +220,7 @@ main (int argc, char **argv)
 		gchar *query;
 		gchar *urn;
 
-		g_print ("%s:'%s'\n",
-		         _("Querying information for entity"),
-		         *p);
+		g_print ("%s:'%s'\n", _("Querying information for entity"), *p);
 
 		/* support both, URIs and local file paths */
 		if (has_valid_uri_scheme (*p)) {
@@ -237,7 +235,7 @@ main (int argc, char **argv)
 
 		/* First check whether there's some entity with nie:url like this */
 		query = g_strdup_printf ("SELECT ?urn WHERE { ?urn nie:url \"%s\" }", uri);
-                cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
+		cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
 		g_free (query);
 
 		if (error) {
@@ -253,25 +251,25 @@ main (int argc, char **argv)
 			/* No URN matches, use uri as URN */
 			urn = g_strdup (uri);
 		} else {
-                        if (!tracker_sparql_cursor_next (cursor, NULL, NULL)) {
-                                g_printerr ("  %s, %s\n",
-                                            _("Unable to retrieve data for URI"),
-                                            _("No error given"));
+			if (!tracker_sparql_cursor_next (cursor, NULL, NULL)) {
+				g_printerr ("  %s, %s\n",
+				            _("Unable to retrieve data for URI"),
+				            _("No error given"));
 
-                                g_free (uri);
-                                g_object_unref (cursor);
-                                continue;
-                        }
+				g_free (uri);
+				g_object_unref (cursor);
+				continue;
+			}
 
-                        urn = g_strdup (tracker_sparql_cursor_get_string (cursor, 0, NULL));
-                        g_print ("  '%s'\n", urn);
+			urn = g_strdup (tracker_sparql_cursor_get_string (cursor, 0, NULL));
+			g_print ("  '%s'\n", urn);
 
-                        g_object_unref (cursor);
+			g_object_unref (cursor);
 		}
 
 		query = g_strdup_printf ("SELECT ?predicate ?object WHERE { <%s> ?predicate ?object }", urn);
 
-                cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
+		cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
 
 		g_free (uri);
 		g_free (query);
@@ -289,35 +287,35 @@ main (int argc, char **argv)
 			g_print ("  %s\n",
 			         _("No metadata available for that URI"));
 		} else {
-                        g_print ("%s:\n", _("Results"));
+			g_print ("%s:\n", _("Results"));
 
-                        while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
-                                const gchar *key = tracker_sparql_cursor_get_string (cursor, 0, NULL);
-                                const gchar *value = tracker_sparql_cursor_get_string (cursor, 1, NULL);
+			while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
+				const gchar *key = tracker_sparql_cursor_get_string (cursor, 0, NULL);
+				const gchar *value = tracker_sparql_cursor_get_string (cursor, 1, NULL);
 
-                                if (!key || !value) {
-                                        continue;
-                                }
+				if (!key || !value) {
+					continue;
+				}
 
-                                /* Don't display nie:plainTextContent */
-                                if (strcmp (key, "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent";) == 0) {
-                                        continue;
-                                }
+				/* Don't display nie:plainTextContent */
+				if (strcmp (key, "http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent";) == 0) {
+					continue;
+				}
 
-                                if (G_UNLIKELY (full_namespaces)) {
-                                        g_print ("  '%s' = '%s'\n", key, value);
-                                } else {
-                                        gchar *shorthand;
+				if (G_UNLIKELY (full_namespaces)) {
+					g_print ("  '%s' = '%s'\n", key, value);
+				} else {
+					gchar *shorthand;
 
-                                        shorthand = get_shorthand (prefixes, key);
-                                        g_print ("  '%s' = '%s'\n", shorthand, value);
-                                        g_free (shorthand);
-                                }
-                        }
+					shorthand = get_shorthand (prefixes, key);
+					g_print ("  '%s' = '%s'\n", shorthand, value);
+					g_free (shorthand);
+				}
+			}
 
-                        g_print ("\n");
+			g_print ("\n");
 
-                        g_object_unref (cursor);
+			g_object_unref (cursor);
 		}
 
 		g_print ("\n");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]