Merge lp:~3v1n0/bamf/desktopless-webapps-fix into lp:bamf/0.4

Proposed by Marco Trevisan (Treviño) on 2012-04-26
Status: Merged
Approved by: Marco Trevisan (Treviño) on 2012-05-22
Approved revision: 470
Merged at revision: 465
Proposed branch: lp:~3v1n0/bamf/desktopless-webapps-fix
Merge into: lp:bamf/0.4
Diff against target: 111 lines (+28/-16)
2 files modified
src/bamf-application.c (+16/-11)
src/bamf-matcher.c (+12/-5)
To merge this branch: bzr merge lp:~3v1n0/bamf/desktopless-webapps-fix
Reviewer Review Type Date Requested Status
Jason Smith (community) 2012-04-26 Approve on 2012-05-22
Review via email: mp+103608@code.launchpad.net

Commit message

BamfMatcher: match chromium web applications with no .desktop file as new applications

Description of the change

Chromium applications with no desktop file are matched as new applications anyway...

To post a comment you must log in.
Jason Smith (jassmith) wrote :

Line 22 of the diff could be after the short circuit to save some spare computations. Other than that, good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/bamf-application.c'
--- src/bamf-application.c 2012-03-16 19:39:34 +0000
+++ src/bamf-application.c 2012-04-26 06:28:24 +0000
@@ -300,17 +300,20 @@
300300
301gboolean301gboolean
302bamf_application_contains_similar_to_window (BamfApplication *self,302bamf_application_contains_similar_to_window (BamfApplication *self,
303 BamfWindow *window)303 BamfWindow *bamf_window)
304{304{
305 gboolean result = FALSE;
306 const char *class, *owned_class;
307 GList *children, *l;305 GList *children, *l;
308 BamfView *child;306 BamfView *child;
309307
310 g_return_val_if_fail (BAMF_IS_APPLICATION (self), FALSE);308 g_return_val_if_fail (BAMF_IS_APPLICATION (self), FALSE);
311 g_return_val_if_fail (BAMF_IS_WINDOW (window), FALSE);309 g_return_val_if_fail (BAMF_IS_WINDOW (bamf_window), FALSE);
312310
313 class = bamf_legacy_window_get_class_name (bamf_window_get_window (window));311 BamfLegacyWindow *window = bamf_window_get_window (bamf_window);
312 const char *window_class = bamf_legacy_window_get_class_name (window);
313 const char *instance_name = bamf_legacy_window_get_class_instance_name (window);
314
315 if (!window_class || !instance_name)
316 return FALSE;
314317
315 children = bamf_view_get_children (BAMF_VIEW (self));318 children = bamf_view_get_children (BAMF_VIEW (self));
316 for (l = children; l; l = l->next)319 for (l = children; l; l = l->next)
@@ -320,16 +323,18 @@
320 if (!BAMF_IS_WINDOW (child))323 if (!BAMF_IS_WINDOW (child))
321 continue;324 continue;
322325
323 owned_class = bamf_legacy_window_get_class_name (bamf_window_get_window (BAMF_WINDOW (child)));326 window = bamf_window_get_window (BAMF_WINDOW (child));
327 const char *owned_win_class = bamf_legacy_window_get_class_name (window);
328 const char *owned_instance = bamf_legacy_window_get_class_instance_name (window);
324329
325 if (g_strcmp0 (class, owned_class) == 0)330 if (g_strcmp0 (window_class, owned_win_class) == 0 &&
331 g_strcmp0 (instance_name, owned_instance) == 0)
326 {332 {
327 result = TRUE;333 return TRUE;
328 break;
329 }334 }
330 }335 }
331336
332 return result;337 return FALSE;
333}338}
334339
335gboolean340gboolean
336341
=== modified file 'src/bamf-matcher.c'
--- src/bamf-matcher.c 2012-04-20 17:36:00 +0000
+++ src/bamf-matcher.c 2012-04-26 06:28:24 +0000
@@ -1528,7 +1528,7 @@
1528is_web_app_window (BamfMatcher *self, BamfLegacyWindow *window)1528is_web_app_window (BamfMatcher *self, BamfLegacyWindow *window)
1529{1529{
1530 const char *window_class = bamf_legacy_window_get_class_name (window);1530 const char *window_class = bamf_legacy_window_get_class_name (window);
1531 const char *instance_name = bamf_legacy_window_get_class_instance_name(window);1531 const char *instance_name = bamf_legacy_window_get_class_instance_name (window);
15321532
1533 // Chrome/Chromium uses url wm_class strings to represent its web apps.1533 // Chrome/Chromium uses url wm_class strings to represent its web apps.
1534 // These apps will still have the same parent pid and hints as the main chrome1534 // These apps will still have the same parent pid and hints as the main chrome
@@ -1541,12 +1541,14 @@
1541 gboolean valid_app = FALSE;1541 gboolean valid_app = FALSE;
15421542
1543 if (g_strcmp0 (window_class, "Google-chrome") == 0 &&1543 if (g_strcmp0 (window_class, "Google-chrome") == 0 &&
1544 g_strcmp0 (instance_name, "google-chrome") != 0)1544 g_strcmp0 (instance_name, "google-chrome") != 0 &&
1545 !g_str_has_prefix (instance_name, "Google-chrome"))
1545 {1546 {
1546 valid_app = TRUE;1547 valid_app = TRUE;
1547 }1548 }
1548 else if (g_strcmp0 (window_class, "Chromium-browser") == 0 &&1549 else if (g_strcmp0 (window_class, "Chromium-browser") == 0 &&
1549 g_strcmp0 (instance_name, "chromium-browser") != 0)1550 g_strcmp0 (instance_name, "chromium-browser") != 0 &&
1551 !g_str_has_prefix (instance_name, "Chromium-browser"))
1550 {1552 {
1551 valid_app = TRUE;1553 valid_app = TRUE;
1552 }1554 }
@@ -1635,11 +1637,16 @@
1635 const char *instance_name = bamf_legacy_window_get_class_instance_name (window);1637 const char *instance_name = bamf_legacy_window_get_class_instance_name (window);
1636 gboolean known_desktop_class = bamf_matcher_has_instance_class_desktop_file (self, instance_name);1638 gboolean known_desktop_class = bamf_matcher_has_instance_class_desktop_file (self, instance_name);
16371639
1640 if (!known_desktop_class)
1641 {
1642 known_desktop_class = is_web_app_window (self, window);
1643 }
1644
1638 if (desktop_file)1645 if (desktop_file)
1639 {1646 {
1640 desktop_class = g_hash_table_lookup (priv->desktop_class_table, desktop_file);1647 desktop_class = g_hash_table_lookup (priv->desktop_class_table, desktop_file);
16411648
1642 if (!known_desktop_class || g_strcmp0 (desktop_class, desktop_file) == 0)1649 if (!known_desktop_class || g_strcmp0 (desktop_class, instance_name) == 0)
1643 {1650 {
1644 desktop_files = g_list_prepend (desktop_files, desktop_file);1651 desktop_files = g_list_prepend (desktop_files, desktop_file);
1645 }1652 }
@@ -1730,7 +1737,7 @@
1730 }1737 }
1731 }1738 }
1732 }1739 }
1733 1740
1734 desktop_files = g_list_insert_before (desktop_files, last, desktop_file);1741 desktop_files = g_list_insert_before (desktop_files, last, desktop_file);
1735 }1742 }
1736 else1743 else

Subscribers

People subscribed via source and target branches