Merge lp:~3v1n0/bamf/libbamf-avoid-closed-views into lp:bamf/0.4

Proposed by Marco Trevisan (Treviño) on 2012-06-13
Status: Merged
Approved by: Łukasz Zemczak on 2012-06-22
Approved revision: 474
Merged at revision: 471
Proposed branch: lp:~3v1n0/bamf/libbamf-avoid-closed-views
Merge into: lp:bamf/0.4
Prerequisite: lp:~3v1n0/bamf/libbamf-sticky-proxy-keep-alive
Diff against target: 116 lines (+33/-16)
4 files modified
lib/libbamf/bamf-matcher.c (+4/-0)
lib/libbamf/bamf-view-private.h (+3/-0)
lib/libbamf/bamf-view.c (+24/-15)
src/bamf-view.c (+2/-1)
To merge this branch: bzr merge lp:~3v1n0/bamf/libbamf-avoid-closed-views
Reviewer Review Type Date Requested Status
Jason Smith (community) 2012-06-13 Approve on 2012-06-20
Review via email: mp+110078@code.launchpad.net

Commit message

BamfMatcher: force a view as closed or not-closed on proper signals.

  This avoids that a view that is opened is actually marked as closed when
  really it's running. Fixes #925421

Description of the change

Sometimes it happens that sticked views are marked as closed even if they're currently running.
This can be caused by the fact that the factory doesn't always call the _bamf_view_set_path function (where the is_closed parameter is set to FALSE) after being (re-)opened.

To prevent this when the matcher records that a view has been opened or closed, we force it as closed through the new private function _bamf_view_set_closed.

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

Works fine when tested with pre-req branch

review: Approve
Unity Merger (unity-merger) wrote :

The prerequisite lp:~3v1n0/bamf/libbamf-sticky-proxy-keep-alive has not yet been merged into lp:bamf.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/libbamf/bamf-matcher.c'
2--- lib/libbamf/bamf-matcher.c 2012-05-24 20:25:51 +0000
3+++ lib/libbamf/bamf-matcher.c 2012-06-14 00:41:19 +0000
4@@ -151,6 +151,8 @@
5 if (!BAMF_IS_VIEW (view))
6 return;
7
8+ /* We manually set the view as not closed, to avoid issues like bug #925421 */
9+ _bamf_view_set_closed (view, FALSE);
10 g_signal_emit (matcher, matcher_signals[VIEW_OPENED], 0, view);
11 }
12
13@@ -168,6 +170,8 @@
14 if (!BAMF_IS_VIEW (view))
15 return;
16
17+ /* We manually set the view as closed, to avoid issues like bug #925421 */
18+ _bamf_view_set_closed (view, TRUE);
19 g_signal_emit (matcher, matcher_signals[VIEW_CLOSED], 0, view);
20 }
21
22
23=== modified file 'lib/libbamf/bamf-view-private.h'
24--- lib/libbamf/bamf-view-private.h 2012-05-24 20:25:51 +0000
25+++ lib/libbamf/bamf-view-private.h 2012-06-14 00:41:19 +0000
26@@ -36,4 +36,7 @@
27 void _bamf_view_set_name (BamfView *view, const char *name);
28
29 void _bamf_view_set_icon (BamfView *view, const char *icon);
30+
31+void _bamf_view_set_closed (BamfView *view, gboolean closed);
32+
33 #endif
34
35=== modified file 'lib/libbamf/bamf-view.c'
36--- lib/libbamf/bamf-view.c 2012-06-14 00:41:19 +0000
37+++ lib/libbamf/bamf-view.c 2012-06-14 00:41:19 +0000
38@@ -557,23 +557,32 @@
39 view->priv->path = NULL;
40 }
41
42+void
43+_bamf_view_set_closed (BamfView *view, gboolean closed)
44+{
45+ BamfViewPrivate *priv;
46+ g_return_if_fail (BAMF_IS_VIEW (view));
47+
48+ priv = view->priv;
49+
50+ if (priv->is_closed != closed)
51+ {
52+ priv->is_closed = closed;
53+
54+ if (closed && priv->cached_children)
55+ {
56+ g_list_free_full (priv->cached_children, g_object_unref);
57+ priv->cached_children = NULL;
58+ }
59+ }
60+}
61+
62 static void
63 bamf_view_on_closed (DBusGProxy *proxy, BamfView *self)
64 {
65- BamfViewPrivate *priv;
66-
67- priv = self->priv;
68-
69- priv->is_closed = TRUE;
70-
71- if (priv->cached_children)
72- {
73- g_list_free_full (priv->cached_children, g_object_unref);
74- priv->cached_children = NULL;
75- }
76+ _bamf_view_set_closed (self, TRUE);
77
78 g_object_ref (self);
79-
80 g_signal_emit (G_OBJECT (self), view_signals[CLOSED], 0);
81 g_object_unref (self);
82 }
83@@ -769,7 +778,8 @@
84 g_return_if_fail (path);
85
86 priv = view->priv;
87- priv->is_closed = FALSE;
88+
89+ _bamf_view_set_closed (view, FALSE);
90
91 if (priv->proxy && g_strcmp0 (priv->path, path) == 0)
92 {
93@@ -1014,8 +1024,7 @@
94 GError *error = NULL;
95
96 priv = self->priv = BAMF_VIEW_GET_PRIVATE (self);
97-
98- priv->is_closed = TRUE;
99+ _bamf_view_set_closed (self, TRUE);
100
101 priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
102 if (priv->connection == NULL)
103
104=== modified file 'src/bamf-view.c'
105--- src/bamf-view.c 2012-04-19 18:01:35 +0000
106+++ src/bamf-view.c 2012-06-14 00:41:19 +0000
107@@ -683,7 +683,8 @@
108 if (g_dbus_interface_skeleton_get_object_path (iface))
109 g_dbus_interface_skeleton_unexport (iface);
110 }
111- g_list_free (ifaces);
112+
113+ g_list_free_full (ifaces, g_object_unref);
114
115 if (priv->name)
116 {

Subscribers

People subscribed via source and target branches