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
=== modified file 'src/SimpleLauncherIcon.cpp'
--- src/SimpleLauncherIcon.cpp 2011-02-22 16:13:43 +0000
+++ src/SimpleLauncherIcon.cpp 2011-03-22 11:10:53 +0000
@@ -35,6 +35,9 @@
35 LauncherIcon::MouseClick.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseClick));35 LauncherIcon::MouseClick.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseClick));
36 LauncherIcon::MouseEnter.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseEnter));36 LauncherIcon::MouseEnter.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseEnter));
37 LauncherIcon::MouseLeave.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseLeave));37 LauncherIcon::MouseLeave.connect (sigc::mem_fun (this, &SimpleLauncherIcon::OnMouseLeave));
38
39 g_signal_connect (gtk_icon_theme_get_default (), "changed",
40 G_CALLBACK (SimpleLauncherIcon::OnIconThemeChanged), this);
38}41}
3942
40SimpleLauncherIcon::~SimpleLauncherIcon()43SimpleLauncherIcon::~SimpleLauncherIcon()
@@ -110,3 +113,24 @@
110 113
111 needs_redraw.emit (this);114 needs_redraw.emit (this);
112}115}
116
117void
118SimpleLauncherIcon::OnIconThemeChanged (GtkIconTheme* icon_theme, gpointer data)
119{
120 SimpleLauncherIcon *self;
121
122 if (!data) return;
123
124 self = (SimpleLauncherIcon*) data;
125
126 /*
127 * Unreference the previous icon and redraw
128 * (forcing the new icon to be loaded)
129 */
130 if (self->m_Icon)
131 {
132 self->m_Icon->UnReference ();
133 self->m_Icon = 0;
134 }
135 self->needs_redraw.emit (self);
136}
113137
=== modified file 'src/SimpleLauncherIcon.h'
--- src/SimpleLauncherIcon.h 2011-02-22 16:13:43 +0000
+++ src/SimpleLauncherIcon.h 2011-03-22 11:10:53 +0000
@@ -47,7 +47,8 @@
47 char *m_IconName;47 char *m_IconName;
48 nux::BaseTexture *m_Icon;48 nux::BaseTexture *m_Icon;
49 void ActivateLauncherIcon ();49 void ActivateLauncherIcon ();
50 static void OnIconThemeChanged (GtkIconTheme* icon_theme, gpointer data);
50};51};
5152
52#endif // BAMFLAUNCHERICON_H53#endif // SIMPLELAUNCHERICON_H
5354