Merge lp:~om26er/ubuntu/natty/unity/unity-fix-761409 into lp:~ubuntu-desktop/unity/natty

Proposed by Omer Akram
Status: Merged
Merged at revision: 467
Proposed branch: lp:~om26er/ubuntu/natty/unity/unity-fix-761409
Merge into: lp:~ubuntu-desktop/unity/natty
Diff against target: 196 lines (+68/-12)
4 files modified
debian/changelog (+12/-2)
src/IndicatorObjectEntryProxyRemote.cpp (+1/-1)
src/PanelTray.cpp (+50/-7)
src/PanelTray.h (+5/-2)
To merge this branch: bzr merge lp:~om26er/ubuntu/natty/unity/unity-fix-761409
Reviewer Review Type Date Requested Status
Bryce Harrington Approve
Didier Roche-Tolomelli Pending
Review via email: mp+74009@code.launchpad.net

Description of the change

backport the fix for bug 761409 the fix also went into lp:unity/3.0 but we are not sure when that release will happen.

To post a comment you must log in.
469. By Omer Akram

fix for lp: 816632

470. By Omer Akram

fix

Revision history for this message
Bryce Harrington (bryce) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-08-10 10:27:20 +0000
3+++ debian/changelog 2011-09-05 19:31:25 +0000
4@@ -1,9 +1,19 @@
5-unity (3.8.16-0ubuntu1~natty1.1) natty-proposed; urgency=low
6+unity (3.8.16-0ubuntu1~natty3) natty-proposed; urgency=low
7+
8+ * src/PanelTray.cpp:
9+ * src/PanelTray.h:
10+ - make systray behave nice when the whitelist is on (LP: #761409)
11+ * src/IndicatorObjectEntryProxyRemote.cpp:
12+ - Fix leak of GMemoryInputStream. (thx hyperair) (LP: #816632)
13+
14+ -- Omer Akram <om26er@ubuntu.com> Tue, 06 Sep 2011 00:09:33 +0500
15+
16+unity (3.8.16-0ubuntu1~natty2) natty-proposed; urgency=low
17
18 * src/Launcher.cpp:
19 - Launcher does not autohide after drag in Qt apps. (LP: #769703)
20
21- -- Omer Akram <om26er@ubuntu.com> Wed, 10 Aug 2011 15:24:51 +0500
22+ -- Omer Akram <om26er@ubuntu.com> Mon, 15 Aug 2011 16:26:52 +0500
23
24 unity (3.8.16-0ubuntu1~natty1) natty-proposed; urgency=low
25
26
27=== modified file 'src/IndicatorObjectEntryProxyRemote.cpp'
28--- src/IndicatorObjectEntryProxyRemote.cpp 2011-04-08 07:53:45 +0000
29+++ src/IndicatorObjectEntryProxyRemote.cpp 2011-09-05 19:31:25 +0000
30@@ -67,7 +67,7 @@
31 ret = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
32
33 g_free (decoded);
34- g_input_stream_close (stream, NULL, NULL);
35+ g_object_unref (stream);
36 }
37 else if (_image_type == GTK_IMAGE_STOCK
38 || _image_type == GTK_IMAGE_ICON_NAME)
39
40=== modified file 'src/PanelTray.cpp'
41--- src/PanelTray.cpp 2011-06-16 16:57:23 +0000
42+++ src/PanelTray.cpp 2011-09-05 19:31:25 +0000
43@@ -22,7 +22,7 @@
44 #define PADDING 3
45
46 PanelTray::PanelTray ()
47-: _n_children (0),
48+ :_window (0),
49 _tray (NULL),
50 _last_x (0),
51 _last_y (0),
52@@ -30,7 +30,12 @@
53 {
54 _settings = g_settings_new (SETTINGS_NAME);
55 _whitelist = g_settings_get_strv (_settings, "systray-whitelist");
56+
57+ RealInit();
58+}
59
60+void PanelTray::RealInit()
61+{
62 _window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
63 gtk_window_set_type_hint (GTK_WINDOW (_window), GDK_WINDOW_TYPE_HINT_DOCK);
64 gtk_window_set_has_resize_grip (GTK_WINDOW (_window), FALSE);
65@@ -38,6 +43,21 @@
66 gtk_window_set_skip_pager_hint (GTK_WINDOW (_window), TRUE);
67 gtk_window_set_skip_taskbar_hint (GTK_WINDOW (_window), TRUE);
68 gtk_window_resize (GTK_WINDOW (_window), 1, 24);
69+
70+ /*
71+ GtkStyleContext* style_context = gtk_widget_get_style_context(_window);
72+
73+ GtkWidgetPath* widget_path = gtk_widget_path_new();
74+ guint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_WINDOW);
75+ gtk_widget_path_iter_set_name(widget_path, pos, "UnityPanelWidget");
76+
77+ gtk_style_context_set_path(style_context, widget_path);
78+ gtk_style_context_add_class(style_context, "gnome-panel-menu-bar");
79+ gtk_style_context_add_class(style_context, "unity-panel");
80+
81+ gtk_widget_path_free(widget_path);
82+ */
83+
84 SetMinMaxSize (1, 24);
85 gtk_window_move (GTK_WINDOW (_window), 200, 12);
86 gtk_widget_set_name (_window, "UnityPanelApplet");
87@@ -53,6 +73,8 @@
88 GTK_ORIENTATION_HORIZONTAL,
89 (NaTrayFilterCallback)FilterTrayCallback,
90 this);
91+ /* na_tray_set_icon_size(_tray, 24); */
92+
93 _tray_icon_added_id = g_signal_connect (na_tray_get_manager (_tray), "tray_icon_removed",
94 G_CALLBACK (PanelTray::OnTrayIconRemoved), this);
95
96@@ -104,11 +126,11 @@
97 {
98 if (_tray)
99 {
100- SetMinMaxSize ((_n_children * 24) + (PADDING * 2), 24);
101+ SetMinMaxSize (WidthOfTray() + (PADDING * 2), 24);
102 QueueRelayout ();
103 QueueDraw ();
104
105- if (_n_children)
106+ if (_children.size())
107 gtk_widget_show (_window);
108 else
109 gtk_widget_hide (_window);
110@@ -156,7 +178,7 @@
111 if (na_tray_child_has_alpha (icon))
112 na_tray_child_set_composited (icon, TRUE);
113
114- self->_n_children++;
115+ self->_children.push_back(icon);
116 g_idle_add ((GSourceFunc)IdleSync, self);
117 }
118
119@@ -176,18 +198,39 @@
120 void
121 PanelTray::OnTrayIconRemoved (NaTrayManager *manager, NaTrayChild *child, PanelTray *self)
122 {
123- g_idle_add ((GSourceFunc)IdleSync, self);
124- if (self->_n_children > 0)
125- self->_n_children--;
126+ for (std::vector<NaTrayChild*>::iterator it = self->_children.begin(); it != self->_children.end(); ++it)
127+ {
128+ if (*it == child)
129+ {
130+ g_idle_add ((GSourceFunc)IdleSync, self);
131+ self->_children.erase(it);
132+ break;
133+ }
134+ }
135 }
136
137 gboolean
138 PanelTray::IdleSync (PanelTray *self)
139 {
140+ int width = self->WidthOfTray();
141+ gtk_window_resize(GTK_WINDOW(self->_window), width, 24);
142 self->Sync ();
143 return FALSE;
144 }
145
146+int PanelTray::WidthOfTray()
147+{
148+ int width = 0;
149+ for (std::vector<NaTrayChild*>::iterator it = this->_children.begin(); it != this->_children.end(); ++it)
150+ {
151+ GtkAllocation alloc;
152+ gtk_widget_get_allocation(GTK_WIDGET(*it), &alloc);
153+ int w = alloc.width;
154+ width += w > 24 ? w : 24;
155+ }
156+ return width;
157+}
158+
159 gboolean
160 PanelTray::OnTrayExpose (GtkWidget *widget, GdkEventExpose *ev, PanelTray *tray)
161 {
162
163=== modified file 'src/PanelTray.h'
164--- src/PanelTray.h 2011-06-16 12:12:02 +0000
165+++ src/PanelTray.h 2011-09-05 19:31:25 +0000
166@@ -35,7 +35,7 @@
167 class PanelTray : public PanelIndicatorObjectView
168 {
169 public:
170-
171+ typedef std::vector<NaTrayChild*> TrayChildren;
172 PanelTray ();
173 ~PanelTray ();
174
175@@ -50,7 +50,6 @@
176 void OnEntryRemoved (IndicatorObjectEntryProxy *proxy);
177
178 public:
179- guint8 _n_children;
180 char **_whitelist;
181 protected:
182 const gchar * GetName ();
183@@ -63,10 +62,14 @@
184 static gboolean IdleSync (PanelTray *tray);
185 static gboolean OnTrayExpose (GtkWidget *widget, GdkEventExpose *ev, PanelTray *tray);
186
187+ void RealInit();
188+ int WidthOfTray();
189+
190 private:
191 GSettings *_settings;
192 GtkWidget *_window;
193 NaTray *_tray;
194+ TrayChildren _children;
195 int _last_x;
196 int _last_y;
197

Subscribers

People subscribed via source and target branches

to all changes: