Skip to content

Commit

Permalink
Couple of fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mhr3 committed Sep 18, 2011
1 parent 9a2715d commit 4bdaec2
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/plugins/hybrid-search-plugin.vala
Expand Up @@ -110,13 +110,13 @@ namespace Synapse
data_sink.search_done["SynapseZeitgeistPlugin"].connect (this.zg_plugin_search_done);
}

private const string RECENT_XML_NAME = ".recently-used.xbel";
private const string RECENT_XML_NAME = "recently-used.xbel";
private const int MAX_RECENT_DIRS = 10;

private async void analyze_recent_documents ()
{
var recent = File.new_for_path (Path.build_filename (
Environment.get_home_dir (), RECENT_XML_NAME, null));
Environment.get_home_dir (), "." + RECENT_XML_NAME, null));

try
{
Expand Down Expand Up @@ -206,7 +206,7 @@ namespace Synapse
}
catch (Error err)
{
Utils.Logger.warning (this, "Unable to parse ~/%s", RECENT_XML_NAME);
Utils.Logger.warning (this, "Unable to parse %s", recent.get_path ());
}

initialization_done = true;
Expand Down
54 changes: 45 additions & 9 deletions src/plugins/zeitgeist-related.vala
Expand Up @@ -131,27 +131,63 @@ namespace Synapse
{
Event e;
Subject s;
if (!(m is UriMatch)) return null;

var um = m as UriMatch;
Utils.Logger.debug (this, "searching for items related to %s", um.uri);
if (!(m is UriMatch) && !(m is ApplicationMatch)) return null;

GenericArray<Event> templates = new GenericArray<Event> ();
PtrArray event_templates = new PtrArray ();
PtrArray result_templates = new PtrArray ();

s = new Subject ();
s.set_uri (um.uri);
e = new Event ();
e.add_subject (s);
if (m is UriMatch)
{
var um = m as UriMatch;
Utils.Logger.debug (this, "searching for items related to %s", um.uri);

s = new Subject ();
s.set_uri (um.uri);
e = new Event ();
e.add_subject (s);
}
else if (m is ApplicationMatch)
{
string app_id;
var app_info = (m as ApplicationMatch).app_info;
if (app_info != null)
{
app_id = app_info.get_id () ?? "";
if (app_id == "" && app_info is DesktopAppInfo)
{
app_id = (app_info as DesktopAppInfo).get_filename () ?? "";
app_id = Path.get_basename (app_id);
}
}
else
{
app_id = Path.get_basename ((m as ApplicationMatch).filename);
}

if (app_id == null || app_id == "")
{
Utils.Logger.warning (this, "Unable to extract application id!");
return null;
}

app_id = "application://" + app_id;
Utils.Logger.debug (this, "searching for items related to %s", app_id);

e = new Event ();
e.set_actor (app_id);
}
else return null;

templates.add (e);
event_templates.add (e);

try
{
string[] uris;
uris = yield zg_log.find_related_uris (new TimeRange.anytime (),
int64 end = Zeitgeist.Timestamp.now ();
int64 start = end - Zeitgeist.Timestamp.WEEK * 8;
uris = yield zg_log.find_related_uris (new TimeRange (start, end),
(owned) event_templates, (owned) result_templates,
StorageState.ANY, q.max_results, ResultType.MOST_RECENT_EVENTS,
q.cancellable);
Expand Down
5 changes: 3 additions & 2 deletions src/ui/widgets.vala
Expand Up @@ -1045,10 +1045,11 @@ namespace Synapse.Gui
artists += "Ian Cylkowski <designbyizo@gmail.com>";
GLib.Object (artists : artists,
authors : devs,
copyright : "Copyright (C) 2010 Michal Hruby <michal.mhr@gmail.com>",
copyright : "Copyright (C) 2010-2011 Michal Hruby <michal.mhr@gmail.com>\nAlberto Aldegheri <albyrock87+dev@gmail.com>",
program_name: "Synapse",
logo_icon_name : "synapse",
version: Config.VERSION);
version: Config.VERSION,
website: "http://launchpad.net/synapse-project");
}
}

Expand Down

0 comments on commit 4bdaec2

Please sign in to comment.