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

Proposed by Lars Karlitski
Status: Merged
Approved by: Charles Kerr
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) Approve
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

messages-service.c: fix leak

Revision history for this message
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
=== modified file 'src/messages-service.c'
--- src/messages-service.c 2012-03-21 20:23:57 +0000
+++ src/messages-service.c 2012-04-04 14:53:26 +0000
@@ -321,14 +321,58 @@
321 return desktopfile;321 return desktopfile;
322}322}
323323
324/* Check if path is a symlink and return its target if it is */
325static gchar *
326get_symlink_target (const gchar *path)
327{
328 GFile *file;
329 GFileInfo *fileinfo;
330 gchar *target = NULL;
331
332 file = g_file_new_for_path (path);
333
334 fileinfo = g_file_query_info (file, "standard::is-symlink",
335 G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
336 NULL, NULL);
337 g_object_unref (file);
338
339 if (!fileinfo)
340 return NULL;
341
342 if (g_file_info_get_is_symlink (fileinfo))
343 target = g_strdup (g_file_info_get_symlink_target (fileinfo));
344
345 g_object_unref (fileinfo);
346 return target;
347}
348
324/* Add a definition file into the black list and eclipse349/* Add a definition file into the black list and eclipse
325 any launchers that have the same file. */350 any launchers that have the same file. */
326static gboolean351static gboolean
327blacklist_add (gpointer udata)352blacklist_add (gpointer udata)
328{353{
329 gchar * definition_file = (gchar *)udata;354 gchar * definition_file = (gchar *)udata;
355 gchar * symlink_target = get_symlink_target (definition_file);
356 gchar * contents = NULL;
330357
331 blacklist_add_core(definition_file, definition_file);358 if (symlink_target)
359 {
360 blacklist_add_core (symlink_target, definition_file);
361 g_free (symlink_target);
362 }
363 else if (g_str_has_suffix (definition_file, ".desktop"))
364 {
365 blacklist_add_core(definition_file, definition_file);
366 }
367 else if (g_file_get_contents (definition_file, &contents, NULL, NULL))
368 {
369 gchar *trimmed = pango_trim_string (contents);
370 blacklist_add_core (trimmed, definition_file);
371 g_free (trimmed);
372 g_free (contents);
373 }
374 else
375 g_warning ("invalid blacklist entry: %s", definition_file);
332376
333 return FALSE;377 return FALSE;
334}378}

Subscribers

People subscribed via source and target branches