2
* Copyright (C) 2006, Jamie McCracken <jamiemcc@gnome.org>
3
* Copyright (C) 2008, Nokia <ivan.frade@nokia.com>
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* General Public License for more details.
15
* You should have received a copy of the GNU Library General Public
16
* License along with this library; if not, write to the
17
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA.
29
#include <glib/gi18n.h>
31
#include <libtracker-sparql/tracker-sparql.h>
34
"Tracker " PACKAGE_VERSION "\n"
37
"This program is free software and comes without any warranty.\n" \
38
"It is licensed under version 2 or later of the General Public " \
39
"License which can be viewed at:\n" \
41
" http://www.gnu.org/licenses/gpl.txt\n"
43
static gboolean print_version;
45
static GOptionEntry entries[] = {
46
{ "version", 'V', 0, G_OPTION_ARG_NONE, &print_version,
54
main (int argc, char **argv)
56
TrackerSparqlConnection *connection;
57
TrackerSparqlCursor *cursor;
58
GOptionContext *context;
61
setlocale (LC_ALL, "");
63
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
64
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
65
textdomain (GETTEXT_PACKAGE);
67
/* Translators: this messagge will apper immediately after the */
68
/* usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE> */
69
context = g_option_context_new (_(" - Show statistics for all Nepomuk defined ontology classes"));
70
g_option_context_add_main_entries (context, entries, NULL);
71
g_option_context_parse (context, &argc, &argv, NULL);
74
g_print ("\n" ABOUT "\n" LICENSE "\n");
75
g_option_context_free (context);
80
g_option_context_free (context);
84
if (!g_thread_supported ()) {
88
connection = tracker_sparql_connection_get (NULL, &error);
91
g_printerr ("%s: %s\n",
92
_("Could not establish a connection to Tracker"),
93
error ? error->message : _("No error given"));
94
g_clear_error (&error);
98
cursor = tracker_sparql_connection_statistics (connection, NULL, &error);
101
g_printerr ("%s, %s\n",
102
_("Could not get Tracker statistics"),
104
g_error_free (error);
109
g_print ("%s\n", _("No statistics available"));
113
g_print ("%s\n", _("Statistics:"));
115
while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
116
g_print (" %s = %s\n",
117
tracker_sparql_cursor_get_string (cursor, 0, NULL),
118
tracker_sparql_cursor_get_string (cursor, 1, NULL));
123
g_print (" %s\n", _("None"));
128
g_object_unref (cursor);
131
g_object_unref (connection);