Merge lp:~marcobiscaro2112/unity/fixes-605475.2 into lp:unity

Proposed by Marco Biscaro
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 995
Proposed branch: lp:~marcobiscaro2112/unity/fixes-605475.2
Merge into: lp:unity
Diff against target: 51 lines (+26/-1)
2 files modified
src/SimpleLauncherIcon.cpp (+24/-0)
src/SimpleLauncherIcon.h (+2/-1)
To merge this branch: bzr merge lp:~marcobiscaro2112/unity/fixes-605475.2
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Review via email: mp+54323@code.launchpad.net

This proposal supersedes a proposal from 2011-03-15.

To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote : Posted in a previous version of this proposal

Marco, looks mostly fine. But add a sanity check (test against NULL) for data in OnIconThemeChanged() so we won't crash if - for whatever reason - "this" might turn out to be NULL.

review: Needs Fixing
Revision history for this message
Marco Biscaro (marcobiscaro2112) wrote : Posted in a previous version of this proposal

I think it's fixed now, Mirco. Could you review it again?

Revision history for this message
Mirco Müller (macslow) wrote :

Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/SimpleLauncherIcon.cpp'
2--- src/SimpleLauncherIcon.cpp 2011-02-22 16:13:43 +0000
3+++ src/SimpleLauncherIcon.cpp 2011-03-22 11:10:53 +0000
4@@ -35,6 +35,9 @@
5 LauncherIcon::MouseClick.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseClick));
6 LauncherIcon::MouseEnter.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseEnter));
7 LauncherIcon::MouseLeave.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseLeave));
8+
9+ g_signal_connect (gtk_icon_theme_get_default (), "changed",
10+ G_CALLBACK (SimpleLauncherIcon::OnIconThemeChanged), this);
11 }
12
13 SimpleLauncherIcon::~SimpleLauncherIcon()
14@@ -110,3 +113,24 @@
15
16 needs_redraw.emit (this);
17 }
18+
19+void
20+SimpleLauncherIcon::OnIconThemeChanged (GtkIconTheme* icon_theme, gpointer data)
21+{
22+ SimpleLauncherIcon *self;
23+
24+ if (!data) return;
25+
26+ self = (SimpleLauncherIcon*) data;
27+
28+ /*
29+ * Unreference the previous icon and redraw
30+ * (forcing the new icon to be loaded)
31+ */
32+ if (self->m_Icon)
33+ {
34+ self->m_Icon->UnReference ();
35+ self->m_Icon = 0;
36+ }
37+ self->needs_redraw.emit (self);
38+}
39
40=== modified file 'src/SimpleLauncherIcon.h'
41--- src/SimpleLauncherIcon.h 2011-02-22 16:13:43 +0000
42+++ src/SimpleLauncherIcon.h 2011-03-22 11:10:53 +0000
43@@ -47,7 +47,8 @@
44 char *m_IconName;
45 nux::BaseTexture *m_Icon;
46 void ActivateLauncherIcon ();
47+ static void OnIconThemeChanged (GtkIconTheme* icon_theme, gpointer data);
48 };
49
50-#endif // BAMFLAUNCHERICON_H
51+#endif // SIMPLELAUNCHERICON_H
52