Merge lp:~noskcaj/ubuntu/trusty/xfce4-xkb-plugin/lp-733563 into lp:ubuntu/trusty/xfce4-xkb-plugin

Proposed by Jackson Doak
Status: Superseded
Proposed branch: lp:~noskcaj/ubuntu/trusty/xfce4-xkb-plugin/lp-733563
Merge into: lp:ubuntu/trusty/xfce4-xkb-plugin
Diff against target: 311 lines (+293/-0)
3 files modified
debian/changelog (+6/-0)
debian/patches/font_selection.patch (+286/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~noskcaj/ubuntu/trusty/xfce4-xkb-plugin/lp-733563
Reviewer Review Type Date Requested Status
Iain Lane Needs Information
Review via email: mp+207853@code.launchpad.net

This proposal has been superseded by a proposal from 2014-04-05.

Description of the change

Make xkb-plugin able to change font.

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

thanks

review: Approve
Revision history for this message
Iain Lane (laney) wrote :

Oops, I commented on the wrong one.

What happens when the user has set `display_textsize' before? It looks like that setting will be lost - is that right and intended?

Revision history for this message
Iain Lane (laney) :
review: Needs Information
Revision history for this message
Jackson Doak (noskcaj) wrote :

As far as i know, it's intentional.

On Fri, Mar 7, 2014 at 12:00 AM, Iain Lane <email address hidden> wrote:

> Review: Needs Information
>
>
> --
>
> https://code.launchpad.net/~noskcaj/ubuntu/trusty/xfce4-xkb-plugin/lp-733563/+merge/207853
> You are the owner of lp:~noskcaj/ubuntu/trusty/xfce4-xkb-plugin/lp-733563.
>

38. By Jackson Doak

Add git-fix-crash.patch. LP: #978230

39. By Jackson Doak

Add the patch

Unmerged revisions

39. By Jackson Doak

Add the patch

38. By Jackson Doak

Add git-fix-crash.patch. LP: #978230

37. By Jackson Doak

Add font_selection.patch, thanks Ivan Frederiks. LP: #733563

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file '.pc/applied-patches'
2=== modified file 'debian/changelog'
3--- debian/changelog 2014-02-07 19:39:52 +0000
4+++ debian/changelog 2014-02-24 01:37:08 +0000
5@@ -1,3 +1,9 @@
6+xfce4-xkb-plugin (1:0.7.0-0ubuntu2) trusty; urgency=medium
7+
8+ * Add font_selection.patch, thanks Ivan Frederiks. LP: #733563
9+
10+ -- Jackson Doak <noskcaj@ubuntu.com> Mon, 24 Feb 2014 12:28:50 +1100
11+
12 xfce4-xkb-plugin (1:0.7.0-0ubuntu1) trusty; urgency=medium
13
14 * debian/watch: Use all versions
15
16=== added file 'debian/patches/font_selection.patch'
17--- debian/patches/font_selection.patch 1970-01-01 00:00:00 +0000
18+++ debian/patches/font_selection.patch 2014-02-24 01:37:08 +0000
19@@ -0,0 +1,286 @@
20+Author: Ivan Frederiks <idfred@gmail.com>
21+Date: Thu, 26 Sep 2013 14:49:02 +0400
22+Description: Changed text size selection to full-featured font selection
23+ Makes the xkb plugin change font with the rest of the system
24+Bug: https://bugzilla.xfce.org/show_bug.cgi?id=8446
25+Bug-Debian: http://bugs.debian.org/576072
26+Bug-Ubuntu: https://launchpad.net/bugs/733563
27+
28+---
29+ panel-plugin/xfce4-xkb-plugin.c | 7 +++--
30+ panel-plugin/xfce4-xkb-plugin.h | 9 +------
31+ panel-plugin/xkb-cairo.c | 33 ++++---------------------
32+ panel-plugin/xkb-cairo.h | 4 +--
33+ panel-plugin/xkb-callbacks.c | 4 +--
34+ panel-plugin/xkb-settings-dialog.c | 47 +++++++++++++++++++++++++------------
35+ 6 files changed, 48 insertions(+), 56 deletions(-)
36+
37+--- a/panel-plugin/xfce4-xkb-plugin.c
38++++ b/panel-plugin/xfce4-xkb-plugin.c
39+@@ -262,6 +262,7 @@ xkb_free (t_xkb *xkb)
40+ gtk_widget_destroy (xkb->layout_image);
41+ gtk_widget_destroy (xkb->btn);
42+ xkb_destroy_popup_menu (xkb);
43++ g_free (xkb->display_font);
44+
45+ panel_slice_free (t_xkb, xkb);
46+ }
47+@@ -288,7 +289,7 @@ xfce_xkb_save_config (XfcePanelPlugin *p
48+ xfce_rc_set_group (rcfile, NULL);
49+
50+ xfce_rc_write_int_entry (rcfile, "display_type", xkb->display_type);
51+- xfce_rc_write_int_entry (rcfile, "display_textsize", xkb->display_textsize);
52++ xfce_rc_write_entry (rcfile, "display_font", xkb->display_font);
53+ xfce_rc_write_int_entry (rcfile, "group_policy", xkb->group_policy);
54+
55+ xfce_rc_close (rcfile);
56+@@ -304,7 +305,7 @@ xkb_load_config (t_xkb *xkb, const gchar
57+ xfce_rc_set_group (rcfile, NULL);
58+
59+ xkb->display_type = xfce_rc_read_int_entry (rcfile, "display_type", DISPLAY_TYPE_IMAGE);
60+- xkb->display_textsize = xfce_rc_read_int_entry (rcfile, "display_textsize", DISPLAY_TEXTSIZE_LARGE);
61++ xkb->display_font = g_strdup(xfce_rc_read_entry (rcfile, "display_font", XKB_PREFERRED_FONT));
62+ xkb->group_policy = xfce_rc_read_int_entry (rcfile, "group_policy", GROUP_POLICY_PER_APPLICATION);
63+
64+ xfce_rc_close (rcfile);
65+@@ -319,7 +320,7 @@ static void
66+ xkb_load_default (t_xkb *xkb)
67+ {
68+ xkb->display_type = DISPLAY_TYPE_IMAGE;
69+- xkb->display_textsize = DISPLAY_TEXTSIZE_LARGE;
70++ xkb->display_font = g_strdup(XKB_PREFERRED_FONT);
71+ xkb->group_policy = GROUP_POLICY_PER_APPLICATION;
72+ }
73+
74+--- a/panel-plugin/xfce4-xkb-plugin.h
75++++ b/panel-plugin/xfce4-xkb-plugin.h
76+@@ -42,12 +42,7 @@ typedef enum
77+ DISPLAY_TYPE_TEXT = 1
78+ } t_display_type;
79+
80+-typedef enum
81+-{
82+- DISPLAY_TEXTSIZE_SMALL = 0,
83+- DISPLAY_TEXTSIZE_MEDIUM = 1,
84+- DISPLAY_TEXTSIZE_LARGE = 2
85+-} t_display_textsize;
86++#define XKB_PREFERRED_FONT "Monospace Bold 16"
87+
88+ typedef struct
89+ {
90+@@ -60,7 +55,7 @@ typedef struct
91+ gint button_vsize; /* read allocated button size - see below */
92+
93+ t_display_type display_type; /* display layout as image ot text */
94+- t_display_textsize display_textsize; /* text size for text layout */
95++ gchar *display_font; /* font for text layout */
96+ t_group_policy group_policy; /* per-app/window/global policy */
97+
98+ gint button_state; /* gtk state of the button */
99+--- a/panel-plugin/xkb-cairo.c
100++++ b/panel-plugin/xkb-cairo.c
101+@@ -31,8 +31,6 @@
102+ #include <librsvg/rsvg-cairo.h>
103+ #endif
104+
105+-#define XKB_PREFERRED_FONT "Courier New, Courier 10 Pitch, Monospace Bold"
106+-
107+ #define xkb_cairo_arc_for_flag(cr, x, y, r, a1, a2) \
108+ xx = layoutx + width - 12 + x; \
109+ yy = layouty + height - 12 + y; \
110+@@ -59,7 +57,7 @@ xkb_cairo_draw_flag (cairo_t *cr,
111+ gint width,
112+ gint height,
113+ gint variant_markers_count,
114+- gint textsize,
115++ const gchar *font_str,
116+ GdkColor fgcolor)
117+ {
118+ gchar *filename;
119+@@ -86,7 +84,7 @@ xkb_cairo_draw_flag (cairo_t *cr,
120+ actual_width, actual_height,
121+ width, height,
122+ variant_markers_count,
123+- textsize,
124++ font_str,
125+ fgcolor);
126+ return;
127+ }
128+@@ -136,7 +134,7 @@ xkb_cairo_draw_label (cairo_t *cr,
129+ const gint width,
130+ const gint height,
131+ const gint variant_markers_count,
132+- const gint textsize,
133++ const gchar *font_str,
134+ const GdkColor fgcolor)
135+ {
136+ gchar *normalized_group_name;
137+@@ -168,7 +166,7 @@ xkb_cairo_draw_label (cairo_t *cr,
138+
139+ pango_layout_set_text (layout, normalized_group_name, -1);
140+
141+- desc = pango_font_description_from_string ( XKB_PREFERRED_FONT );
142++ desc = pango_font_description_from_string ( font_str );
143+ pango_layout_set_font_description (layout, desc);
144+ pango_font_description_free (desc);
145+
146+@@ -176,35 +174,16 @@ xkb_cairo_draw_label (cairo_t *cr,
147+ pango_layout_get_pixel_size (layout, &pango_width, &pango_height);
148+ DBG ("pango_width/height: %d/%d", pango_width, pango_height);
149+
150+- switch (textsize){
151+- case DISPLAY_TEXTSIZE_SMALL:
152+- default: /* catch misconfiguration */
153+- scalex = scaley = 0.475;
154+- break;
155+- case DISPLAY_TEXTSIZE_MEDIUM:
156+- scalex = scaley = 0.7;
157+- break;
158+- case DISPLAY_TEXTSIZE_LARGE:
159+- scalex = scaley = 1;
160+- break;
161+- }
162+-
163+- DBG ("txt size scale x/y: %.2f/%.2f", scalex, scaley);
164+-
165+- text_height = actual_height * scaley;
166++ text_height = actual_height;
167+ scaley = text_height / pango_height;
168+ radius = (text_height < 32) ? 1.2 : 2.5;
169+ diameter = 2 * radius;
170+
171+- text_width = actual_width * scalex;
172++ text_width = actual_width;
173+ if (actual_width - text_width < 3 + variant_markers_count * diameter)
174+ {
175+ text_width = actual_width - 3 - (variant_markers_count) * diameter;
176+ }
177+- else if (textsize == DISPLAY_TEXTSIZE_LARGE)
178+- {
179+- text_width -= 3;
180+- }
181+
182+ scalex = text_width/pango_width;
183+
184+--- a/panel-plugin/xkb-cairo.h
185++++ b/panel-plugin/xkb-cairo.h
186+@@ -41,7 +41,7 @@ void xkb_cairo_draw_flag (cai
187+ gint width,
188+ gint height,
189+ gint variant_markers_count,
190+- gint textsize,
191++ const gchar *font_str,
192+ GdkColor fgcolor);
193+
194+ void xkb_cairo_draw_label (cairo_t *cr,
195+@@ -52,7 +52,7 @@ void xkb_cairo_draw_label (cai
196+ const gint width,
197+ const gint height,
198+ const gint variant_markers_count,
199+- const gint textsize,
200++ const gchar *font_str,
201+ const GdkColor fgcolor);
202+
203+ #endif
204+--- a/panel-plugin/xkb-callbacks.c
205++++ b/panel-plugin/xkb-callbacks.c
206+@@ -137,7 +137,7 @@ xkb_plugin_layout_image_exposed (GtkWidg
207+ actual_hsize, actual_vsize,
208+ xkb->hsize, vsize,
209+ xkb_config_variant_index_for_group (-1),
210+- xkb->display_textsize,
211++ xkb->display_font,
212+ fgcolor
213+ );
214+ }
215+@@ -148,7 +148,7 @@ xkb_plugin_layout_image_exposed (GtkWidg
216+ actual_hsize, actual_vsize,
217+ xkb->hsize, vsize,
218+ xkb_config_variant_index_for_group (-1),
219+- xkb->display_textsize,
220++ xkb->display_font,
221+ fgcolor
222+ );
223+ }
224+--- a/panel-plugin/xkb-settings-dialog.c
225++++ b/panel-plugin/xkb-settings-dialog.c
226+@@ -86,9 +86,30 @@ on_display_type_changed (GtkComboBox *cb
227+ }
228+
229+ static void
230+-on_display_textsize_changed (GtkComboBox *cb, t_xkb *xkb)
231++on_font_selection(GtkWidget *widget, t_xkb *xkb)
232+ {
233+- xkb->display_textsize = gtk_combo_box_get_active (cb);
234++ GtkWidget *dialog;
235++ const gchar *group_name, *previewtext;
236++ gint result;
237++
238++ group_name = xkb_config_get_group_name (-1);
239++ previewtext = xkb_util_normalize_group_name (group_name);
240++
241++ dialog = gtk_font_selection_dialog_new(_("Select font"));
242++ gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(dialog),
243++ xkb->display_font);
244++ gtk_font_selection_dialog_set_preview_text(GTK_FONT_SELECTION_DIALOG(dialog),
245++ previewtext);
246++
247++ result = gtk_dialog_run(GTK_DIALOG(dialog));
248++ if (result == GTK_RESPONSE_OK || result == GTK_RESPONSE_ACCEPT)
249++ {
250++ g_free(xkb->display_font);
251++ xkb->display_font = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(dialog));
252++ gtk_button_set_label(GTK_BUTTON(widget), xkb->display_font);
253++ }
254++ gtk_widget_destroy(dialog);
255++
256+ xkb_refresh_gui (xkb);
257+ }
258+
259+@@ -105,7 +126,7 @@ xfce_xkb_configure (XfcePanelPlugin *plu
260+ {
261+ GtkWidget *display_type_optmenu, *group_policy_combo;
262+ GtkWidget *vbox, *display_type_frame, *group_policy_frame, *bin;
263+- GtkWidget *display_textsize_frame, *display_textsize_optmenu;
264++ GtkWidget *display_font_frame, *display_font_button;
265+
266+ xfce_panel_plugin_block_menu (plugin);
267+
268+@@ -130,16 +151,13 @@ xfce_xkb_configure (XfcePanelPlugin *plu
269+ gtk_container_add (GTK_CONTAINER (bin), display_type_optmenu);
270+
271+ /* text size option */
272+- display_textsize_frame = xfce_gtk_frame_box_new (_("Text size:"), &bin);
273+- gtk_widget_show (display_textsize_frame);
274+- gtk_box_pack_start (GTK_BOX (vbox), display_textsize_frame, TRUE, TRUE, 2);
275+-
276+- display_textsize_optmenu = gtk_combo_box_new_text ();
277+- gtk_combo_box_append_text (GTK_COMBO_BOX (display_textsize_optmenu), _("small"));
278+- gtk_combo_box_append_text (GTK_COMBO_BOX (display_textsize_optmenu), _("medium"));
279+- gtk_combo_box_append_text (GTK_COMBO_BOX (display_textsize_optmenu), _("large"));
280+- gtk_widget_set_size_request (display_textsize_optmenu, 230, -1);
281+- gtk_container_add (GTK_CONTAINER (bin), display_textsize_optmenu);
282++ display_font_frame = xfce_gtk_frame_box_new (_("Text font:"), &bin);
283++ gtk_widget_show (display_font_frame);
284++ gtk_box_pack_start (GTK_BOX (vbox), display_font_frame, TRUE, TRUE, 2);
285++
286++ display_font_button = gtk_button_new_with_label (xkb->display_font);
287++ gtk_widget_set_size_request (display_font_button, 230, -1);
288++ gtk_container_add (GTK_CONTAINER (bin), display_font_button);
289+
290+ group_policy_frame = xfce_gtk_frame_box_new (_("Manage layout:"), &bin);
291+ gtk_widget_show (group_policy_frame);
292+@@ -159,12 +177,11 @@ xfce_xkb_configure (XfcePanelPlugin *plu
293+ G_CALLBACK (on_settings_close), xkb);
294+
295+ gtk_combo_box_set_active (GTK_COMBO_BOX (display_type_optmenu), xkb->display_type);
296+- gtk_combo_box_set_active (GTK_COMBO_BOX (display_textsize_optmenu), xkb->display_textsize);
297+ gtk_combo_box_set_active (GTK_COMBO_BOX (group_policy_combo), xkb->group_policy);
298+
299+ g_signal_connect (display_type_optmenu, "changed", G_CALLBACK (on_display_type_changed), xkb);
300+ g_signal_connect (group_policy_combo, "changed", G_CALLBACK (on_group_policy_changed), xkb);
301+- g_signal_connect (display_textsize_optmenu, "changed", G_CALLBACK (on_display_textsize_changed), xkb);
302++ g_signal_connect (display_font_button, "clicked", G_CALLBACK(on_font_selection), xkb);
303+
304+ gtk_widget_show (settings_dialog);
305+ }
306
307=== added file 'debian/patches/series'
308--- debian/patches/series 1970-01-01 00:00:00 +0000
309+++ debian/patches/series 2014-02-24 01:37:08 +0000
310@@ -0,0 +1,1 @@
311+font_selection.patch

Subscribers

People subscribed via source and target branches

to all changes: