Gentoo Archives: gentoo-commits

From: Nirbheek Chauhan <nirbheek@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gnome:master commit in: gnome-base/libgnomekbd/, gnome-base/libgnomekbd/files/
Date: Wed, 06 Apr 2011 12:14:59
Message-Id: f3fd8ea494ed329f7f34f90c13c558f3c02d4a81.nirbheek@gentoo
1 commit: f3fd8ea494ed329f7f34f90c13c558f3c02d4a81
2 Author: Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
3 AuthorDate: Wed Apr 6 11:22:56 2011 +0000
4 Commit: Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 6 11:22:56 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=f3fd8ea4
7
8 gnome-base/libgnomekbd: 3.0.0 → 3.0.0.1
9
10 * Fix use_enable on introspection, reported by SardemFF7
11
12 ---
13 .../libgnomekbd-3.0.0-gkbdstatus-text-color.patch | 347 --------------------
14 ...kbd-3.0.0.ebuild => libgnomekbd-3.0.0.1.ebuild} | 7 +-
15 gnome-base/libgnomekbd/libgnomekbd-9999.ebuild | 11 +-
16 3 files changed, 3 insertions(+), 362 deletions(-)
17
18 diff --git a/gnome-base/libgnomekbd/files/libgnomekbd-3.0.0-gkbdstatus-text-color.patch b/gnome-base/libgnomekbd/files/libgnomekbd-3.0.0-gkbdstatus-text-color.patch
19 deleted file mode 100644
20 index e2417c3..0000000
21 --- a/gnome-base/libgnomekbd/files/libgnomekbd-3.0.0-gkbdstatus-text-color.patch
22 +++ /dev/null
23 @@ -1,347 +0,0 @@
24 -From 0b452d4735c6ef35299e24ffb3faa0cabc5559c3 Mon Sep 17 00:00:00 2001
25 -From: Vincent Untz <vuntz@×××××.org>
26 -Date: Mon, 4 Apr 2011 19:32:56 +0200
27 -Subject: [PATCH] Use the right color for text in GkbdStatus
28 -
29 -This is really a big hack: instead of getting the information about how
30 -to draw the font from a GTK+ style, we get it from the GtkStyleContext
31 -from the tray icon widget embedded in the GtkStatusIcon.
32 -
33 -To make this happen, we have to fake the GtkStatusIconPrivate structure,
34 -and we rely on the fact that the tray icon widget is the first element
35 -in this structure.
36 -
37 -https://bugzilla.gnome.org/show_bug.cgi?id=642703
38 ----
39 - libgnomekbd/gkbd-indicator-config.c | 98 ++++++++++++++++++-----------------
40 - libgnomekbd/gkbd-indicator-config.h | 10 ++++
41 - libgnomekbd/gkbd-status.c | 65 ++++++++++++++---------
42 - 3 files changed, 100 insertions(+), 73 deletions(-)
43 -
44 -diff --git a/libgnomekbd/gkbd-indicator-config.c b/libgnomekbd/gkbd-indicator-config.c
45 -index fdf008b..c678643 100644
46 ---- a/libgnomekbd/gkbd-indicator-config.c
47 -+++ b/libgnomekbd/gkbd-indicator-config.c
48 -@@ -37,7 +37,6 @@
49 - /**
50 - * GkbdIndicatorConfig
51 - */
52 --#define GTK_STYLE_PATH "*PanelWidget*"
53 -
54 - const gchar GKBD_INDICATOR_CONFIG_KEY_SHOW_FLAGS[] = "show-flags";
55 - const gchar GKBD_INDICATOR_CONFIG_KEY_ENABLED_PLUGINS[] =
56 -@@ -65,26 +64,8 @@ gkbd_indicator_config_load_font (GkbdIndicatorConfig * ind_config)
57 - g_settings_get_int (ind_config->settings,
58 - GKBD_INDICATOR_CONFIG_KEY_FONT_SIZE);
59 -
60 -- if (ind_config->font_family == NULL ||
61 -- ind_config->font_family[0] == '\0') {
62 -- PangoFontDescription *fd = NULL;
63 -- GtkStyle *style =
64 -- gtk_rc_get_style_by_paths (gtk_settings_get_default (),
65 -- GTK_STYLE_PATH,
66 -- GTK_STYLE_PATH,
67 -- GTK_TYPE_LABEL);
68 -- if (style != NULL)
69 -- fd = style->font_desc;
70 -- if (fd != NULL) {
71 -- ind_config->font_family =
72 -- g_strdup (pango_font_description_get_family
73 -- (fd));
74 -- ind_config->font_size =
75 -- pango_font_description_get_size (fd) /
76 -- PANGO_SCALE;
77 -- }
78 -- }
79 -- xkl_debug (150, "font: [%s], size %d\n", ind_config->font_family,
80 -+ xkl_debug (150, "font: [%s], size %d\n",
81 -+ ind_config->font_family ? ind_config->font_family : "(null)",
82 - ind_config->font_size);
83 -
84 - }
85 -@@ -96,38 +77,61 @@ gkbd_indicator_config_load_colors (GkbdIndicatorConfig * ind_config)
86 - g_settings_get_string (ind_config->settings,
87 - GKBD_INDICATOR_CONFIG_KEY_FOREGROUND_COLOR);
88 -
89 -- if (ind_config->foreground_color == NULL ||
90 -- ind_config->foreground_color[0] == '\0') {
91 -- GtkStyle *style =
92 -- gtk_rc_get_style_by_paths (gtk_settings_get_default (),
93 -- GTK_STYLE_PATH,
94 -- GTK_STYLE_PATH,
95 -- GTK_TYPE_LABEL);
96 -- if (style != NULL) {
97 -- ind_config->foreground_color =
98 -- g_strdup_printf ("%g %g %g", ((double)
99 -- style->fg
100 -- [GTK_STATE_NORMAL].
101 -- red)
102 -- / 0x10000, ((double)
103 -- style->fg
104 -- [GTK_STATE_NORMAL].
105 -- green)
106 -- / 0x10000, ((double)
107 -- style->fg
108 -- [GTK_STATE_NORMAL].
109 -- blue)
110 -- / 0x10000);
111 -- }
112 --
113 -- }
114 --
115 - ind_config->background_color =
116 - g_settings_get_string (ind_config->settings,
117 - GKBD_INDICATOR_CONFIG_KEY_BACKGROUND_COLOR);
118 - }
119 -
120 - void
121 -+gkbd_indicator_config_get_font_for_widget (GkbdIndicatorConfig * ind_config,
122 -+ GtkWidget * widget,
123 -+ gchar ** font_family,
124 -+ int * font_size)
125 -+{
126 -+ GtkStyleContext *context;
127 -+ const PangoFontDescription *fd = NULL;
128 -+
129 -+ g_return_if_fail (GTK_IS_WIDGET (widget));
130 -+
131 -+ if (ind_config->font_family != NULL &&
132 -+ ind_config->font_family[0] != '\0') {
133 -+ if (font_family)
134 -+ *font_family = g_strdup (ind_config->font_family);
135 -+ if (font_size)
136 -+ *font_size = ind_config->font_size;
137 -+
138 -+ return;
139 -+ }
140 -+
141 -+ context = gtk_widget_get_style_context (widget);
142 -+ fd = gtk_style_context_get_font (context, GTK_STATE_FLAG_NORMAL);
143 -+
144 -+ if (font_family)
145 -+ *font_family = g_strdup (pango_font_description_get_family (fd));
146 -+ if (font_size)
147 -+ *font_size = pango_font_description_get_size (fd) / PANGO_SCALE;
148 -+}
149 -+
150 -+gchar *
151 -+gkbd_indicator_config_get_fg_color_for_widget (GkbdIndicatorConfig * ind_config,
152 -+ GtkWidget * widget)
153 -+{
154 -+ GtkStyleContext *context;
155 -+ GdkRGBA rgba;
156 -+
157 -+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
158 -+
159 -+ if (ind_config->foreground_color != NULL &&
160 -+ ind_config->foreground_color[0] != '\0')
161 -+ return g_strdup (ind_config->foreground_color);
162 -+
163 -+ context = gtk_widget_get_style_context (widget);
164 -+ gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &rgba);
165 -+
166 -+ return g_strdup_printf ("%g %g %g", rgba.red, rgba.green, rgba.blue);
167 -+}
168 -+
169 -+void
170 - gkbd_indicator_config_refresh_style (GkbdIndicatorConfig * ind_config)
171 - {
172 - g_free (ind_config->font_family);
173 -diff --git a/libgnomekbd/gkbd-indicator-config.h b/libgnomekbd/gkbd-indicator-config.h
174 -index 2638895..9b9d935 100644
175 ---- a/libgnomekbd/gkbd-indicator-config.h
176 -+++ b/libgnomekbd/gkbd-indicator-config.h
177 -@@ -62,6 +62,16 @@ extern void gkbd_indicator_config_load (GkbdIndicatorConfig
178 - extern void gkbd_indicator_config_save (GkbdIndicatorConfig *
179 - applet_config);
180 -
181 -+extern void
182 -+gkbd_indicator_config_get_font_for_widget (GkbdIndicatorConfig * ind_config,
183 -+ GtkWidget * widget,
184 -+ gchar ** font_family,
185 -+ int * font_size);
186 -+
187 -+extern gchar *
188 -+gkbd_indicator_config_get_fg_color_for_widget (GkbdIndicatorConfig * ind_config,
189 -+ GtkWidget * widget);
190 -+
191 - extern void gkbd_indicator_config_refresh_style (GkbdIndicatorConfig *
192 - applet_config);
193 -
194 -diff --git a/libgnomekbd/gkbd-status.c b/libgnomekbd/gkbd-status.c
195 -index 5785e4c..276fe54 100644
196 ---- a/libgnomekbd/gkbd-status.c
197 -+++ b/libgnomekbd/gkbd-status.c
198 -@@ -59,22 +59,26 @@ static gki_globals globals;
199 -
200 - G_DEFINE_TYPE (GkbdStatus, gkbd_status, GTK_TYPE_STATUS_ICON)
201 -
202 -+typedef struct {
203 -+ GtkWidget *tray_icon;
204 -+} GkbdStatusPrivHack;
205 -+
206 - static void
207 - gkbd_status_global_init (void);
208 - static void
209 - gkbd_status_global_term (void);
210 - static GdkPixbuf *
211 --gkbd_status_prepare_drawing (int group);
212 -+gkbd_status_prepare_drawing (GkbdStatus * gki, int group);
213 - static void
214 - gkbd_status_set_current_page_for_group (GkbdStatus * gki, int group);
215 - static void
216 - gkbd_status_set_current_page (GkbdStatus * gki);
217 - static void
218 --gkbd_status_reinit_globals (void);
219 -+gkbd_status_reinit_globals (GkbdStatus * gki);
220 - static void
221 - gkbd_status_cleanup_icons (void);
222 - static void
223 --gkbd_status_fill_icons (void);
224 -+gkbd_status_fill_icons (GkbdStatus * gki);
225 - static void
226 - gkbd_status_set_tooltips (GkbdStatus * gki, const char *str);
227 -
228 -@@ -97,8 +101,8 @@ gkbd_status_cleanup_icons ()
229 - }
230 - }
231 -
232 --void
233 --gkbd_status_fill_icons ()
234 -+static void
235 -+gkbd_status_fill_icons (GkbdStatus * gki)
236 - {
237 - int grp;
238 - int total_groups =
239 -@@ -106,7 +110,7 @@ gkbd_status_fill_icons ()
240 - (globals.config));
241 -
242 - for (grp = 0; grp < total_groups; grp++) {
243 -- GdkPixbuf *page = gkbd_status_prepare_drawing (grp);
244 -+ GdkPixbuf *page = gkbd_status_prepare_drawing (gki, grp);
245 - globals.icons = g_slist_append (globals.icons, page);
246 - }
247 - }
248 -@@ -119,9 +123,12 @@ gkbd_status_activate (GkbdStatus * gki)
249 - }
250 -
251 - static void
252 --gkbd_status_render_cairo (cairo_t * cr, int group)
253 -+gkbd_status_render_cairo (GkbdStatusPrivHack * gkh, cairo_t * cr, int group)
254 - {
255 - double r, g, b;
256 -+ GdkColor *fg_color;
257 -+ gchar *font_family;
258 -+ int font_size;
259 - PangoFontDescription *pfd;
260 - PangoContext *pcc;
261 - PangoLayout *pl;
262 -@@ -146,28 +153,30 @@ gkbd_status_render_cairo (cairo_t * cr, int group)
263 - }
264 - }
265 -
266 -- if (ind_cfg->foreground_color != NULL &&
267 -- ind_cfg->foreground_color[0] != 0) {
268 -- if (sscanf
269 -- (ind_cfg->foreground_color, "%lg %lg %lg", &r,
270 -- &g, &b) == 3) {
271 -- cairo_set_source_rgb (cr, r, g, b);
272 -- }
273 -- }
274 -+ g_object_get (gkh->tray_icon, "fg-color", &fg_color, NULL);
275 -+ cairo_set_source_rgb (cr, fg_color->red, fg_color->green, fg_color->blue);
276 -+ gdk_color_free (fg_color);
277 -+
278 -+ gkbd_indicator_config_get_font_for_widget (ind_cfg,
279 -+ gkh->tray_icon,
280 -+ &font_family,
281 -+ &font_size);
282 -
283 -- if (ind_cfg->font_family != NULL && ind_cfg->font_family[0] != 0) {
284 -- cairo_select_font_face (cr, ind_cfg->font_family,
285 -+ if (font_family != NULL && font_family[0] != 0) {
286 -+ cairo_select_font_face (cr, font_family,
287 - CAIRO_FONT_SLANT_NORMAL,
288 - CAIRO_FONT_WEIGHT_NORMAL);
289 - }
290 -
291 - pfd = pango_font_description_new ();
292 -- pango_font_description_set_family (pfd, ind_cfg->font_family);
293 -+ pango_font_description_set_family (pfd, font_family);
294 - pango_font_description_set_style (pfd, PANGO_STYLE_NORMAL);
295 - pango_font_description_set_weight (pfd, PANGO_WEIGHT_NORMAL);
296 - pango_font_description_set_size (pfd,
297 - ind_cfg->font_size * PANGO_SCALE);
298 -
299 -+ g_free (font_family);
300 -+
301 - pcc = pango_cairo_create_context (cr);
302 -
303 - fo = cairo_font_options_copy (gdk_screen_get_font_options
304 -@@ -261,7 +270,7 @@ convert_bgra_to_rgba (guint8 const *src, guint8 * dst, int width,
305 - }
306 -
307 - static GdkPixbuf *
308 --gkbd_status_prepare_drawing (int group)
309 -+gkbd_status_prepare_drawing (GkbdStatus * gki, int group)
310 - {
311 - GError *gerror = NULL;
312 - char *image_filename;
313 -@@ -321,7 +330,8 @@ gkbd_status_prepare_drawing (int group)
314 - globals.current_height);
315 - unsigned char *cairo_data;
316 - guchar *pixbuf_data;
317 -- gkbd_status_render_cairo (cairo_create (cs), group);
318 -+ gkbd_status_render_cairo ((GkbdStatusPrivHack *) GTK_STATUS_ICON (gki)->priv,
319 -+ cairo_create (cs), group);
320 - cairo_data = cairo_image_surface_get_data (cs);
321 - #if 0
322 - char pngfilename[20];
323 -@@ -372,11 +382,11 @@ gkbd_status_update_tooltips (GkbdStatus * gki)
324 - }
325 - }
326 -
327 --void
328 --gkbd_status_reinit_globals ()
329 -+static void
330 -+gkbd_status_reinit_globals (GkbdStatus * gki)
331 - {
332 - gkbd_status_cleanup_icons ();
333 -- gkbd_status_fill_icons ();
334 -+ gkbd_status_fill_icons (gki);
335 - }
336 -
337 - void
338 -@@ -389,8 +399,11 @@ gkbd_status_reinit_ui (GkbdStatus * gki)
339 - static void
340 - gkbd_status_cfg_callback (GkbdConfiguration * configuration)
341 - {
342 -+ GSList *objects;
343 - xkl_debug (150, "Config changed: reinit ui\n");
344 -- gkbd_status_reinit_globals ();
345 -+ objects = gkbd_configuration_get_all_objects (configuration);
346 -+ if (objects)
347 -+ gkbd_status_reinit_globals (objects->data);
348 - ForAllObjects (configuration) {
349 - gkbd_status_reinit_ui (GKBD_STATUS (gki));
350 - } NextObject ()
351 -@@ -499,7 +512,7 @@ gkbd_status_size_changed (GkbdStatus * gki, gint size)
352 - if (globals.current_height != size) {
353 - globals.current_height = size;
354 - globals.current_width = size * 3 / 2;
355 -- gkbd_status_reinit_globals ();
356 -+ gkbd_status_reinit_globals (gki);
357 - gkbd_status_reinit_ui (gki);
358 - }
359 - }
360 -@@ -511,7 +524,7 @@ gkbd_status_theme_changed (GtkSettings * settings, GParamSpec * pspec,
361 - xkl_debug (150, "Theme changed\n");
362 - gkbd_indicator_config_refresh_style
363 - (gkbd_configuration_get_indicator_config (globals.config));
364 -- gkbd_status_reinit_globals ();
365 -+ gkbd_status_reinit_globals (gki);
366 - gkbd_status_reinit_ui (gki);
367 - }
368 -
369 ---
370 -1.7.4.1
371 \ No newline at end of file
372
373 diff --git a/gnome-base/libgnomekbd/libgnomekbd-3.0.0.ebuild b/gnome-base/libgnomekbd/libgnomekbd-3.0.0.1.ebuild
374 similarity index 85%
375 rename from gnome-base/libgnomekbd/libgnomekbd-3.0.0.ebuild
376 rename to gnome-base/libgnomekbd/libgnomekbd-3.0.0.1.ebuild
377 index 98e7ffb..ab94e32 100644
378 --- a/gnome-base/libgnomekbd/libgnomekbd-3.0.0.ebuild
379 +++ b/gnome-base/libgnomekbd/libgnomekbd-3.0.0.1.ebuild
380 @@ -34,12 +34,7 @@ pkg_setup() {
381 G2CONF="${G2CONF}
382 --disable-static
383 --disable-schemas-compile
384 + $(use_enable introspection)
385 $(use_enable test tests)"
386 DOCS="AUTHORS ChangeLog NEWS README"
387 }
388 -
389 -src_prepare() {
390 - # https://bugzilla.gnome.org/show_bug.cgi?id=642703, not needed for next release
391 - epatch "${FILESDIR}/${P}-gkbdstatus-text-color.patch"
392 - gnome2_src_prepare
393 -}
394
395 diff --git a/gnome-base/libgnomekbd/libgnomekbd-9999.ebuild b/gnome-base/libgnomekbd/libgnomekbd-9999.ebuild
396 index 955ec51..ab94e32 100644
397 --- a/gnome-base/libgnomekbd/libgnomekbd-9999.ebuild
398 +++ b/gnome-base/libgnomekbd/libgnomekbd-9999.ebuild
399 @@ -6,7 +6,7 @@ EAPI="3"
400 GCONF_DEBUG="no"
401 GNOME2_LA_PUNT="yes"
402
403 -inherit gnome2
404 +inherit eutils gnome2
405
406 DESCRIPTION="Gnome keyboard configuration library"
407 HOMEPAGE="http://www.gnome.org"
408 @@ -34,14 +34,7 @@ pkg_setup() {
409 G2CONF="${G2CONF}
410 --disable-static
411 --disable-schemas-compile
412 + $(use_enable introspection)
413 $(use_enable test tests)"
414 DOCS="AUTHORS ChangeLog NEWS README"
415 }
416 -
417 -#src_compile() {
418 - # FreeBSD doesn't like -j, upstream? bug #176517
419 - # FIXME: Please re-test and notify us if still valid,
420 - # disabling for now
421 - # use x86-fbsd && MAKEOPTS="${MAKEOPTS} -j1"
422 -# gnome2_src_compile
423 -#}