diff options
author | Ted Gould <ted@gould.cx> | 2011-06-21 11:32:46 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-06-21 11:32:46 -0500 |
commit | e1c47927f737e8c018f800a47315b5c03f02f08c (patch) | |
tree | a745cf8fbfce7fc1fb4bd62c67b9440527573337 | |
parent | 33ab93de41a2e6985661d79788873fb774e624b5 (diff) | |
parent | d61ddbef2c5f207e5ba70c976b8565a043c646ca (diff) | |
download | ayatana-ido-e1c47927f737e8c018f800a47315b5c03f02f08c.tar.gz ayatana-ido-e1c47927f737e8c018f800a47315b5c03f02f08c.tar.bz2 ayatana-ido-e1c47927f737e8c018f800a47315b5c03f02f08c.zip |
Updating to GTK3
-rw-r--r-- | Makefile.am | 18 | ||||
-rw-r--r-- | configure.ac | 18 | ||||
-rw-r--r-- | example/Makefile.am | 10 | ||||
-rw-r--r-- | libido3.pc.in | 11 | ||||
-rw-r--r-- | src/Makefile.am | 20 | ||||
-rw-r--r-- | src/idocalendarmenuitem.c | 52 | ||||
-rw-r--r-- | src/idoentrymenuitem.c | 48 | ||||
-rw-r--r-- | src/idomessagedialog.c | 20 | ||||
-rw-r--r-- | src/idomessagedialog.h | 2 | ||||
-rw-r--r-- | src/idorange.c | 2 | ||||
-rw-r--r-- | src/idorange.h | 2 | ||||
-rw-r--r-- | src/idoscalemenuitem.c | 32 | ||||
-rw-r--r-- | src/idoscalemenuitem.h | 6 | ||||
-rw-r--r-- | src/idotimeline.c | 4 | ||||
-rw-r--r-- | src/idotimeline.h | 2 |
15 files changed, 159 insertions, 88 deletions
diff --git a/Makefile.am b/Makefile.am index 3348e87..68fd066 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,9 @@ +if USE_GTK3 +VER=3 +else +VER= +endif + ACLOCAL_AMFLAGS = -I build/autotools V = @ @@ -6,14 +12,14 @@ QUIET_GEN = $(Q:@=@echo ' GEN '$@;) SUBDIRS = build src example -libido-0.1.pc: libido.pc - $(QUIET_GEN) cp -f libido.pc libido-0.1.pc +%-0.1.pc: %.pc + $(QUIET_GEN) cp -f $< $@ pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libido-0.1.pc +pkgconfig_DATA = libido$(VER)-0.1.pc -CLEANFILES = libido-0.1.pc -DISTCLEANFILES = libido.pc -EXTRA_DIST = libido.pc.in +CLEANFILES = libido-0.1.pc libido3-0.1.pc +DISTCLEANFILES = libido.pc libido3.pc +EXTRA_DIST = libido.pc.in libido3.pc.in DISTCHECK_CONFIGURE_FLAGS = --disable-gtk-doc diff --git a/configure.ac b/configure.ac index 0fcd778..4dfe223 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_CONFIG_MACRO_DIR([build/autotools]) AM_CONFIG_HEADER([config.h]) -AM_INIT_AUTOMAKE([1.9]) +AM_INIT_AUTOMAKE([1.9 foreign]) IDO_MAJOR_VERSION=ido_major_version IDO_MINOR_VERSION=ido_minor_version @@ -52,9 +52,11 @@ dnl =========================================================================== # Checks for programs AC_PROG_CC +AM_PROG_CC_C_O AC_DISABLE_STATIC AC_PROG_LIBTOOL AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums]) +PKG_PROG_PKG_CONFIG # Checks for header files AC_HEADER_STDC @@ -68,7 +70,18 @@ AC_FUNC_MALLOC AC_FUNC_MMAP AC_CHECK_FUNCS([memset munmap strcasecmp strdup]) -PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.19.7) +AC_ARG_WITH([gtk], + [AS_HELP_STRING([--with-gtk], + [Which version of gtk to use @<:@default=3@:>@])], + [], + [with_gtk=3]) +AM_CONDITIONAL(USE_GTK3, [test "x$with_gtk" = x3]) + +if test "x$with_gtk" = "x2"; then + PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.19.7) +else + PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.0.0) +fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) @@ -114,6 +127,7 @@ AC_CONFIG_FILES([ src/Makefile example/Makefile libido.pc + libido3.pc ]) AC_OUTPUT diff --git a/example/Makefile.am b/example/Makefile.am index 7e76434..b986b9b 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -1,3 +1,9 @@ +if USE_GTK3 +VER=3 +else +VER= +endif + noinst_PROGRAMS = \ messagedialog \ menus @@ -24,6 +30,6 @@ menus_CPPFLAGS = \ $(GTK_CFLAGS) \ $(MAINTAINER_CFLAGS) -messagedialog_LDADD = $(top_builddir)/src/libido-0.1.la $(GTK_LIBS) +messagedialog_LDADD = $(top_builddir)/src/libido$(VER)-0.1.la $(GTK_LIBS) -menus_LDADD = $(top_builddir)/src/libido-0.1.la $(GTK_LIBS) +menus_LDADD = $(top_builddir)/src/libido$(VER)-0.1.la $(GTK_LIBS) diff --git a/libido3.pc.in b/libido3.pc.in new file mode 100644 index 0000000..db3ed1b --- /dev/null +++ b/libido3.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libido +Description: Ayatana Indicator Display Objects +Version: @VERSION@ +Libs: -L${libdir} -lido3-0.1 +Cflags: -I${includedir}/libido3-0.1 +Requires: gtk+-3.0 diff --git a/src/Makefile.am b/src/Makefile.am index 1485019..5ac5a01 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,11 @@ +if USE_GTK3 +VER=3 +lib_LTLIBRARIES = libido3-0.1.la +else +VER= +lib_LTLIBRARIES = libido-0.1.la +endif + ido_built_public_sources = \ idotypebuiltins.h @@ -40,16 +48,13 @@ INCLUDES = \ -DLIBDIR=\"$(libdir)"\" \ -DG_DISABLE_DEPRECATED \ -DGDK_PIXBUF_DISABLE_DEPRECATED \ - -DGDK_DISABLE_DEPRECATED \ - -DGTK_DISABLE_DEPRECATED + -DGDK_DISABLE_DEPRECATED AM_CPPFLAGS = \ $(GCC_FLAGS) \ $(GTK_CFLAGS) \ $(MAINTAINER_CFLAGS) -lib_LTLIBRARIES = libido-0.1.la - libido_0_1_la_SOURCES = \ idotypebuiltins.c \ idocalendarmenuitem.c \ @@ -58,8 +63,9 @@ libido_0_1_la_SOURCES = \ idorange.c \ idoscalemenuitem.c \ idotimeline.c +libido3_0_1_la_SOURCES = $(libido_0_1_la_SOURCES) -libidoincludedir=$(includedir)/libido-0.1/libido +libidoincludedir=$(includedir)/libido$(VER)-0.1/libido libidoinclude_HEADERS = \ idocalendarmenuitem.h \ @@ -72,8 +78,8 @@ libidoinclude_HEADERS = \ libido_0_1_la_LIBADD = $(GTK_LIBS) libido_0_1_la_LDFLAGS = $(GTK_LT_LDFLAGS) - -idoheadersdir = $(includedir)/ido-0.1/ido +libido3_0_1_la_LIBADD = $(libido_0_1_la_LIBADD) +libido3_0_1_la_LDFLAGS = $(libido_0_1_la_LDFLAGS) DISTCLEANFILES = \ stamp-idotypebuiltins.h \ diff --git a/src/idocalendarmenuitem.c b/src/idocalendarmenuitem.c index 6094d0d..a778cdc 100644 --- a/src/idocalendarmenuitem.c +++ b/src/idocalendarmenuitem.c @@ -26,8 +26,13 @@ #include <gdk/gdkkeysyms.h> #include "idocalendarmenuitem.h" +#if GTK_CHECK_VERSION (3, 0, 0) +static void ido_calendar_menu_item_select (GtkMenuItem *item); +static void ido_calendar_menu_item_deselect (GtkMenuItem *item); +#else static void ido_calendar_menu_item_select (GtkItem *item); static void ido_calendar_menu_item_deselect (GtkItem *item); +#endif static gboolean ido_calendar_menu_item_button_release (GtkWidget *widget, GdkEventButton *event); static gboolean ido_calendar_menu_item_button_press (GtkWidget *widget, @@ -65,18 +70,27 @@ ido_calendar_menu_item_class_init (IdoCalendarMenuItemClass *klass) GObjectClass *gobject_class; GtkWidgetClass *widget_class; GtkMenuItemClass *menu_item_class; +#if ! GTK_CHECK_VERSION (3, 0, 0) GtkItemClass *item_class; +#endif gobject_class = G_OBJECT_CLASS (klass); widget_class = GTK_WIDGET_CLASS (klass); menu_item_class = GTK_MENU_ITEM_CLASS (klass); +#if ! GTK_CHECK_VERSION (3, 0, 0) item_class = GTK_ITEM_CLASS (klass); +#endif widget_class->button_release_event = ido_calendar_menu_item_button_release; widget_class->button_press_event = ido_calendar_menu_item_button_press; +#if GTK_CHECK_VERSION (3, 0, 0) + menu_item_class->select = ido_calendar_menu_item_select; + menu_item_class->deselect = ido_calendar_menu_item_deselect; +#else item_class->select = ido_calendar_menu_item_select; item_class->deselect = ido_calendar_menu_item_deselect; +#endif menu_item_class->hide_on_activate = TRUE; @@ -101,12 +115,6 @@ static void ido_calendar_menu_item_init (IdoCalendarMenuItem *item) { IdoCalendarMenuItemPrivate *priv; - GtkBorder border; - - border.left = 4; - border.right = 4; - border.top = 2; - border.bottom = 2; priv = item->priv = IDO_CALENDAR_MENU_ITEM_GET_PRIVATE (item); @@ -143,7 +151,7 @@ ido_calendar_menu_item_send_focus_change (GtkWidget *widget, gtk_widget_grab_focus (widget); event->focus_change.type = GDK_FOCUS_CHANGE; - event->focus_change.window = g_object_ref (widget->window); + event->focus_change.window = g_object_ref (gtk_widget_get_window (widget)); event->focus_change.in = in; gtk_widget_event (widget, event); @@ -168,9 +176,9 @@ ido_calendar_menu_item_key_press (GtkWidget *widget, gtk_widget_event (calendar, ((GdkEvent *)(void*)(event))); - if (calendar->window != NULL) + if (gtk_widget_get_window (calendar) != NULL) { - gdk_window_raise (calendar->window); + gdk_window_raise (gtk_widget_get_window (calendar)); } if (!gtk_widget_has_focus (calendar)) @@ -178,7 +186,7 @@ ido_calendar_menu_item_key_press (GtkWidget *widget, gtk_widget_grab_focus (calendar); } - return event->keyval != GDK_Return; + return event->keyval != GDK_KEY_Return; } return FALSE; @@ -192,9 +200,9 @@ ido_calendar_menu_item_button_press (GtkWidget *widget, if (event->button == 1) { - if (calendar->window != NULL) + if (gtk_widget_get_window (calendar) != NULL) { - gdk_window_raise (calendar->window); + gdk_window_raise (gtk_widget_get_window (calendar)); } if (!gtk_widget_has_focus (calendar)) @@ -224,7 +232,11 @@ ido_calendar_menu_item_button_release (GtkWidget *widget, } static void +#if GTK_CHECK_VERSION (3, 0, 0) +ido_calendar_menu_item_select (GtkMenuItem *item) +#else ido_calendar_menu_item_select (GtkItem *item) +#endif { IDO_CALENDAR_MENU_ITEM (item)->priv->selected = TRUE; @@ -232,7 +244,11 @@ ido_calendar_menu_item_select (GtkItem *item) } static void +#if GTK_CHECK_VERSION (3, 0, 0) +ido_calendar_menu_item_deselect (GtkMenuItem *item) +#else ido_calendar_menu_item_deselect (GtkItem *item) +#endif { IDO_CALENDAR_MENU_ITEM (item)->priv->selected = FALSE; @@ -244,12 +260,12 @@ static void calendar_realized_cb (GtkWidget *widget, IdoCalendarMenuItem *item) { - if (widget->window != NULL) + if (gtk_widget_get_window (widget) != NULL) { - gdk_window_raise (widget->window); + gdk_window_raise (gtk_widget_get_window (widget)); } - g_signal_connect (GTK_WIDGET (item)->parent, + g_signal_connect (gtk_widget_get_parent (GTK_WIDGET (item)), "key-press-event", G_CALLBACK (ido_calendar_menu_item_key_press), item); @@ -328,7 +344,8 @@ ido_calendar_menu_item_mark_day (IdoCalendarMenuItem *menuitem, guint day) { g_return_val_if_fail(IDO_IS_CALENDAR_MENU_ITEM(menuitem), FALSE); - return gtk_calendar_mark_day(GTK_CALENDAR (menuitem->priv->calendar), day); + gtk_calendar_mark_day(GTK_CALENDAR (menuitem->priv->calendar), day); + return TRUE; } gboolean @@ -336,7 +353,8 @@ ido_calendar_menu_item_unmark_day (IdoCalendarMenuItem *menuitem, guint day) { g_return_val_if_fail(IDO_IS_CALENDAR_MENU_ITEM(menuitem), FALSE); - return gtk_calendar_unmark_day(GTK_CALENDAR (menuitem->priv->calendar), day); + gtk_calendar_unmark_day(GTK_CALENDAR (menuitem->priv->calendar), day); + return TRUE; } void diff --git a/src/idoentrymenuitem.c b/src/idoentrymenuitem.c index b68c18f..1636da9 100644 --- a/src/idoentrymenuitem.c +++ b/src/idoentrymenuitem.c @@ -26,8 +26,13 @@ #include <gdk/gdkkeysyms.h> #include "idoentrymenuitem.h" +#if GTK_CHECK_VERSION (3, 0, 0) +static void ido_entry_menu_item_select (GtkMenuItem *item); +static void ido_entry_menu_item_deselect (GtkMenuItem *item); +#else static void ido_entry_menu_item_select (GtkItem *item); static void ido_entry_menu_item_deselect (GtkItem *item); +#endif static gboolean ido_entry_menu_item_button_release (GtkWidget *widget, GdkEventButton *event); static gboolean ido_entry_menu_item_key_press (GtkWidget *widget, @@ -60,18 +65,27 @@ ido_entry_menu_item_class_init (IdoEntryMenuItemClass *klass) GObjectClass *gobject_class; GtkWidgetClass *widget_class; GtkMenuItemClass *menu_item_class; +#if ! GTK_CHECK_VERSION (3, 0, 0) GtkItemClass *item_class; +#endif gobject_class = G_OBJECT_CLASS (klass); widget_class = GTK_WIDGET_CLASS (klass); menu_item_class = GTK_MENU_ITEM_CLASS (klass); +#if ! GTK_CHECK_VERSION (3, 0, 0) item_class = GTK_ITEM_CLASS (klass); +#endif widget_class->button_release_event = ido_entry_menu_item_button_release; widget_class->button_press_event = ido_entry_menu_item_button_press; +#if GTK_CHECK_VERSION (3, 0, 0) + menu_item_class->select = ido_entry_menu_item_select; + menu_item_class->deselect = ido_entry_menu_item_deselect; +#else item_class->select = ido_entry_menu_item_select; item_class->deselect = ido_entry_menu_item_deselect; +#endif menu_item_class->hide_on_activate = TRUE; @@ -118,11 +132,11 @@ is_key_press_valid (IdoEntryMenuItem *item, { switch (key) { - case GDK_Escape: - case GDK_Up: - case GDK_Down: - case GDK_KP_Up: - case GDK_KP_Down: + case GDK_KEY_Escape: + case GDK_KEY_Up: + case GDK_KEY_Down: + case GDK_KEY_KP_Up: + case GDK_KEY_KP_Down: return FALSE; default: @@ -145,11 +159,11 @@ ido_entry_menu_item_key_press (GtkWidget *widget, gtk_widget_event (entry, ((GdkEvent *)(void*)(event))); - /* We've handled the event, but if the key was GDK_Return + /* We've handled the event, but if the key was GDK_KEY_Return * we still want to forward the event up to the menu shell * to ensure that the menuitem receives the activate signal. */ - return event->keyval != GDK_Return; + return event->keyval != GDK_KEY_Return; } return FALSE; @@ -164,7 +178,7 @@ ido_entry_menu_item_send_focus_change (GtkWidget *widget, g_object_ref (widget); event->focus_change.type = GDK_FOCUS_CHANGE; - event->focus_change.window = g_object_ref (widget->window); + event->focus_change.window = g_object_ref (gtk_widget_get_window (widget)); event->focus_change.in = in; gtk_widget_event (widget, event); @@ -183,9 +197,9 @@ ido_entry_menu_item_button_press (GtkWidget *widget, if (event->button == 1) { - if (entry->window != NULL) + if (gtk_widget_get_window (entry) != NULL) { - gdk_window_raise (entry->window); + gdk_window_raise (gtk_widget_get_window (entry)); } if (!gtk_widget_has_focus (entry)) @@ -215,7 +229,11 @@ ido_entry_menu_item_button_release (GtkWidget *widget, } static void +#if GTK_CHECK_VERSION (3, 0, 0) +ido_entry_menu_item_select (GtkMenuItem *item) +#else ido_entry_menu_item_select (GtkItem *item) +#endif { IDO_ENTRY_MENU_ITEM (item)->priv->selected = TRUE; @@ -223,7 +241,11 @@ ido_entry_menu_item_select (GtkItem *item) } static void +#if GTK_CHECK_VERSION (3, 0, 0) +ido_entry_menu_item_deselect (GtkMenuItem *item) +#else ido_entry_menu_item_deselect (GtkItem *item) +#endif { IDO_ENTRY_MENU_ITEM (item)->priv->selected = FALSE; @@ -235,12 +257,12 @@ static void entry_realized_cb (GtkWidget *widget, IdoEntryMenuItem *item) { - if (widget->window != NULL) + if (gtk_widget_get_window (widget) != NULL) { - gdk_window_raise (widget->window); + gdk_window_raise (gtk_widget_get_window (widget)); } - g_signal_connect (GTK_WIDGET (item)->parent, + g_signal_connect (gtk_widget_get_parent (GTK_WIDGET (item)), "key-press-event", G_CALLBACK (ido_entry_menu_item_key_press), item); diff --git a/src/idomessagedialog.c b/src/idomessagedialog.c index ba73233..9b5fe2c 100644 --- a/src/idomessagedialog.c +++ b/src/idomessagedialog.c @@ -82,7 +82,7 @@ ido_message_dialog_map (GtkWidget *widget) * * See: https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/240794 */ - gdk_window_set_functions (widget->window, + gdk_window_set_functions (gtk_widget_get_window (widget), GDK_FUNC_RESIZE | GDK_FUNC_MOVE); ido_message_dialog_get_secondary_label (IDO_MESSAGE_DIALOG (widget)); @@ -166,14 +166,14 @@ ido_message_dialog_focus_in_event (GtkWidget *widget, IdoTimeline *timeline; IdoMessageDialogMorphContext *context; - start = GTK_WIDGET (dialog)->requisition; + gtk_widget_get_requisition (GTK_WIDGET (dialog), &start); priv->expanded = TRUE; gtk_widget_show (priv->action_area); gtk_widget_show (priv->secondary_label); - gtk_widget_size_request (GTK_WIDGET (dialog), &end); + gtk_widget_get_requisition (GTK_WIDGET (dialog), &end); gtk_widget_hide (priv->action_area); gtk_widget_hide (priv->secondary_label); @@ -209,7 +209,7 @@ ido_message_dialog_constructed (GObject *object) event_box = gtk_event_box_new (); gtk_widget_show (event_box); - vbox = GTK_DIALOG (object)->vbox; + vbox = gtk_dialog_get_content_area (GTK_DIALOG (object)); priv->action_area = gtk_dialog_get_action_area (GTK_DIALOG (object)); g_object_ref (G_OBJECT (vbox)); @@ -237,11 +237,7 @@ ido_message_dialog_class_init (IdoMessageDialogClass *class) static void ido_message_dialog_init (IdoMessageDialog *dialog) { - IdoMessageDialogPrivate *priv; - gtk_window_set_focus_on_map (GTK_WINDOW (dialog), FALSE); - - priv = IDO_MESSAGE_DIALOG_GET_PRIVATE (dialog); } /** @@ -284,11 +280,13 @@ ido_message_dialog_new (GtkWindow *parent, NULL); dialog = GTK_DIALOG (widget); +#if ! GTK_CHECK_VERSION(3, 0, 0) if (flags & GTK_DIALOG_NO_SEPARATOR) { g_warning ("The GTK_DIALOG_NO_SEPARATOR flag cannot be used for IdoMessageDialog"); flags &= ~GTK_DIALOG_NO_SEPARATOR; } +#endif if (message_format) { @@ -296,8 +294,7 @@ ido_message_dialog_new (GtkWindow *parent, msg = g_strdup_vprintf (message_format, args); va_end (args); - gtk_label_set_text (GTK_LABEL (GTK_MESSAGE_DIALOG (widget)->label), - msg); + g_object_set (G_OBJECT (widget), "text", msg, NULL); g_free (msg); } @@ -397,7 +394,8 @@ ido_message_dialog_get_label (IdoMessageDialog *dialog, gboolean primary) label = GTK_LABEL (vlist->data); - if (strcmp ((primary ? text : secondary_text), label->label) == 0) + if (strcmp ((primary ? text : secondary_text), + gtk_label_get_label (label)) == 0) { return GTK_WIDGET (label); } diff --git a/src/idomessagedialog.h b/src/idomessagedialog.h index 4a44957..4313fb3 100644 --- a/src/idomessagedialog.h +++ b/src/idomessagedialog.h @@ -29,7 +29,7 @@ #ifndef __IDO_MESSAGE_DIALOG_H__ #define __IDO_MESSAGE_DIALOG_H__ -#include <gtk/gtkmessagedialog.h> +#include <gtk/gtk.h> #define IDO_TYPE_MESSAGE_DIALOG (ido_message_dialog_get_type ()) #define IDO_MESSAGE_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), IDO_TYPE_MESSAGE_DIALOG, IdoMessageDialog)) diff --git a/src/idorange.c b/src/idorange.c index c38ac88..ba5c2c8 100644 --- a/src/idorange.c +++ b/src/idorange.c @@ -179,7 +179,7 @@ ido_range_init (IdoRange *range) * Creates a new #IdoRange widget. **/ GtkWidget * -ido_range_new (GtkObject *adj, +ido_range_new (GtkAdjustment *adj, IdoRangeStyle style) { g_return_val_if_fail (GTK_IS_ADJUSTMENT (adj), NULL); diff --git a/src/idorange.h b/src/idorange.h index a88a900..f502520 100644 --- a/src/idorange.h +++ b/src/idorange.h @@ -64,7 +64,7 @@ struct _IdoRangeClass GType ido_range_get_type (void) G_GNUC_CONST; -GtkWidget* ido_range_new (GtkObject *adj, +GtkWidget* ido_range_new (GtkAdjustment *adj, IdoRangeStyle style); G_END_DECLS diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c index 39cecbb..8b9e1ac 100644 --- a/src/idoscalemenuitem.c +++ b/src/idoscalemenuitem.c @@ -185,8 +185,8 @@ ido_scale_menu_item_size_allocate (GtkWidget *widget, priv->right_padding = primary_padding; } - priv->child_allocation.x = GTK_CONTAINER (widget)->border_width + widget->style->xthickness; - priv->child_allocation.y = GTK_CONTAINER (widget)->border_width + widget->style->ythickness; + priv->child_allocation.x = gtk_container_get_border_width (GTK_CONTAINER (widget)) + gtk_widget_get_style (widget)->xthickness; + priv->child_allocation.y = gtk_container_get_border_width (GTK_CONTAINER (widget)) + gtk_widget_get_style (widget)->ythickness; priv->child_allocation.x += horizontal_padding; priv->child_allocation.x += priv->toggle_size; @@ -213,7 +213,7 @@ ido_scale_menu_item_constructed (GObject *object) { IdoScaleMenuItem *self = IDO_SCALE_MENU_ITEM (object); IdoScaleMenuItemPrivate *priv = GET_PRIVATE (self); - GtkObject *adj = gtk_adjustment_new (0.0, 0.0, 100.0, 1.0, 10.0, 0.0); + GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 100.0, 1.0, 10.0, 0.0)); IdoRangeStyle range_style; GtkWidget *hbox; @@ -261,7 +261,6 @@ static void ido_scale_menu_item_class_init (IdoScaleMenuItemClass *item_class) { GObjectClass *gobject_class = G_OBJECT_CLASS (item_class); - GtkObjectClass *object_class = GTK_OBJECT_CLASS (item_class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (item_class); widget_class->button_press_event = ido_scale_menu_item_button_press_event; @@ -325,7 +324,7 @@ ido_scale_menu_item_class_init (IdoScaleMenuItemClass *item_class) g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - g_type_class_add_private (object_class, sizeof (IdoScaleMenuItemPrivate)); + g_type_class_add_private (item_class, sizeof (IdoScaleMenuItemPrivate)); } static void @@ -471,11 +470,9 @@ ido_scale_menu_item_button_press_event (GtkWidget *menuitem, { IdoScaleMenuItemPrivate *priv = GET_PRIVATE (menuitem); GtkWidget *scale = priv->scale; - GtkWidget *parent; gdouble x; // can we block emissions of "grab-notify" on parent?? - parent = gtk_widget_get_parent (GTK_WIDGET (menuitem)); translate_event_coordinates (menuitem, event->x, &x); event->x = x; @@ -505,7 +502,6 @@ ido_scale_menu_item_button_release_event (GtkWidget *menuitem, { IdoScaleMenuItemPrivate *priv = GET_PRIVATE (menuitem); GtkWidget *scale = priv->scale; - GdkWindow *tmp = event->window; gdouble x; if (event->x > priv->child_allocation.x && @@ -554,8 +550,6 @@ ido_scale_menu_item_button_release_event (GtkWidget *menuitem, return TRUE; } - event->window = GTK_RANGE (scale)->event_window; - translate_event_coordinates (menuitem, event->x, &x); event->x = x; @@ -565,8 +559,6 @@ ido_scale_menu_item_button_release_event (GtkWidget *menuitem, gtk_widget_event (scale, ((GdkEvent *)(void*)(event))); - event->window = tmp; - if (priv->grabbed) { priv->grabbed = FALSE; @@ -688,13 +680,13 @@ ido_scale_menu_item_new_with_range (const gchar *label, gdouble max, gdouble step) { - GtkObject *adjustment = gtk_adjustment_new (value, min, max, step, 10 * step, 0); + GtkAdjustment *adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (value, min, max, step, 10 * step, 0)); - return g_object_new (IDO_TYPE_SCALE_MENU_ITEM, - "label", label, - "range-style", range_style, - "adjustment", adjustment, - NULL); + return GTK_WIDGET (g_object_new (IDO_TYPE_SCALE_MENU_ITEM, + "label", label, + "range-style", range_style, + "adjustment", adjustment, + NULL)); } /** @@ -804,7 +796,7 @@ ido_scale_menu_item_get_secondary_image (IdoScaleMenuItem *menuitem) * Whether this is visible depends upon the return value from * ido_scale_menu_item_get_style(). **/ -G_CONST_RETURN gchar* +const gchar* ido_scale_menu_item_get_primary_label (IdoScaleMenuItem *menuitem) { IdoScaleMenuItemPrivate *priv; @@ -825,7 +817,7 @@ ido_scale_menu_item_get_primary_label (IdoScaleMenuItem *menuitem) * Whether this is visible depends upon the return value from * ido_scale_menu_item_get_style(). **/ -G_CONST_RETURN gchar* +const gchar* ido_scale_menu_item_get_secondary_label (IdoScaleMenuItem *menuitem) { IdoScaleMenuItemPrivate *priv; diff --git a/src/idoscalemenuitem.h b/src/idoscalemenuitem.h index 44a9033..5afafd3 100644 --- a/src/idoscalemenuitem.h +++ b/src/idoscalemenuitem.h @@ -26,7 +26,7 @@ #ifndef __IDO_SCALE_MENU_ITEM_H__ #define __IDO_SCALE_MENU_ITEM_H__ -#include <gtk/gtkmenuitem.h> +#include <gtk/gtk.h> #include "idorange.h" G_BEGIN_DECLS @@ -79,8 +79,8 @@ void ido_scale_menu_item_set_style (IdoScaleMenuItem IdoScaleMenuItemStyle style); GtkWidget *ido_scale_menu_item_get_primary_image (IdoScaleMenuItem *menuitem); GtkWidget *ido_scale_menu_item_get_secondary_image (IdoScaleMenuItem *menuitem); -G_CONST_RETURN gchar *ido_scale_menu_item_get_primary_label (IdoScaleMenuItem *menuitem); -G_CONST_RETURN gchar *ido_scale_menu_item_get_secondary_label (IdoScaleMenuItem *menuitem); +const gchar *ido_scale_menu_item_get_primary_label (IdoScaleMenuItem *menuitem); +const gchar *ido_scale_menu_item_get_secondary_label (IdoScaleMenuItem *menuitem); void ido_scale_menu_item_set_primary_label (IdoScaleMenuItem *menuitem, const gchar *label); void ido_scale_menu_item_set_secondary_label (IdoScaleMenuItem *menuitem, diff --git a/src/idotimeline.c b/src/idotimeline.c index a9ca0c6..c6275ae 100644 --- a/src/idotimeline.c +++ b/src/idotimeline.c @@ -22,7 +22,7 @@ #include "idotimeline.h" #include "idotypebuiltins.h" -#include <gtk/gtksettings.h> +#include <gtk/gtk.h> #include <math.h> #define IDO_TIMELINE_GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), IDO_TYPE_TIMELINE, IdoTimelinePriv)) @@ -194,10 +194,8 @@ ido_timeline_set_property (GObject *object, GParamSpec *pspec) { IdoTimeline *timeline; - IdoTimelinePriv *priv; timeline = IDO_TIMELINE (object); - priv = IDO_TIMELINE_GET_PRIV (timeline); switch (prop_id) { diff --git a/src/idotimeline.h b/src/idotimeline.h index 5df6b97..e26f9d3 100644 --- a/src/idotimeline.h +++ b/src/idotimeline.h @@ -21,7 +21,7 @@ #define __IDO_TIMELINE_H__ #include <glib-object.h> -#include <gtk/gtkenums.h> +#include <gtk/gtk.h> #include <gdk/gdk.h> G_BEGIN_DECLS |