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

Proposed by Jackson Doak
Status: Rejected
Rejected by: Sebastien Bacher
Proposed branch: lp:~noskcaj/ubuntu/vivid/xfce4-xkb-plugin/lp-733563
Merge into: lp:ubuntu/vivid/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/vivid/xfce4-xkb-plugin/lp-733563
Reviewer Review Type Date Requested Status
Sebastien Bacher Disapprove
Review via email: mp+239668@code.launchpad.net

Description of the change

Change font when the rest of the system does

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

There are some previous review comments on https://code.launchpad.net/~noskcaj/ubuntu/trusty/xfce4-xkb-plugin/lp-733563/+merge/214365

Would be nice to get an upstream review before uploading to Ubuntu, letting the review/decision to the xubuntu team in any case

Revision history for this message
Sebastien Bacher (seb128) wrote :

could somebody from the xubuntu team review that one?

Revision history for this message
Sebastien Bacher (seb128) wrote :

Seems like nobody from the xubuntu team is interested in picking that one up, marking as rejected, that doesn't seem like the sort of changes that should be done in a distro change but rather worked with upstream instead

review: Disapprove

Unmerged revisions

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

Subscribers

People subscribed via source and target branches

to all changes: