[tracker] tracker-needle: Cleaned up some whitespace issues
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-needle: Cleaned up some whitespace issues
- Date: Sat, 2 Apr 2011 20:18:12 +0000 (UTC)
commit a4510b851d310210aea9a32e59cf8f6df1d2c425
Author: Martyn Russell <martyn lanedo com>
Date: Sat Apr 2 16:49:26 2011 +0100
tracker-needle: Cleaned up some whitespace issues
src/tracker-needle/tracker-needle.vala | 8 +-
src/tracker-needle/tracker-query.vala | 148 +++++++++++++-------------
src/tracker-needle/tracker-result-store.vala | 42 +++-----
src/tracker-needle/tracker-view.vala | 23 ++--
4 files changed, 103 insertions(+), 118 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index 07c09f6..3174c42 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -465,11 +465,11 @@ public class Tracker.Needle {
weak string uri;
model.get (iter, col, out uri);
- if (uri == null) {
- return;
- }
+ if (uri == null) {
+ return;
+ }
- debug ("Selected uri:'%s'", uri);
+ debug ("Selected uri:'%s'", uri);
// Bit of a hack for now if there is no URI scheme, we assume that
// the uri is actually a command line to launch.
diff --git a/src/tracker-needle/tracker-query.vala b/src/tracker-needle/tracker-query.vala
index f92daa2..fcf9863 100644
--- a/src/tracker-needle/tracker-query.vala
+++ b/src/tracker-needle/tracker-query.vala
@@ -34,96 +34,96 @@ public class Tracker.Query {
FOLDERS
}
- private string [] where_clauses = {
- // ALL
- "WHERE {
- ?urn fts:match \"%s\" ;
- nfo:belongsToContainer ?parent ;
- tracker:available true .
- }",
+ private string [] where_clauses = {
+ // ALL
+ "WHERE {
+ ?urn fts:match \"%s\" ;
+ nfo:belongsToContainer ?parent ;
+ tracker:available true .
+ }",
// ALL_ONLY_IN_TITLES
- "WHERE {
- ?urn a nfo:FileDataObject ;
- nfo:belongsToContainer ?parent ;
- tracker:available true .
- FILTER (fn:contains (fn:lower-case (nfo:fileName(?urn)), \"%s\"))
- }",
+ "WHERE {
+ ?urn a nfo:FileDataObject ;
+ nfo:belongsToContainer ?parent ;
+ tracker:available true .
+ FILTER (fn:contains (fn:lower-case (nfo:fileName(?urn)), \"%s\"))
+ }",
// CONTACTS
- "",
+ "",
// APPLICATIONS
- "WHERE {
- ?urn a nfo:Software ;
- fts:match \"%s\"
+ "WHERE {
+ ?urn a nfo:Software ;
+ fts:match \"%s\"
}",
// MUSIC
- "WHERE {
- {
- ?urn nmm:musicAlbum ?match
- } UNION {
- ?urn nmm:performer ?match
- } UNION {
- ?urn a nfo:Audio .
- ?match a nfo:Audio
- FILTER (?urn = ?match)
- }
- ?match fts:match \"%s\" .
- ?urn nmm:performer [ nmm:artistName ?performer ] ;
- nmm:musicAlbum [ nie:title ?album ] ;
- nie:url ?tooltip
+ "WHERE {
+ {
+ ?urn nmm:musicAlbum ?match
+ } UNION {
+ ?urn nmm:performer ?match
+ } UNION {
+ ?urn a nfo:Audio .
+ ?match a nfo:Audio
+ FILTER (?urn = ?match)
+ }
+ ?match fts:match \"%s\" .
+ ?urn nmm:performer [ nmm:artistName ?performer ] ;
+ nmm:musicAlbum [ nie:title ?album ] ;
+ nie:url ?tooltip
}",
// IMAGES
- "WHERE {
- ?urn a nfo:Image ;
- nie:url ?tooltip ;
- fts:match \"%s\"
+ "WHERE {
+ ?urn a nfo:Image ;
+ nie:url ?tooltip ;
+ fts:match \"%s\"
}",
// VIDEOS
- "WHERE {
- ?urn a nfo:Video ;
- nie:url ?tooltip ;
- fts:match \"%s\" .
+ "WHERE {
+ ?urn a nfo:Video ;
+ nie:url ?tooltip ;
+ fts:match \"%s\" .
}",
// DOCUMENTS
- "WHERE {
- ?urn a nfo:Document ;
- nie:url ?tooltip ;
- fts:match \"%s\" .
- OPTIONAL {
- ?urn nco:creator ?creator .
- }
- OPTIONAL {
- ?urn nco:publisher ?publisher .
- }
+ "WHERE {
+ ?urn a nfo:Document ;
+ nie:url ?tooltip ;
+ fts:match \"%s\" .
+ OPTIONAL {
+ ?urn nco:creator ?creator .
+ }
+ OPTIONAL {
+ ?urn nco:publisher ?publisher .
+ }
}",
// MAIL
- "WHERE {
- ?urn a nmo:Email ;
- nmo:from ?sender ;
- nmo:to ?to ;
- fts:match \"%s\" .
+ "WHERE {
+ ?urn a nmo:Email ;
+ nmo:from ?sender ;
+ nmo:to ?to ;
+ fts:match \"%s\" .
}",
// CALENDAR
- "",
+ "",
// FOLDERS
- "WHERE {
- ?urn a nfo:Folder ;
- nie:url ?tooltip ;
- fts:match \"%s\" .
- OPTIONAL {
- ?urn nfo:belongsToContainer ?parent .
- }
+ "WHERE {
+ ?urn a nfo:Folder ;
+ nie:url ?tooltip ;
+ fts:match \"%s\" .
+ OPTIONAL {
+ ?urn nfo:belongsToContainer ?parent .
+ }
}"
- };
+ };
public string criteria { get; set; }
public uint offset { get; set; }
@@ -133,7 +133,6 @@ public class Tracker.Query {
private static Sparql.Connection connection;
public Query () {
-
try {
connection = Sparql.Connection.get ();
} catch (GLib.Error e) {
@@ -141,9 +140,8 @@ public class Tracker.Query {
}
}
- public async uint get_count_async (Type query_type,
- Cancellable? cancellable = null) throws IOError
- requires (connection != null) {
+ public async uint get_count_async (Type query_type, Cancellable? cancellable = null) throws IOError
+ requires (connection != null) {
Sparql.Cursor cursor = null;
if (criteria == null || criteria.length < 1) {
@@ -151,23 +149,21 @@ public class Tracker.Query {
return 0;
}
- string criteria_escaped = Tracker.Sparql.escape_string (criteria);
+ string criteria_escaped = Tracker.Sparql.escape_string (criteria);
- query = "SELECT count(?urn) " + where_clauses[query_type].printf (criteria_escaped);
+ query = "SELECT count(?urn) " + where_clauses[query_type].printf (criteria_escaped);
try {
cursor = yield connection.query_async (query, null);
- yield cursor.next_async ();
+ yield cursor.next_async ();
} catch (GLib.Error e) {
warning ("Could not run Sparql count query: %s", e.message);
- }
+ }
- return (uint) cursor.get_integer (0);
- }
+ return (uint) cursor.get_integer (0);
+ }
- public async Sparql.Cursor? perform_async (Type query_type,
- string [] ?args,
- Cancellable? cancellable = null) throws IOError
+ public async Sparql.Cursor? perform_async (Type query_type, string [] ?args, Cancellable? cancellable = null) throws IOError
requires (connection != null) {
Sparql.Cursor cursor = null;
diff --git a/src/tracker-needle/tracker-result-store.vala b/src/tracker-needle/tracker-result-store.vala
index 87d0482..afc0cfc 100644
--- a/src/tracker-needle/tracker-result-store.vala
+++ b/src/tracker-needle/tracker-result-store.vala
@@ -26,6 +26,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
string [] values;
Gdk.Pixbuf pixbuf;
}
+
private class CategoryNode {
public Tracker.Query.Type type;
public QueryData *query;
@@ -33,10 +34,12 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
public Gdk.Pixbuf pixbuf;
public int count;
}
+
private struct QueryData {
Tracker.Query.Type type;
string [] args;
}
+
private QueryData [] queries;
private GenericArray<CategoryNode> categories;
@@ -44,6 +47,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
public CategoryNode node;
public int offset;
}
+
private GenericArray<Operation> running_operations;
private GenericArray<Operation> delayed_operations;
@@ -56,9 +60,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
set;
}
- private Operation * find_operation (GenericArray<Operation> array,
- CategoryNode *node,
- int offset) {
+ private Operation * find_operation (GenericArray<Operation> array, CategoryNode *node, int offset) {
Operation op;
int i;
@@ -74,8 +76,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
return null;
}
- async void load_operation (Operation op,
- Cancellable? cancellable) {
+ async void load_operation (Operation op, Cancellable? cancellable) {
Tracker.Query query;
Sparql.Cursor cursor = null;
int i;
@@ -150,8 +151,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
}
}
- private void add_operation (CategoryNode cat,
- int offset) {
+ private void add_operation (CategoryNode cat, int offset) {
Operation op = new Operation ();
Operation old;
@@ -164,7 +164,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
}
// If the task is delayed, it will be either pushed
- // to the running queue, or reordered to be processed
+ // to the running queue, or reordered to be processed
// next in the delayed queue.
old = find_operation (delayed_operations, cat, offset);
@@ -187,8 +187,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
}
}
- async void load_category (QueryData *query_data,
- Cancellable? cancellable) {
+ async void load_category (QueryData *query_data, Cancellable? cancellable) {
uint count = 0;
try {
@@ -325,8 +324,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
private set;
}
- private int find_nth_category_index (CategoryNode? node,
- int n) {
+ private int find_nth_category_index (CategoryNode? node, int n) {
int i;
if (node == null) {
@@ -385,8 +383,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
return flags;
}
- public bool get_iter (out Gtk.TreeIter iter,
- Gtk.TreePath path) {
+ public bool get_iter (out Gtk.TreeIter iter, Gtk.TreePath path) {
unowned int [] indices = path.get_indices ();
CategoryNode cat;
int i = 0;
@@ -509,9 +506,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
}
}
- public void get_value (Gtk.TreeIter iter,
- int column,
- out GLib.Value value) {
+ public void get_value (Gtk.TreeIter iter, int column, out GLib.Value value) {
CategoryNode cat;
if (column >= n_columns + n_extra_columns) {
@@ -590,8 +585,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
}
}
- public bool iter_children (out Gtk.TreeIter iter,
- Gtk.TreeIter? parent) {
+ public bool iter_children (out Gtk.TreeIter iter, Gtk.TreeIter? parent) {
CategoryNode cat;
if (parent == null) {
@@ -702,9 +696,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
}
}
- public bool iter_nth_child (out Gtk.TreeIter iter,
- Gtk.TreeIter? parent,
- int n) {
+ public bool iter_nth_child (out Gtk.TreeIter iter, Gtk.TreeIter? parent, int n) {
CategoryNode cat;
if (parent != null) {
@@ -726,8 +718,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
if (queries.length > 1) {
index = find_nth_category_index (null, n);
- if (index < 0 ||
- index >= categories.length) {
+ if (index < 0 || index >= categories.length) {
iter.stamp = 0;
return false;
}
@@ -748,8 +739,7 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
}
}
- public bool iter_parent (out Gtk.TreeIter iter,
- Gtk.TreeIter child) {
+ public bool iter_parent (out Gtk.TreeIter iter, Gtk.TreeIter child) {
if (queries.length > 1 &&
child.user_data2 != null) {
// child within a category
diff --git a/src/tracker-needle/tracker-view.vala b/src/tracker-needle/tracker-view.vala
index 46c5bed..7f06177 100644
--- a/src/tracker-needle/tracker-view.vala
+++ b/src/tracker-needle/tracker-view.vala
@@ -158,7 +158,7 @@ public class Tracker.View : ScrolledWindow {
renderer1.ypad = 5;
col.pack_start (renderer2, true);
- renderer2.set_fixed_height_from_font (2);
+ renderer2.set_fixed_height_from_font (2);
renderer2.ellipsize = Pango.EllipsizeMode.MIDDLE;
col.set_title (_("File"));
@@ -169,7 +169,7 @@ public class Tracker.View : ScrolledWindow {
tv.append_column (col);
var renderer3 = new Gtk.CellRendererText ();
- renderer3.set_fixed_height_from_font (2);
+ renderer3.set_fixed_height_from_font (2);
col = new TreeViewColumn ();
col.set_sizing (TreeViewColumnSizing.AUTOSIZE);
col.pack_start (renderer3, true);
@@ -178,7 +178,7 @@ public class Tracker.View : ScrolledWindow {
tv.append_column (col);
var renderer4 = new Gtk.CellRendererText ();
- renderer4.set_fixed_height_from_font (2);
+ renderer4.set_fixed_height_from_font (2);
col = new TreeViewColumn ();
col.set_sizing (TreeViewColumnSizing.AUTOSIZE);
col.pack_start (renderer4, true);
@@ -201,8 +201,8 @@ public class Tracker.View : ScrolledWindow {
tv.set_headers_visible (false);
tv.set_show_expanders (false);
- selection = tv.get_selection ();
- selection.set_select_function (row_selection_func);
+ selection = tv.get_selection ();
+ selection.set_select_function (row_selection_func);
col = new TreeViewColumn ();
col.set_sizing (TreeViewColumnSizing.FIXED);
@@ -218,7 +218,7 @@ public class Tracker.View : ScrolledWindow {
var renderer2 = new Gtk.CellRendererText ();
col.pack_start (renderer2, true);
col.set_cell_data_func (renderer2, text_renderer_func);
- renderer2.set_fixed_height_from_font (2);
+ renderer2.set_fixed_height_from_font (2);
renderer2.ellipsize = Pango.EllipsizeMode.MIDDLE;
//col.set_resizable (true);
@@ -233,18 +233,17 @@ public class Tracker.View : ScrolledWindow {
// col.set_cell_data_func (renderer3, cell_renderer_func);
// tv.append_column (col);
- var renderer4 = new Gtk.CellRendererText ();
-
- renderer4.set_fixed_height_from_font (2);
+ var renderer4 = new Gtk.CellRendererText ();
+ renderer4.set_fixed_height_from_font (2);
renderer4.alignment = Pango.Alignment.RIGHT;
renderer4.xalign = 1;
col = new TreeViewColumn ();
col.set_min_width (80);
- col.set_sizing (TreeViewColumnSizing.FIXED);
- col.pack_start (renderer4, true);
+ col.set_sizing (TreeViewColumnSizing.FIXED);
+ col.pack_start (renderer4, true);
col.set_cell_data_func (renderer4, category_detail_renderer_func);
- tv.append_column (col);
+ tv.append_column (col);
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]