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

Subscribers

People subscribed via source and target branches

to all changes: