Merge lp:~3v1n0/bamf/new-desktop-rematch into lp:bamf/0.4

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 481
Merged at revision: 467
Proposed branch: lp:~3v1n0/bamf/new-desktop-rematch
Merge into: lp:bamf/0.4
Diff against target: 49 lines (+32/-0)
1 file modified
src/bamf-matcher.c (+32/-0)
To merge this branch: bzr merge lp:~3v1n0/bamf/new-desktop-rematch
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+106859@code.launchpad.net

Commit message

BamfMatcher: when a new .desktop file is added, try to rematch it to opened applications

Description of the change

Now, when a new .desktop file is added to the monitored folders bamf tries to match it to one of the windows we have that has not a .desktop file associated.

This fixes desktopless newly created Chromium apps.

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

Looks good, instead of l and ll can you pick more meaningful names? The nesting makes it confusing.

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/bamf-matcher.c'
2--- src/bamf-matcher.c 2012-05-22 16:19:49 +0000
3+++ src/bamf-matcher.c 2012-05-22 17:06:20 +0000
4@@ -2247,6 +2247,8 @@
5 bamf_matcher_load_desktop_file (BamfMatcher * self,
6 const char * desktop_file)
7 {
8+ GList *vl, *wl;
9+
10 g_return_if_fail (BAMF_IS_MATCHER (self));
11
12 load_desktop_file_to_table (self,
13@@ -2254,6 +2256,36 @@
14 self->priv->desktop_file_table,
15 self->priv->desktop_id_table,
16 self->priv->desktop_class_table);
17+
18+ /* If an application with no .desktop file has windows that matches
19+ * the new added .desktop file, then we try to re-match them. */
20+ for (vl = self->priv->views; vl; vl = vl->next)
21+ {
22+ if (!BAMF_IS_APPLICATION (vl->data))
23+ continue;
24+
25+ BamfApplication *app = BAMF_APPLICATION (vl->data);
26+
27+ if (!bamf_application_get_desktop_file (app))
28+ {
29+ GList *children = bamf_view_get_children (BAMF_VIEW (app));
30+
31+ for (wl = children; wl; wl = wl->next)
32+ {
33+ if (!BAMF_IS_WINDOW (wl->data))
34+ continue;
35+
36+ BamfWindow *win = BAMF_WINDOW (wl->data);
37+ GList *desktops = bamf_matcher_possible_applications_for_window (self, win, NULL);
38+
39+ if (g_list_find_custom (desktops, desktop_file, (GCompareFunc) g_strcmp0))
40+ {
41+ BamfLegacyWindow *legacy_window = bamf_window_get_window (win);
42+ bamf_legacy_window_reopen (legacy_window);
43+ }
44+ }
45+ }
46+ }
47 }
48
49 void

Subscribers

People subscribed via source and target branches