Status: | Merged |
---|---|
Merged at revision: | 78 |
Proposed branch: | lp:~ubuntu-desktop/ido/gtk3 |
Merge into: | lp:ido/0.3 |
Diff against target: |
783 lines (+159/-88) 15 files modified
Makefile.am (+12/-6) configure.ac (+16/-2) example/Makefile.am (+8/-2) libido3.pc.in (+11/-0) src/Makefile.am (+13/-7) src/idocalendarmenuitem.c (+35/-17) src/idoentrymenuitem.c (+35/-13) src/idomessagedialog.c (+9/-11) src/idomessagedialog.h (+1/-1) src/idorange.c (+1/-1) src/idorange.h (+1/-1) src/idoscalemenuitem.c (+12/-20) src/idoscalemenuitem.h (+3/-3) src/idotimeline.c (+1/-3) src/idotimeline.h (+1/-1) |
To merge this branch: | bzr merge lp:~ubuntu-desktop/ido/gtk3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Canonical Desktop Experience Team | Pending | ||
Review via email: mp+63167@code.launchpad.net |
Commit message
Description of the change
Here's a branch that allows building libido3, a gtk3 version of libido. Ken and I have worked on it a bit.
The biggest issues I see are:
* Slight API changes (GtkObject -> GtkAdjustment) in one of the function parameters. Old code will still work, but will likely throw a warning. That can be #if'd for the two gtk versions to avoid it, but it doesn't seem that bad a breakage.
* In idoscalemenuitem.c, I dropped some code that made sure GtkRange saw its own 'event_window' when we passed it a button release event. There was no way to replicate the logic in gtk3. This logic was some black magic to ensure that the GtkRange code took our x and y event values without question. With this branch, it will query for mouse position rather than taking the x and y from the event struct. How badly does that break things (i.e. why was the older code there)?
Cody Russell (bratsche) wrote : | # |
Michael Terry (mterry) wrote : | # |
Oh my, I didn't see your reply until now.
For the event_window change, if I have a scale widget in a GtkWindow for testing, I don't see any difference between this branch and trunk.
Looking into building an arm version...
- 85. By Michael Terry
-
use const not G_CONST_RETURN
Michael Terry (mterry) wrote : | # |
BTW, it built on an ARM porter. I uploaded a distro-patched version too.
Preview Diff
1 | === modified file 'Makefile.am' |
2 | --- Makefile.am 2010-01-19 22:02:50 +0000 |
3 | +++ Makefile.am 2011-06-20 13:36:12 +0000 |
4 | @@ -1,3 +1,9 @@ |
5 | +if USE_GTK3 |
6 | +VER=3 |
7 | +else |
8 | +VER= |
9 | +endif |
10 | + |
11 | ACLOCAL_AMFLAGS = -I build/autotools |
12 | |
13 | V = @ |
14 | @@ -6,14 +12,14 @@ |
15 | |
16 | SUBDIRS = build src example |
17 | |
18 | -libido-0.1.pc: libido.pc |
19 | - $(QUIET_GEN) cp -f libido.pc libido-0.1.pc |
20 | +%-0.1.pc: %.pc |
21 | + $(QUIET_GEN) cp -f $< $@ |
22 | |
23 | pkgconfigdir = $(libdir)/pkgconfig |
24 | -pkgconfig_DATA = libido-0.1.pc |
25 | +pkgconfig_DATA = libido$(VER)-0.1.pc |
26 | |
27 | -CLEANFILES = libido-0.1.pc |
28 | -DISTCLEANFILES = libido.pc |
29 | -EXTRA_DIST = libido.pc.in |
30 | +CLEANFILES = libido-0.1.pc libido3-0.1.pc |
31 | +DISTCLEANFILES = libido.pc libido3.pc |
32 | +EXTRA_DIST = libido.pc.in libido3.pc.in |
33 | |
34 | DISTCHECK_CONFIGURE_FLAGS = --disable-gtk-doc |
35 | |
36 | === modified file 'configure.ac' |
37 | --- configure.ac 2011-03-16 17:20:48 +0000 |
38 | +++ configure.ac 2011-06-20 13:36:12 +0000 |
39 | @@ -24,7 +24,7 @@ |
40 | |
41 | AM_CONFIG_HEADER([config.h]) |
42 | |
43 | -AM_INIT_AUTOMAKE([1.9]) |
44 | +AM_INIT_AUTOMAKE([1.9 foreign]) |
45 | |
46 | IDO_MAJOR_VERSION=ido_major_version |
47 | IDO_MINOR_VERSION=ido_minor_version |
48 | @@ -52,9 +52,11 @@ |
49 | |
50 | # Checks for programs |
51 | AC_PROG_CC |
52 | +AM_PROG_CC_C_O |
53 | AC_DISABLE_STATIC |
54 | AC_PROG_LIBTOOL |
55 | AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums]) |
56 | +PKG_PROG_PKG_CONFIG |
57 | |
58 | # Checks for header files |
59 | AC_HEADER_STDC |
60 | @@ -68,7 +70,18 @@ |
61 | AC_FUNC_MMAP |
62 | AC_CHECK_FUNCS([memset munmap strcasecmp strdup]) |
63 | |
64 | -PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.19.7) |
65 | +AC_ARG_WITH([gtk], |
66 | + [AS_HELP_STRING([--with-gtk], |
67 | + [Which version of gtk to use @<:@default=3@:>@])], |
68 | + [], |
69 | + [with_gtk=3]) |
70 | +AM_CONDITIONAL(USE_GTK3, [test "x$with_gtk" = x3]) |
71 | + |
72 | +if test "x$with_gtk" = "x2"; then |
73 | + PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.19.7) |
74 | +else |
75 | + PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0.0) |
76 | +fi |
77 | AC_SUBST(GTK_CFLAGS) |
78 | AC_SUBST(GTK_LIBS) |
79 | |
80 | @@ -114,6 +127,7 @@ |
81 | src/Makefile |
82 | example/Makefile |
83 | libido.pc |
84 | + libido3.pc |
85 | ]) |
86 | |
87 | AC_OUTPUT |
88 | |
89 | === modified file 'example/Makefile.am' |
90 | --- example/Makefile.am 2011-01-18 17:12:19 +0000 |
91 | +++ example/Makefile.am 2011-06-20 13:36:12 +0000 |
92 | @@ -1,3 +1,9 @@ |
93 | +if USE_GTK3 |
94 | +VER=3 |
95 | +else |
96 | +VER= |
97 | +endif |
98 | + |
99 | noinst_PROGRAMS = \ |
100 | messagedialog \ |
101 | menus |
102 | @@ -24,6 +30,6 @@ |
103 | $(GTK_CFLAGS) \ |
104 | $(MAINTAINER_CFLAGS) |
105 | |
106 | -messagedialog_LDADD = $(top_builddir)/src/libido-0.1.la $(GTK_LIBS) |
107 | +messagedialog_LDADD = $(top_builddir)/src/libido$(VER)-0.1.la $(GTK_LIBS) |
108 | |
109 | -menus_LDADD = $(top_builddir)/src/libido-0.1.la $(GTK_LIBS) |
110 | +menus_LDADD = $(top_builddir)/src/libido$(VER)-0.1.la $(GTK_LIBS) |
111 | |
112 | === added file 'libido3.pc.in' |
113 | --- libido3.pc.in 1970-01-01 00:00:00 +0000 |
114 | +++ libido3.pc.in 2011-06-20 13:36:12 +0000 |
115 | @@ -0,0 +1,11 @@ |
116 | +prefix=@prefix@ |
117 | +exec_prefix=@exec_prefix@ |
118 | +libdir=@libdir@ |
119 | +includedir=@includedir@ |
120 | + |
121 | +Name: libido |
122 | +Description: Ayatana Indicator Display Objects |
123 | +Version: @VERSION@ |
124 | +Libs: -L${libdir} -lido3-0.1 |
125 | +Cflags: -I${includedir}/libido3-0.1 |
126 | +Requires: gtk+-3.0 |
127 | |
128 | === modified file 'src/Makefile.am' |
129 | --- src/Makefile.am 2011-01-18 17:12:19 +0000 |
130 | +++ src/Makefile.am 2011-06-20 13:36:12 +0000 |
131 | @@ -1,3 +1,11 @@ |
132 | +if USE_GTK3 |
133 | +VER=3 |
134 | +lib_LTLIBRARIES = libido3-0.1.la |
135 | +else |
136 | +VER= |
137 | +lib_LTLIBRARIES = libido-0.1.la |
138 | +endif |
139 | + |
140 | ido_built_public_sources = \ |
141 | idotypebuiltins.h |
142 | |
143 | @@ -40,16 +48,13 @@ |
144 | -DLIBDIR=\"$(libdir)"\" \ |
145 | -DG_DISABLE_DEPRECATED \ |
146 | -DGDK_PIXBUF_DISABLE_DEPRECATED \ |
147 | - -DGDK_DISABLE_DEPRECATED \ |
148 | - -DGTK_DISABLE_DEPRECATED |
149 | + -DGDK_DISABLE_DEPRECATED |
150 | |
151 | AM_CPPFLAGS = \ |
152 | $(GCC_FLAGS) \ |
153 | $(GTK_CFLAGS) \ |
154 | $(MAINTAINER_CFLAGS) |
155 | |
156 | -lib_LTLIBRARIES = libido-0.1.la |
157 | - |
158 | libido_0_1_la_SOURCES = \ |
159 | idotypebuiltins.c \ |
160 | idocalendarmenuitem.c \ |
161 | @@ -58,8 +63,9 @@ |
162 | idorange.c \ |
163 | idoscalemenuitem.c \ |
164 | idotimeline.c |
165 | +libido3_0_1_la_SOURCES = $(libido_0_1_la_SOURCES) |
166 | |
167 | -libidoincludedir=$(includedir)/libido-0.1/libido |
168 | +libidoincludedir=$(includedir)/libido$(VER)-0.1/libido |
169 | |
170 | libidoinclude_HEADERS = \ |
171 | idocalendarmenuitem.h \ |
172 | @@ -72,8 +78,8 @@ |
173 | |
174 | libido_0_1_la_LIBADD = $(GTK_LIBS) |
175 | libido_0_1_la_LDFLAGS = $(GTK_LT_LDFLAGS) |
176 | - |
177 | -idoheadersdir = $(includedir)/ido-0.1/ido |
178 | +libido3_0_1_la_LIBADD = $(libido_0_1_la_LIBADD) |
179 | +libido3_0_1_la_LDFLAGS = $(libido_0_1_la_LDFLAGS) |
180 | |
181 | DISTCLEANFILES = \ |
182 | stamp-idotypebuiltins.h \ |
183 | |
184 | === modified file 'src/idocalendarmenuitem.c' |
185 | --- src/idocalendarmenuitem.c 2011-03-15 14:02:37 +0000 |
186 | +++ src/idocalendarmenuitem.c 2011-06-20 13:36:12 +0000 |
187 | @@ -26,8 +26,13 @@ |
188 | #include <gdk/gdkkeysyms.h> |
189 | #include "idocalendarmenuitem.h" |
190 | |
191 | +#if GTK_CHECK_VERSION (3, 0, 0) |
192 | +static void ido_calendar_menu_item_select (GtkMenuItem *item); |
193 | +static void ido_calendar_menu_item_deselect (GtkMenuItem *item); |
194 | +#else |
195 | static void ido_calendar_menu_item_select (GtkItem *item); |
196 | static void ido_calendar_menu_item_deselect (GtkItem *item); |
197 | +#endif |
198 | static gboolean ido_calendar_menu_item_button_release (GtkWidget *widget, |
199 | GdkEventButton *event); |
200 | static gboolean ido_calendar_menu_item_button_press (GtkWidget *widget, |
201 | @@ -65,18 +70,27 @@ |
202 | GObjectClass *gobject_class; |
203 | GtkWidgetClass *widget_class; |
204 | GtkMenuItemClass *menu_item_class; |
205 | +#if ! GTK_CHECK_VERSION (3, 0, 0) |
206 | GtkItemClass *item_class; |
207 | +#endif |
208 | |
209 | gobject_class = G_OBJECT_CLASS (klass); |
210 | widget_class = GTK_WIDGET_CLASS (klass); |
211 | menu_item_class = GTK_MENU_ITEM_CLASS (klass); |
212 | +#if ! GTK_CHECK_VERSION (3, 0, 0) |
213 | item_class = GTK_ITEM_CLASS (klass); |
214 | +#endif |
215 | |
216 | widget_class->button_release_event = ido_calendar_menu_item_button_release; |
217 | widget_class->button_press_event = ido_calendar_menu_item_button_press; |
218 | |
219 | +#if GTK_CHECK_VERSION (3, 0, 0) |
220 | + menu_item_class->select = ido_calendar_menu_item_select; |
221 | + menu_item_class->deselect = ido_calendar_menu_item_deselect; |
222 | +#else |
223 | item_class->select = ido_calendar_menu_item_select; |
224 | item_class->deselect = ido_calendar_menu_item_deselect; |
225 | +#endif |
226 | |
227 | menu_item_class->hide_on_activate = TRUE; |
228 | |
229 | @@ -101,12 +115,6 @@ |
230 | ido_calendar_menu_item_init (IdoCalendarMenuItem *item) |
231 | { |
232 | IdoCalendarMenuItemPrivate *priv; |
233 | - GtkBorder border; |
234 | - |
235 | - border.left = 4; |
236 | - border.right = 4; |
237 | - border.top = 2; |
238 | - border.bottom = 2; |
239 | |
240 | priv = item->priv = IDO_CALENDAR_MENU_ITEM_GET_PRIVATE (item); |
241 | |
242 | @@ -143,7 +151,7 @@ |
243 | gtk_widget_grab_focus (widget); |
244 | |
245 | event->focus_change.type = GDK_FOCUS_CHANGE; |
246 | - event->focus_change.window = g_object_ref (widget->window); |
247 | + event->focus_change.window = g_object_ref (gtk_widget_get_window (widget)); |
248 | event->focus_change.in = in; |
249 | |
250 | gtk_widget_event (widget, event); |
251 | @@ -168,9 +176,9 @@ |
252 | gtk_widget_event (calendar, |
253 | ((GdkEvent *)(void*)(event))); |
254 | |
255 | - if (calendar->window != NULL) |
256 | + if (gtk_widget_get_window (calendar) != NULL) |
257 | { |
258 | - gdk_window_raise (calendar->window); |
259 | + gdk_window_raise (gtk_widget_get_window (calendar)); |
260 | } |
261 | |
262 | if (!gtk_widget_has_focus (calendar)) |
263 | @@ -178,7 +186,7 @@ |
264 | gtk_widget_grab_focus (calendar); |
265 | } |
266 | |
267 | - return event->keyval != GDK_Return; |
268 | + return event->keyval != GDK_KEY_Return; |
269 | } |
270 | |
271 | return FALSE; |
272 | @@ -192,9 +200,9 @@ |
273 | |
274 | if (event->button == 1) |
275 | { |
276 | - if (calendar->window != NULL) |
277 | + if (gtk_widget_get_window (calendar) != NULL) |
278 | { |
279 | - gdk_window_raise (calendar->window); |
280 | + gdk_window_raise (gtk_widget_get_window (calendar)); |
281 | } |
282 | |
283 | if (!gtk_widget_has_focus (calendar)) |
284 | @@ -224,7 +232,11 @@ |
285 | } |
286 | |
287 | static void |
288 | +#if GTK_CHECK_VERSION (3, 0, 0) |
289 | +ido_calendar_menu_item_select (GtkMenuItem *item) |
290 | +#else |
291 | ido_calendar_menu_item_select (GtkItem *item) |
292 | +#endif |
293 | { |
294 | IDO_CALENDAR_MENU_ITEM (item)->priv->selected = TRUE; |
295 | |
296 | @@ -232,7 +244,11 @@ |
297 | } |
298 | |
299 | static void |
300 | +#if GTK_CHECK_VERSION (3, 0, 0) |
301 | +ido_calendar_menu_item_deselect (GtkMenuItem *item) |
302 | +#else |
303 | ido_calendar_menu_item_deselect (GtkItem *item) |
304 | +#endif |
305 | { |
306 | IDO_CALENDAR_MENU_ITEM (item)->priv->selected = FALSE; |
307 | |
308 | @@ -244,12 +260,12 @@ |
309 | calendar_realized_cb (GtkWidget *widget, |
310 | IdoCalendarMenuItem *item) |
311 | { |
312 | - if (widget->window != NULL) |
313 | + if (gtk_widget_get_window (widget) != NULL) |
314 | { |
315 | - gdk_window_raise (widget->window); |
316 | + gdk_window_raise (gtk_widget_get_window (widget)); |
317 | } |
318 | |
319 | - g_signal_connect (GTK_WIDGET (item)->parent, |
320 | + g_signal_connect (gtk_widget_get_parent (GTK_WIDGET (item)), |
321 | "key-press-event", |
322 | G_CALLBACK (ido_calendar_menu_item_key_press), |
323 | item); |
324 | @@ -328,7 +344,8 @@ |
325 | { |
326 | g_return_val_if_fail(IDO_IS_CALENDAR_MENU_ITEM(menuitem), FALSE); |
327 | |
328 | - return gtk_calendar_mark_day(GTK_CALENDAR (menuitem->priv->calendar), day); |
329 | + gtk_calendar_mark_day(GTK_CALENDAR (menuitem->priv->calendar), day); |
330 | + return TRUE; |
331 | } |
332 | |
333 | gboolean |
334 | @@ -336,7 +353,8 @@ |
335 | { |
336 | g_return_val_if_fail(IDO_IS_CALENDAR_MENU_ITEM(menuitem), FALSE); |
337 | |
338 | - return gtk_calendar_unmark_day(GTK_CALENDAR (menuitem->priv->calendar), day); |
339 | + gtk_calendar_unmark_day(GTK_CALENDAR (menuitem->priv->calendar), day); |
340 | + return TRUE; |
341 | } |
342 | |
343 | void |
344 | |
345 | === modified file 'src/idoentrymenuitem.c' |
346 | --- src/idoentrymenuitem.c 2010-09-10 21:26:16 +0000 |
347 | +++ src/idoentrymenuitem.c 2011-06-20 13:36:12 +0000 |
348 | @@ -26,8 +26,13 @@ |
349 | #include <gdk/gdkkeysyms.h> |
350 | #include "idoentrymenuitem.h" |
351 | |
352 | +#if GTK_CHECK_VERSION (3, 0, 0) |
353 | +static void ido_entry_menu_item_select (GtkMenuItem *item); |
354 | +static void ido_entry_menu_item_deselect (GtkMenuItem *item); |
355 | +#else |
356 | static void ido_entry_menu_item_select (GtkItem *item); |
357 | static void ido_entry_menu_item_deselect (GtkItem *item); |
358 | +#endif |
359 | static gboolean ido_entry_menu_item_button_release (GtkWidget *widget, |
360 | GdkEventButton *event); |
361 | static gboolean ido_entry_menu_item_key_press (GtkWidget *widget, |
362 | @@ -60,18 +65,27 @@ |
363 | GObjectClass *gobject_class; |
364 | GtkWidgetClass *widget_class; |
365 | GtkMenuItemClass *menu_item_class; |
366 | +#if ! GTK_CHECK_VERSION (3, 0, 0) |
367 | GtkItemClass *item_class; |
368 | +#endif |
369 | |
370 | gobject_class = G_OBJECT_CLASS (klass); |
371 | widget_class = GTK_WIDGET_CLASS (klass); |
372 | menu_item_class = GTK_MENU_ITEM_CLASS (klass); |
373 | +#if ! GTK_CHECK_VERSION (3, 0, 0) |
374 | item_class = GTK_ITEM_CLASS (klass); |
375 | +#endif |
376 | |
377 | widget_class->button_release_event = ido_entry_menu_item_button_release; |
378 | widget_class->button_press_event = ido_entry_menu_item_button_press; |
379 | |
380 | +#if GTK_CHECK_VERSION (3, 0, 0) |
381 | + menu_item_class->select = ido_entry_menu_item_select; |
382 | + menu_item_class->deselect = ido_entry_menu_item_deselect; |
383 | +#else |
384 | item_class->select = ido_entry_menu_item_select; |
385 | item_class->deselect = ido_entry_menu_item_deselect; |
386 | +#endif |
387 | |
388 | menu_item_class->hide_on_activate = TRUE; |
389 | |
390 | @@ -118,11 +132,11 @@ |
391 | { |
392 | switch (key) |
393 | { |
394 | - case GDK_Escape: |
395 | - case GDK_Up: |
396 | - case GDK_Down: |
397 | - case GDK_KP_Up: |
398 | - case GDK_KP_Down: |
399 | + case GDK_KEY_Escape: |
400 | + case GDK_KEY_Up: |
401 | + case GDK_KEY_Down: |
402 | + case GDK_KEY_KP_Up: |
403 | + case GDK_KEY_KP_Down: |
404 | return FALSE; |
405 | |
406 | default: |
407 | @@ -145,11 +159,11 @@ |
408 | gtk_widget_event (entry, |
409 | ((GdkEvent *)(void*)(event))); |
410 | |
411 | - /* We've handled the event, but if the key was GDK_Return |
412 | + /* We've handled the event, but if the key was GDK_KEY_Return |
413 | * we still want to forward the event up to the menu shell |
414 | * to ensure that the menuitem receives the activate signal. |
415 | */ |
416 | - return event->keyval != GDK_Return; |
417 | + return event->keyval != GDK_KEY_Return; |
418 | } |
419 | |
420 | return FALSE; |
421 | @@ -164,7 +178,7 @@ |
422 | g_object_ref (widget); |
423 | |
424 | event->focus_change.type = GDK_FOCUS_CHANGE; |
425 | - event->focus_change.window = g_object_ref (widget->window); |
426 | + event->focus_change.window = g_object_ref (gtk_widget_get_window (widget)); |
427 | event->focus_change.in = in; |
428 | |
429 | gtk_widget_event (widget, event); |
430 | @@ -183,9 +197,9 @@ |
431 | |
432 | if (event->button == 1) |
433 | { |
434 | - if (entry->window != NULL) |
435 | + if (gtk_widget_get_window (entry) != NULL) |
436 | { |
437 | - gdk_window_raise (entry->window); |
438 | + gdk_window_raise (gtk_widget_get_window (entry)); |
439 | } |
440 | |
441 | if (!gtk_widget_has_focus (entry)) |
442 | @@ -215,7 +229,11 @@ |
443 | } |
444 | |
445 | static void |
446 | +#if GTK_CHECK_VERSION (3, 0, 0) |
447 | +ido_entry_menu_item_select (GtkMenuItem *item) |
448 | +#else |
449 | ido_entry_menu_item_select (GtkItem *item) |
450 | +#endif |
451 | { |
452 | IDO_ENTRY_MENU_ITEM (item)->priv->selected = TRUE; |
453 | |
454 | @@ -223,7 +241,11 @@ |
455 | } |
456 | |
457 | static void |
458 | +#if GTK_CHECK_VERSION (3, 0, 0) |
459 | +ido_entry_menu_item_deselect (GtkMenuItem *item) |
460 | +#else |
461 | ido_entry_menu_item_deselect (GtkItem *item) |
462 | +#endif |
463 | { |
464 | IDO_ENTRY_MENU_ITEM (item)->priv->selected = FALSE; |
465 | |
466 | @@ -235,12 +257,12 @@ |
467 | entry_realized_cb (GtkWidget *widget, |
468 | IdoEntryMenuItem *item) |
469 | { |
470 | - if (widget->window != NULL) |
471 | + if (gtk_widget_get_window (widget) != NULL) |
472 | { |
473 | - gdk_window_raise (widget->window); |
474 | + gdk_window_raise (gtk_widget_get_window (widget)); |
475 | } |
476 | |
477 | - g_signal_connect (GTK_WIDGET (item)->parent, |
478 | + g_signal_connect (gtk_widget_get_parent (GTK_WIDGET (item)), |
479 | "key-press-event", |
480 | G_CALLBACK (ido_entry_menu_item_key_press), |
481 | item); |
482 | |
483 | === modified file 'src/idomessagedialog.c' |
484 | --- src/idomessagedialog.c 2010-07-08 18:49:37 +0000 |
485 | +++ src/idomessagedialog.c 2011-06-20 13:36:12 +0000 |
486 | @@ -82,7 +82,7 @@ |
487 | * |
488 | * See: https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/240794 |
489 | */ |
490 | - gdk_window_set_functions (widget->window, |
491 | + gdk_window_set_functions (gtk_widget_get_window (widget), |
492 | GDK_FUNC_RESIZE | GDK_FUNC_MOVE); |
493 | |
494 | ido_message_dialog_get_secondary_label (IDO_MESSAGE_DIALOG (widget)); |
495 | @@ -166,14 +166,14 @@ |
496 | IdoTimeline *timeline; |
497 | IdoMessageDialogMorphContext *context; |
498 | |
499 | - start = GTK_WIDGET (dialog)->requisition; |
500 | + gtk_widget_get_requisition (GTK_WIDGET (dialog), &start); |
501 | |
502 | priv->expanded = TRUE; |
503 | |
504 | gtk_widget_show (priv->action_area); |
505 | gtk_widget_show (priv->secondary_label); |
506 | |
507 | - gtk_widget_size_request (GTK_WIDGET (dialog), &end); |
508 | + gtk_widget_get_requisition (GTK_WIDGET (dialog), &end); |
509 | |
510 | gtk_widget_hide (priv->action_area); |
511 | gtk_widget_hide (priv->secondary_label); |
512 | @@ -209,7 +209,7 @@ |
513 | event_box = gtk_event_box_new (); |
514 | gtk_widget_show (event_box); |
515 | |
516 | - vbox = GTK_DIALOG (object)->vbox; |
517 | + vbox = gtk_dialog_get_content_area (GTK_DIALOG (object)); |
518 | priv->action_area = gtk_dialog_get_action_area (GTK_DIALOG (object)); |
519 | |
520 | g_object_ref (G_OBJECT (vbox)); |
521 | @@ -237,11 +237,7 @@ |
522 | static void |
523 | ido_message_dialog_init (IdoMessageDialog *dialog) |
524 | { |
525 | - IdoMessageDialogPrivate *priv; |
526 | - |
527 | gtk_window_set_focus_on_map (GTK_WINDOW (dialog), FALSE); |
528 | - |
529 | - priv = IDO_MESSAGE_DIALOG_GET_PRIVATE (dialog); |
530 | } |
531 | |
532 | /** |
533 | @@ -284,11 +280,13 @@ |
534 | NULL); |
535 | dialog = GTK_DIALOG (widget); |
536 | |
537 | +#if ! GTK_CHECK_VERSION(3, 0, 0) |
538 | if (flags & GTK_DIALOG_NO_SEPARATOR) |
539 | { |
540 | g_warning ("The GTK_DIALOG_NO_SEPARATOR flag cannot be used for IdoMessageDialog"); |
541 | flags &= ~GTK_DIALOG_NO_SEPARATOR; |
542 | } |
543 | +#endif |
544 | |
545 | if (message_format) |
546 | { |
547 | @@ -296,8 +294,7 @@ |
548 | msg = g_strdup_vprintf (message_format, args); |
549 | va_end (args); |
550 | |
551 | - gtk_label_set_text (GTK_LABEL (GTK_MESSAGE_DIALOG (widget)->label), |
552 | - msg); |
553 | + g_object_set (G_OBJECT (widget), "text", msg, NULL); |
554 | |
555 | g_free (msg); |
556 | } |
557 | @@ -397,7 +394,8 @@ |
558 | |
559 | label = GTK_LABEL (vlist->data); |
560 | |
561 | - if (strcmp ((primary ? text : secondary_text), label->label) == 0) |
562 | + if (strcmp ((primary ? text : secondary_text), |
563 | + gtk_label_get_label (label)) == 0) |
564 | { |
565 | return GTK_WIDGET (label); |
566 | } |
567 | |
568 | === modified file 'src/idomessagedialog.h' |
569 | --- src/idomessagedialog.h 2010-07-08 16:11:17 +0000 |
570 | +++ src/idomessagedialog.h 2011-06-20 13:36:12 +0000 |
571 | @@ -29,7 +29,7 @@ |
572 | #ifndef __IDO_MESSAGE_DIALOG_H__ |
573 | #define __IDO_MESSAGE_DIALOG_H__ |
574 | |
575 | -#include <gtk/gtkmessagedialog.h> |
576 | +#include <gtk/gtk.h> |
577 | |
578 | #define IDO_TYPE_MESSAGE_DIALOG (ido_message_dialog_get_type ()) |
579 | #define IDO_MESSAGE_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), IDO_TYPE_MESSAGE_DIALOG, IdoMessageDialog)) |
580 | |
581 | === modified file 'src/idorange.c' |
582 | --- src/idorange.c 2010-08-03 19:47:05 +0000 |
583 | +++ src/idorange.c 2011-06-20 13:36:12 +0000 |
584 | @@ -179,7 +179,7 @@ |
585 | * Creates a new #IdoRange widget. |
586 | **/ |
587 | GtkWidget * |
588 | -ido_range_new (GtkObject *adj, |
589 | +ido_range_new (GtkAdjustment *adj, |
590 | IdoRangeStyle style) |
591 | { |
592 | g_return_val_if_fail (GTK_IS_ADJUSTMENT (adj), NULL); |
593 | |
594 | === modified file 'src/idorange.h' |
595 | --- src/idorange.h 2010-08-03 19:47:05 +0000 |
596 | +++ src/idorange.h 2011-06-20 13:36:12 +0000 |
597 | @@ -64,7 +64,7 @@ |
598 | |
599 | GType ido_range_get_type (void) G_GNUC_CONST; |
600 | |
601 | -GtkWidget* ido_range_new (GtkObject *adj, |
602 | +GtkWidget* ido_range_new (GtkAdjustment *adj, |
603 | IdoRangeStyle style); |
604 | |
605 | G_END_DECLS |
606 | |
607 | === modified file 'src/idoscalemenuitem.c' |
608 | --- src/idoscalemenuitem.c 2010-10-07 17:19:20 +0000 |
609 | +++ src/idoscalemenuitem.c 2011-06-20 13:36:12 +0000 |
610 | @@ -185,8 +185,8 @@ |
611 | priv->right_padding = primary_padding; |
612 | } |
613 | |
614 | - priv->child_allocation.x = GTK_CONTAINER (widget)->border_width + widget->style->xthickness; |
615 | - priv->child_allocation.y = GTK_CONTAINER (widget)->border_width + widget->style->ythickness; |
616 | + priv->child_allocation.x = gtk_container_get_border_width (GTK_CONTAINER (widget)) + gtk_widget_get_style (widget)->xthickness; |
617 | + priv->child_allocation.y = gtk_container_get_border_width (GTK_CONTAINER (widget)) + gtk_widget_get_style (widget)->ythickness; |
618 | |
619 | priv->child_allocation.x += horizontal_padding; |
620 | priv->child_allocation.x += priv->toggle_size; |
621 | @@ -213,7 +213,7 @@ |
622 | { |
623 | IdoScaleMenuItem *self = IDO_SCALE_MENU_ITEM (object); |
624 | IdoScaleMenuItemPrivate *priv = GET_PRIVATE (self); |
625 | - GtkObject *adj = gtk_adjustment_new (0.0, 0.0, 100.0, 1.0, 10.0, 0.0); |
626 | + GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 100.0, 1.0, 10.0, 0.0)); |
627 | IdoRangeStyle range_style; |
628 | GtkWidget *hbox; |
629 | |
630 | @@ -261,7 +261,6 @@ |
631 | ido_scale_menu_item_class_init (IdoScaleMenuItemClass *item_class) |
632 | { |
633 | GObjectClass *gobject_class = G_OBJECT_CLASS (item_class); |
634 | - GtkObjectClass *object_class = GTK_OBJECT_CLASS (item_class); |
635 | GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (item_class); |
636 | |
637 | widget_class->button_press_event = ido_scale_menu_item_button_press_event; |
638 | @@ -325,7 +324,7 @@ |
639 | g_cclosure_marshal_VOID__VOID, |
640 | G_TYPE_NONE, 0); |
641 | |
642 | - g_type_class_add_private (object_class, sizeof (IdoScaleMenuItemPrivate)); |
643 | + g_type_class_add_private (item_class, sizeof (IdoScaleMenuItemPrivate)); |
644 | } |
645 | |
646 | static void |
647 | @@ -471,11 +470,9 @@ |
648 | { |
649 | IdoScaleMenuItemPrivate *priv = GET_PRIVATE (menuitem); |
650 | GtkWidget *scale = priv->scale; |
651 | - GtkWidget *parent; |
652 | gdouble x; |
653 | |
654 | // can we block emissions of "grab-notify" on parent?? |
655 | - parent = gtk_widget_get_parent (GTK_WIDGET (menuitem)); |
656 | |
657 | translate_event_coordinates (menuitem, event->x, &x); |
658 | event->x = x; |
659 | @@ -505,7 +502,6 @@ |
660 | { |
661 | IdoScaleMenuItemPrivate *priv = GET_PRIVATE (menuitem); |
662 | GtkWidget *scale = priv->scale; |
663 | - GdkWindow *tmp = event->window; |
664 | gdouble x; |
665 | |
666 | if (event->x > priv->child_allocation.x && |
667 | @@ -554,8 +550,6 @@ |
668 | return TRUE; |
669 | } |
670 | |
671 | - event->window = GTK_RANGE (scale)->event_window; |
672 | - |
673 | translate_event_coordinates (menuitem, event->x, &x); |
674 | event->x = x; |
675 | |
676 | @@ -565,8 +559,6 @@ |
677 | gtk_widget_event (scale, |
678 | ((GdkEvent *)(void*)(event))); |
679 | |
680 | - event->window = tmp; |
681 | - |
682 | if (priv->grabbed) |
683 | { |
684 | priv->grabbed = FALSE; |
685 | @@ -688,13 +680,13 @@ |
686 | gdouble max, |
687 | gdouble step) |
688 | { |
689 | - GtkObject *adjustment = gtk_adjustment_new (value, min, max, step, 10 * step, 0); |
690 | + GtkAdjustment *adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (value, min, max, step, 10 * step, 0)); |
691 | |
692 | - return g_object_new (IDO_TYPE_SCALE_MENU_ITEM, |
693 | - "label", label, |
694 | - "range-style", range_style, |
695 | - "adjustment", adjustment, |
696 | - NULL); |
697 | + return GTK_WIDGET (g_object_new (IDO_TYPE_SCALE_MENU_ITEM, |
698 | + "label", label, |
699 | + "range-style", range_style, |
700 | + "adjustment", adjustment, |
701 | + NULL)); |
702 | } |
703 | |
704 | /** |
705 | @@ -804,7 +796,7 @@ |
706 | * Whether this is visible depends upon the return value from |
707 | * ido_scale_menu_item_get_style(). |
708 | **/ |
709 | -G_CONST_RETURN gchar* |
710 | +const gchar* |
711 | ido_scale_menu_item_get_primary_label (IdoScaleMenuItem *menuitem) |
712 | { |
713 | IdoScaleMenuItemPrivate *priv; |
714 | @@ -825,7 +817,7 @@ |
715 | * Whether this is visible depends upon the return value from |
716 | * ido_scale_menu_item_get_style(). |
717 | **/ |
718 | -G_CONST_RETURN gchar* |
719 | +const gchar* |
720 | ido_scale_menu_item_get_secondary_label (IdoScaleMenuItem *menuitem) |
721 | { |
722 | IdoScaleMenuItemPrivate *priv; |
723 | |
724 | === modified file 'src/idoscalemenuitem.h' |
725 | --- src/idoscalemenuitem.h 2010-07-15 13:44:29 +0000 |
726 | +++ src/idoscalemenuitem.h 2011-06-20 13:36:12 +0000 |
727 | @@ -26,7 +26,7 @@ |
728 | #ifndef __IDO_SCALE_MENU_ITEM_H__ |
729 | #define __IDO_SCALE_MENU_ITEM_H__ |
730 | |
731 | -#include <gtk/gtkmenuitem.h> |
732 | +#include <gtk/gtk.h> |
733 | #include "idorange.h" |
734 | |
735 | G_BEGIN_DECLS |
736 | @@ -79,8 +79,8 @@ |
737 | IdoScaleMenuItemStyle style); |
738 | GtkWidget *ido_scale_menu_item_get_primary_image (IdoScaleMenuItem *menuitem); |
739 | GtkWidget *ido_scale_menu_item_get_secondary_image (IdoScaleMenuItem *menuitem); |
740 | -G_CONST_RETURN gchar *ido_scale_menu_item_get_primary_label (IdoScaleMenuItem *menuitem); |
741 | -G_CONST_RETURN gchar *ido_scale_menu_item_get_secondary_label (IdoScaleMenuItem *menuitem); |
742 | +const gchar *ido_scale_menu_item_get_primary_label (IdoScaleMenuItem *menuitem); |
743 | +const gchar *ido_scale_menu_item_get_secondary_label (IdoScaleMenuItem *menuitem); |
744 | void ido_scale_menu_item_set_primary_label (IdoScaleMenuItem *menuitem, |
745 | const gchar *label); |
746 | void ido_scale_menu_item_set_secondary_label (IdoScaleMenuItem *menuitem, |
747 | |
748 | === modified file 'src/idotimeline.c' |
749 | --- src/idotimeline.c 2010-07-27 18:02:13 +0000 |
750 | +++ src/idotimeline.c 2011-06-20 13:36:12 +0000 |
751 | @@ -22,7 +22,7 @@ |
752 | #include "idotimeline.h" |
753 | #include "idotypebuiltins.h" |
754 | |
755 | -#include <gtk/gtksettings.h> |
756 | +#include <gtk/gtk.h> |
757 | #include <math.h> |
758 | |
759 | #define IDO_TIMELINE_GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), IDO_TYPE_TIMELINE, IdoTimelinePriv)) |
760 | @@ -194,10 +194,8 @@ |
761 | GParamSpec *pspec) |
762 | { |
763 | IdoTimeline *timeline; |
764 | - IdoTimelinePriv *priv; |
765 | |
766 | timeline = IDO_TIMELINE (object); |
767 | - priv = IDO_TIMELINE_GET_PRIV (timeline); |
768 | |
769 | switch (prop_id) |
770 | { |
771 | |
772 | === modified file 'src/idotimeline.h' |
773 | --- src/idotimeline.h 2010-07-22 12:21:06 +0000 |
774 | +++ src/idotimeline.h 2011-06-20 13:36:12 +0000 |
775 | @@ -21,7 +21,7 @@ |
776 | #define __IDO_TIMELINE_H__ |
777 | |
778 | #include <glib-object.h> |
779 | -#include <gtk/gtkenums.h> |
780 | +#include <gtk/gtk.h> |
781 | #include <gdk/gdk.h> |
782 | |
783 | G_BEGIN_DECLS |
The event window stuff had something to do with making sure that when we proxied the event to the scale widget:
gtk_widget_event (scale,
((GdkEvent *)(void*)(event)));
.. that it would calculate the right position. I don't remember it all that well now, but before that was there it would give us wildly incorrect positions. If it works now in your patch without needing that, then this is awesome. One less hack. :)
The other comment I have is regarding the change from GtkObject to GtkAdjustment. That existed to try to make ARM compilers happy, so I'd recommend trying to do a test build on armel before you merge this.