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: no longer in the source branch.
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
=== modified file 'src/PanelMenuView.cpp'
--- src/PanelMenuView.cpp 2011-04-10 22:54:12 +0000
+++ src/PanelMenuView.cpp 2011-04-12 17:32:27 +0000
@@ -37,6 +37,7 @@
37#include "IndicatorObjectEntryProxy.h"37#include "IndicatorObjectEntryProxy.h"
3838
39#include <gio/gdesktopappinfo.h>39#include <gio/gdesktopappinfo.h>
40#include <gconf/gconf-client.h>
4041
41#include "ubus-server.h"42#include "ubus-server.h"
42#include "UBusMessages.h"43#include "UBusMessages.h"
@@ -44,6 +45,7 @@
44#include "UScreen.h"45#include "UScreen.h"
4546
46#define BUTTONS_WIDTH 7247#define BUTTONS_WIDTH 72
48#define WINDOW_TITLE_FONT_KEY "/apps/metacity/general/titlebar_font"
4749
48static void on_active_window_changed (BamfMatcher *matcher,50static void on_active_window_changed (BamfMatcher *matcher,
49 BamfView *old_view,51 BamfView *old_view,
@@ -513,17 +515,18 @@
513515
514 if (label)516 if (label)
515 {517 {
518 GConfClient *client = gconf_client_get_default ();
516 PangoContext *cxt;519 PangoContext *cxt;
517 PangoRectangle log_rect;520 PangoRectangle log_rect;
518521
519 cr = _util_cg.GetContext ();522 cr = _util_cg.GetContext ();
520523
521 g_object_get (settings,524 g_object_get (settings,
522 "gtk-font-name", &font_description,
523 "gtk-xft-dpi", &dpi,525 "gtk-xft-dpi", &dpi,
524 NULL);526 NULL);
527
528 font_description = gconf_client_get_string (client, WINDOW_TITLE_FONT_KEY, NULL);
525 desc = pango_font_description_from_string (font_description);529 desc = pango_font_description_from_string (font_description);
526 pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
527530
528 layout = pango_cairo_create_layout (cr);531 layout = pango_cairo_create_layout (cr);
529 pango_layout_set_font_description (layout, desc);532 pango_layout_set_font_description (layout, desc);
@@ -541,6 +544,7 @@
541 pango_font_description_free (desc);544 pango_font_description_free (desc);
542 g_free (font_description);545 g_free (font_description);
543 cairo_destroy (cr);546 cairo_destroy (cr);
547 g_object_unref (client);
544 }548 }
545549
546 nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, width, height);550 nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, width, height);