Merge lp:~nicovdw/unity/fix-for-759886 into lp:unity

Proposed by Nico van der Walt
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 1157
Proposed branch: lp:~nicovdw/unity/fix-for-759886
Merge into: lp:unity
Diff against target: 45 lines (+13/-0)
2 files modified
src/PanelIndicatorObjectEntryView.cpp (+11/-0)
src/PanelIndicatorObjectEntryView.h (+2/-0)
To merge this branch: bzr merge lp:~nicovdw/unity/fix-for-759886
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+57887@code.launchpad.net

Description of the change

added the OnFontChanged method to the PanelIndicatorObjectEntryView class that gets called when the user changed the system font. This method will refresh the indicators to apply the new font.

To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

(Gord is making the review, just a note: do not forget to reset _on_font_changed_connection to 0 in the callback)

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

forget about my comment, too many g_source_remove yesterday ;)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PanelIndicatorObjectEntryView.cpp'
2--- src/PanelIndicatorObjectEntryView.cpp 2011-04-06 17:53:41 +0000
3+++ src/PanelIndicatorObjectEntryView.cpp 2011-04-15 14:59:23 +0000
4@@ -46,6 +46,8 @@
5 _on_indicator_updated_connection = _proxy->updated.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::Refresh));
6 _padding = padding;
7
8+ _on_font_changed_connection = g_signal_connect (gtk_settings_get_default (), "notify::gtk-font-name", (GCallback) &PanelIndicatorObjectEntryView::OnFontChanged, this);
9+
10 InputArea::OnMouseDown.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnMouseDown));
11 InputArea::OnMouseWheel.connect (sigc::mem_fun (this, &PanelIndicatorObjectEntryView::OnMouseWheel));
12
13@@ -58,6 +60,7 @@
14 _on_indicator_activate_changed_connection.disconnect ();
15 _on_indicator_updated_connection.disconnect ();
16 _on_panelstyle_changed_connection.disconnect ();
17+ g_signal_handler_disconnect (gtk_settings_get_default (), _on_font_changed_connection);
18 }
19
20 void
21@@ -430,3 +433,11 @@
22 {
23 return _proxy ? _proxy->show_now : false;
24 }
25+
26+void
27+PanelIndicatorObjectEntryView::OnFontChanged (GObject *gobject, GParamSpec *pspec, gpointer data)
28+{
29+ PanelIndicatorObjectEntryView *self = (PanelIndicatorObjectEntryView*) data;
30+
31+ self->Refresh();
32+}
33
34=== modified file 'src/PanelIndicatorObjectEntryView.h'
35--- src/PanelIndicatorObjectEntryView.h 2011-03-29 12:23:52 +0000
36+++ src/PanelIndicatorObjectEntryView.h 2011-04-15 14:59:23 +0000
37@@ -61,6 +61,8 @@
38 sigc::connection _on_indicator_updated_connection;
39 sigc::connection _on_panelstyle_changed_connection;
40
41+ gulong _on_font_changed_connection;
42+ static void OnFontChanged (GObject *gobject, GParamSpec *pspec, gpointer data);
43 };
44
45 #endif // PANEL_INDICATOR_OBJECT_ENTRY_VIEW_H