Merge lp:~sao/unity/fix-use-window-title-font into lp:unity

Proposed by Oliver Sauder
Status: Merged
Approved by: Mirco Müller
Approved revision: 1117
Merged at revision: 1205
Proposed branch: lp:~sao/unity/fix-use-window-title-font
Merge into: lp:unity
Diff against target: 48 lines (+6/-2)
1 file modified
src/PanelMenuView.cpp (+6/-2)
To merge this branch: bzr merge lp:~sao/unity/fix-use-window-title-font
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Review via email: mp+57368@code.launchpad.net

Description of the change

GtkSettings gtk-font-name returns the application font name. However, the window title font should be used. As far as I can see the only way to get such is with gconf.

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

Code looks ok, works as expected... approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PanelMenuView.cpp'
2--- src/PanelMenuView.cpp 2011-04-10 22:54:12 +0000
3+++ src/PanelMenuView.cpp 2011-04-12 17:32:27 +0000
4@@ -37,6 +37,7 @@
5 #include "IndicatorObjectEntryProxy.h"
6
7 #include <gio/gdesktopappinfo.h>
8+#include <gconf/gconf-client.h>
9
10 #include "ubus-server.h"
11 #include "UBusMessages.h"
12@@ -44,6 +45,7 @@
13 #include "UScreen.h"
14
15 #define BUTTONS_WIDTH 72
16+#define WINDOW_TITLE_FONT_KEY "/apps/metacity/general/titlebar_font"
17
18 static void on_active_window_changed (BamfMatcher *matcher,
19 BamfView *old_view,
20@@ -513,17 +515,18 @@
21
22 if (label)
23 {
24+ GConfClient *client = gconf_client_get_default ();
25 PangoContext *cxt;
26 PangoRectangle log_rect;
27
28 cr = _util_cg.GetContext ();
29
30 g_object_get (settings,
31- "gtk-font-name", &font_description,
32 "gtk-xft-dpi", &dpi,
33 NULL);
34+
35+ font_description = gconf_client_get_string (client, WINDOW_TITLE_FONT_KEY, NULL);
36 desc = pango_font_description_from_string (font_description);
37- pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
38
39 layout = pango_cairo_create_layout (cr);
40 pango_layout_set_font_description (layout, desc);
41@@ -541,6 +544,7 @@
42 pango_font_description_free (desc);
43 g_free (font_description);
44 cairo_destroy (cr);
45+ g_object_unref (client);
46 }
47
48 nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, width, height);