From 3e67ec3d19dd4e31ec68b1b9c33f4b330c7672a3 Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Fri, 27 May 2011 09:06:46 -0400 Subject: porting to gtk3, WIP --- src/idocalendarmenuitem.c | 40 +++++++++++++++++++++------------------- src/idoentrymenuitem.c | 40 +++++++++++++++++++--------------------- src/idomessagedialog.c | 8 ++++---- src/idomessagedialog.h | 2 +- src/idorange.c | 2 +- src/idorange.h | 2 +- src/idoscalemenuitem.c | 6 +++--- src/idoscalemenuitem.h | 2 +- src/idotimeline.h | 2 +- 9 files changed, 52 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/idocalendarmenuitem.c b/src/idocalendarmenuitem.c index 6094d0d..2705ae8 100644 --- a/src/idocalendarmenuitem.c +++ b/src/idocalendarmenuitem.c @@ -26,8 +26,8 @@ #include #include "idocalendarmenuitem.h" -static void ido_calendar_menu_item_select (GtkItem *item); -static void ido_calendar_menu_item_deselect (GtkItem *item); +static void ido_calendar_menu_item_select (GtkMenuItem *item); +static void ido_calendar_menu_item_deselect (GtkMenuItem *item); static gboolean ido_calendar_menu_item_button_release (GtkWidget *widget, GdkEventButton *event); static gboolean ido_calendar_menu_item_button_press (GtkWidget *widget, @@ -65,18 +65,17 @@ ido_calendar_menu_item_class_init (IdoCalendarMenuItemClass *klass) GObjectClass *gobject_class; GtkWidgetClass *widget_class; GtkMenuItemClass *menu_item_class; - GtkItemClass *item_class; + GtkMenuItemClass *item_class; gobject_class = G_OBJECT_CLASS (klass); widget_class = GTK_WIDGET_CLASS (klass); menu_item_class = GTK_MENU_ITEM_CLASS (klass); - item_class = GTK_ITEM_CLASS (klass); widget_class->button_release_event = ido_calendar_menu_item_button_release; widget_class->button_press_event = ido_calendar_menu_item_button_press; - item_class->select = ido_calendar_menu_item_select; - item_class->deselect = ido_calendar_menu_item_deselect; + menu_item_class->select = ido_calendar_menu_item_select; + menu_item_class->deselect = ido_calendar_menu_item_deselect; menu_item_class->hide_on_activate = TRUE; @@ -143,7 +142,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 +167,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 +177,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 +191,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 +223,7 @@ ido_calendar_menu_item_button_release (GtkWidget *widget, } static void -ido_calendar_menu_item_select (GtkItem *item) +ido_calendar_menu_item_select (GtkMenuItem *item) { IDO_CALENDAR_MENU_ITEM (item)->priv->selected = TRUE; @@ -232,7 +231,7 @@ ido_calendar_menu_item_select (GtkItem *item) } static void -ido_calendar_menu_item_deselect (GtkItem *item) +ido_calendar_menu_item_deselect (GtkMenuItem *item) { IDO_CALENDAR_MENU_ITEM (item)->priv->selected = FALSE; @@ -244,12 +243,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 +327,9 @@ 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 gtk_calendar_get_day_is_marked (GTK_CALENDAR (menuitem->priv->calendar), day); + } gboolean @@ -336,7 +337,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 !gtk_calendar_get_day_is_marked (GTK_CALENDAR (menuitem->priv->calendar), day); } void diff --git a/src/idoentrymenuitem.c b/src/idoentrymenuitem.c index b68c18f..a1a16cc 100644 --- a/src/idoentrymenuitem.c +++ b/src/idoentrymenuitem.c @@ -26,8 +26,8 @@ #include #include "idoentrymenuitem.h" -static void ido_entry_menu_item_select (GtkItem *item); -static void ido_entry_menu_item_deselect (GtkItem *item); +static void ido_entry_menu_item_select (GtkMenuItem *item); +static void ido_entry_menu_item_deselect (GtkMenuItem *item); static gboolean ido_entry_menu_item_button_release (GtkWidget *widget, GdkEventButton *event); static gboolean ido_entry_menu_item_key_press (GtkWidget *widget, @@ -60,18 +60,16 @@ ido_entry_menu_item_class_init (IdoEntryMenuItemClass *klass) GObjectClass *gobject_class; GtkWidgetClass *widget_class; GtkMenuItemClass *menu_item_class; - GtkItemClass *item_class; gobject_class = G_OBJECT_CLASS (klass); widget_class = GTK_WIDGET_CLASS (klass); menu_item_class = GTK_MENU_ITEM_CLASS (klass); - item_class = GTK_ITEM_CLASS (klass); widget_class->button_release_event = ido_entry_menu_item_button_release; widget_class->button_press_event = ido_entry_menu_item_button_press; - item_class->select = ido_entry_menu_item_select; - item_class->deselect = ido_entry_menu_item_deselect; + menu_item_class->select = ido_entry_menu_item_select; + menu_item_class->deselect = ido_entry_menu_item_deselect; menu_item_class->hide_on_activate = TRUE; @@ -118,11 +116,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 +143,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 +162,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 +181,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 +213,7 @@ ido_entry_menu_item_button_release (GtkWidget *widget, } static void -ido_entry_menu_item_select (GtkItem *item) +ido_entry_menu_item_select (GtkMenuItem *item) { IDO_ENTRY_MENU_ITEM (item)->priv->selected = TRUE; @@ -223,7 +221,7 @@ ido_entry_menu_item_select (GtkItem *item) } static void -ido_entry_menu_item_deselect (GtkItem *item) +ido_entry_menu_item_deselect (GtkMenuItem *item) { IDO_ENTRY_MENU_ITEM (item)->priv->selected = FALSE; @@ -235,12 +233,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..c5acb03 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)); 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 +#include #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..55f7117 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 (GtkWidget *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..517d7fb 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 (GtkWidget *adj, IdoRangeStyle style); G_END_DECLS diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c index 39cecbb..5d522ca 100644 --- a/src/idoscalemenuitem.c +++ b/src/idoscalemenuitem.c @@ -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); + GtkWidget *adj = gtk_adjustment_new (0.0, 0.0, 100.0, 1.0, 10.0, 0.0); IdoRangeStyle range_style; GtkWidget *hbox; @@ -261,7 +261,7 @@ 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 *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; @@ -688,7 +688,7 @@ 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); + GtkWidget *adjustment = gtk_adjustment_new (value, min, max, step, 10 * step, 0); return g_object_new (IDO_TYPE_SCALE_MENU_ITEM, "label", label, diff --git a/src/idoscalemenuitem.h b/src/idoscalemenuitem.h index 44a9033..ee0691a 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 +#include #include "idorange.h" G_BEGIN_DECLS 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 -#include +#include #include G_BEGIN_DECLS -- cgit v1.2.3 From 5ddcf6b51cdcb8d793748ff4a812f843a0d4f6e7 Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Wed, 1 Jun 2011 15:24:28 -0400 Subject: allow building either gtk2 or gtk3 versions; some deprecation cleanups --- src/Makefile.am | 20 +++++++++++++------- src/idomessagedialog.c | 8 +++++--- src/idoscalemenuitem.c | 7 +++---- 3 files changed, 21 insertions(+), 14 deletions(-) (limited to 'src') 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/idomessagedialog.c b/src/idomessagedialog.c index c5acb03..1e72701 100644 --- a/src/idomessagedialog.c +++ b/src/idomessagedialog.c @@ -284,11 +284,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 +298,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 +398,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/idoscalemenuitem.c b/src/idoscalemenuitem.c index 5d522ca..6b1189b 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; @@ -261,7 +261,6 @@ static void ido_scale_menu_item_class_init (IdoScaleMenuItemClass *item_class) { GObjectClass *gobject_class = G_OBJECT_CLASS (item_class); - GtkWidgetClass *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 -- cgit v1.2.3 From d9ec4cfedc5d542c7389cad31b33613de3882fd4 Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Wed, 1 Jun 2011 15:32:49 -0400 Subject: some further automake magic for dual versioning --- src/idotimeline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/idotimeline.c b/src/idotimeline.c index a9ca0c6..479fa09 100644 --- a/src/idotimeline.c +++ b/src/idotimeline.c @@ -22,7 +22,7 @@ #include "idotimeline.h" #include "idotypebuiltins.h" -#include +#include #include #define IDO_TIMELINE_GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), IDO_TYPE_TIMELINE, IdoTimelinePriv)) -- cgit v1.2.3 From ab8fccf9bf24c05a20f9bbd14fad1afc4a62873e Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Wed, 1 Jun 2011 15:36:43 -0400 Subject: fix various unused-variable warnings; not directly related to gtk3 work, but helps focus on actual problems --- src/idocalendarmenuitem.c | 7 ------- src/idomessagedialog.c | 4 ---- src/idoscalemenuitem.c | 12 +++++------- src/idotimeline.c | 2 -- 4 files changed, 5 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/idocalendarmenuitem.c b/src/idocalendarmenuitem.c index 2705ae8..1bf4d0f 100644 --- a/src/idocalendarmenuitem.c +++ b/src/idocalendarmenuitem.c @@ -65,7 +65,6 @@ ido_calendar_menu_item_class_init (IdoCalendarMenuItemClass *klass) GObjectClass *gobject_class; GtkWidgetClass *widget_class; GtkMenuItemClass *menu_item_class; - GtkMenuItemClass *item_class; gobject_class = G_OBJECT_CLASS (klass); widget_class = GTK_WIDGET_CLASS (klass); @@ -100,12 +99,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); diff --git a/src/idomessagedialog.c b/src/idomessagedialog.c index 1e72701..9b5fe2c 100644 --- a/src/idomessagedialog.c +++ b/src/idomessagedialog.c @@ -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); } /** diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c index 6b1189b..720deb9 100644 --- a/src/idoscalemenuitem.c +++ b/src/idoscalemenuitem.c @@ -470,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; @@ -689,11 +687,11 @@ ido_scale_menu_item_new_with_range (const gchar *label, { GtkWidget *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)); } /** diff --git a/src/idotimeline.c b/src/idotimeline.c index 479fa09..c6275ae 100644 --- a/src/idotimeline.c +++ b/src/idotimeline.c @@ -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) { -- cgit v1.2.3 From da4d22c398ce99def3619836fecd6d65b9b19e1a Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Wed, 1 Jun 2011 15:49:43 -0400 Subject: fix build errors with gtk2 --- src/idocalendarmenuitem.c | 29 ++++++++++++++++++++++++++--- src/idoentrymenuitem.c | 24 ++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/idocalendarmenuitem.c b/src/idocalendarmenuitem.c index 1bf4d0f..a778cdc 100644 --- a/src/idocalendarmenuitem.c +++ b/src/idocalendarmenuitem.c @@ -26,8 +26,13 @@ #include #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,16 +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; @@ -216,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; @@ -224,7 +244,11 @@ ido_calendar_menu_item_select (GtkMenuItem *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; @@ -321,8 +345,7 @@ ido_calendar_menu_item_mark_day (IdoCalendarMenuItem *menuitem, guint day) g_return_val_if_fail(IDO_IS_CALENDAR_MENU_ITEM(menuitem), FALSE); gtk_calendar_mark_day(GTK_CALENDAR (menuitem->priv->calendar), day); - return gtk_calendar_get_day_is_marked (GTK_CALENDAR (menuitem->priv->calendar), day); - + return TRUE; } gboolean @@ -331,7 +354,7 @@ ido_calendar_menu_item_unmark_day (IdoCalendarMenuItem *menuitem, guint day) g_return_val_if_fail(IDO_IS_CALENDAR_MENU_ITEM(menuitem), FALSE); gtk_calendar_unmark_day(GTK_CALENDAR (menuitem->priv->calendar), day); - return !gtk_calendar_get_day_is_marked (GTK_CALENDAR (menuitem->priv->calendar), day); + return TRUE; } void diff --git a/src/idoentrymenuitem.c b/src/idoentrymenuitem.c index a1a16cc..1636da9 100644 --- a/src/idoentrymenuitem.c +++ b/src/idoentrymenuitem.c @@ -26,8 +26,13 @@ #include #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,16 +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; @@ -213,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; @@ -221,7 +241,11 @@ ido_entry_menu_item_select (GtkMenuItem *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; -- cgit v1.2.3 From db8bf6c567c8fde73eaf97b8798e86b4ebc0bd4a Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Wed, 1 Jun 2011 15:53:29 -0400 Subject: adjustments aren't widgets --- src/idorange.c | 2 +- src/idorange.h | 2 +- src/idoscalemenuitem.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/idorange.c b/src/idorange.c index 55f7117..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 (GtkWidget *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 517d7fb..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 (GtkWidget *adj, +GtkWidget* ido_range_new (GtkAdjustment *adj, IdoRangeStyle style); G_END_DECLS diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c index 720deb9..96ec5d5 100644 --- a/src/idoscalemenuitem.c +++ b/src/idoscalemenuitem.c @@ -213,7 +213,7 @@ ido_scale_menu_item_constructed (GObject *object) { IdoScaleMenuItem *self = IDO_SCALE_MENU_ITEM (object); IdoScaleMenuItemPrivate *priv = GET_PRIVATE (self); - GtkWidget *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; @@ -685,7 +685,7 @@ ido_scale_menu_item_new_with_range (const gchar *label, gdouble max, gdouble step) { - GtkWidget *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 GTK_WIDGET (g_object_new (IDO_TYPE_SCALE_MENU_ITEM, "label", label, -- cgit v1.2.3 From cd59e86ecac12aef184e3306226d8fb2b7331a7a Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Wed, 1 Jun 2011 16:08:47 -0400 Subject: drop deprecated use of event_window --- src/idoscalemenuitem.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c index 96ec5d5..88bb8ae 100644 --- a/src/idoscalemenuitem.c +++ b/src/idoscalemenuitem.c @@ -502,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 && @@ -551,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; @@ -562,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; -- cgit v1.2.3 From d61ddbef2c5f207e5ba70c976b8565a043c646ca Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Mon, 20 Jun 2011 09:34:43 -0400 Subject: use const not G_CONST_RETURN --- src/idoscalemenuitem.c | 4 ++-- src/idoscalemenuitem.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c index 88bb8ae..8b9e1ac 100644 --- a/src/idoscalemenuitem.c +++ b/src/idoscalemenuitem.c @@ -796,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; @@ -817,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 ee0691a..5afafd3 100644 --- a/src/idoscalemenuitem.h +++ b/src/idoscalemenuitem.h @@ -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, -- cgit v1.2.3