Merge lp:~larsu/indicator-messages/fix-blacklist-again into lp:indicator-messages/0.3

Proposed by Lars Karlitski on 2012-04-04
Status: Merged
Approved by: Charles Kerr on 2012-04-04
Approved revision: 265
Merged at revision: 264
Proposed branch: lp:~larsu/indicator-messages/fix-blacklist-again
Merge into: lp:indicator-messages/0.3
Diff against target: 63 lines (+45/-1)
1 file modified
src/messages-service.c (+45/-1)
To merge this branch: bzr merge lp:~larsu/indicator-messages/fix-blacklist-again
Reviewer Review Type Date Requested Status
Charles Kerr (community) 2012-04-04 Approve on 2012-04-04
Review via email: mp+100750@code.launchpad.net

Description of the change

Revert blacklisting to make thunderbird work again, while keeping linking and copying into the blacklist working.

The long-term fix for this is to use GSettings, which we can't right now because GSettings lists can't be merged when upgrading.

To post a comment you must log in.
265. By Lars Karlitski on 2012-04-04

messages-service.c: fix leak

Charles Kerr (charlesk) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/messages-service.c'
2--- src/messages-service.c 2012-03-21 20:23:57 +0000
3+++ src/messages-service.c 2012-04-04 14:53:26 +0000
4@@ -321,14 +321,58 @@
5 return desktopfile;
6 }
7
8+/* Check if path is a symlink and return its target if it is */
9+static gchar *
10+get_symlink_target (const gchar *path)
11+{
12+ GFile *file;
13+ GFileInfo *fileinfo;
14+ gchar *target = NULL;
15+
16+ file = g_file_new_for_path (path);
17+
18+ fileinfo = g_file_query_info (file, "standard::is-symlink",
19+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
20+ NULL, NULL);
21+ g_object_unref (file);
22+
23+ if (!fileinfo)
24+ return NULL;
25+
26+ if (g_file_info_get_is_symlink (fileinfo))
27+ target = g_strdup (g_file_info_get_symlink_target (fileinfo));
28+
29+ g_object_unref (fileinfo);
30+ return target;
31+}
32+
33 /* Add a definition file into the black list and eclipse
34 any launchers that have the same file. */
35 static gboolean
36 blacklist_add (gpointer udata)
37 {
38 gchar * definition_file = (gchar *)udata;
39+ gchar * symlink_target = get_symlink_target (definition_file);
40+ gchar * contents = NULL;
41
42- blacklist_add_core(definition_file, definition_file);
43+ if (symlink_target)
44+ {
45+ blacklist_add_core (symlink_target, definition_file);
46+ g_free (symlink_target);
47+ }
48+ else if (g_str_has_suffix (definition_file, ".desktop"))
49+ {
50+ blacklist_add_core(definition_file, definition_file);
51+ }
52+ else if (g_file_get_contents (definition_file, &contents, NULL, NULL))
53+ {
54+ gchar *trimmed = pango_trim_string (contents);
55+ blacklist_add_core (trimmed, definition_file);
56+ g_free (trimmed);
57+ g_free (contents);
58+ }
59+ else
60+ g_warning ("invalid blacklist entry: %s", definition_file);
61
62 return FALSE;
63 }

Subscribers

People subscribed via source and target branches