diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-08-22 09:57:08 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-08-22 09:57:08 -0500 |
commit | 2481b74fa64122365eef5293ae86d71b5fae3fa6 (patch) | |
tree | cc3845ff2ee2c8ec173b072de9fabe29670588c4 | |
parent | 8f279d3f26f588bb022f3f0d05edff6858035eab (diff) | |
parent | 73302803e066d8d36e425feda15f57fca44f4bc5 (diff) | |
download | ayatana-ido-2481b74fa64122365eef5293ae86d71b5fae3fa6.tar.gz ayatana-ido-2481b74fa64122365eef5293ae86d71b5fae3fa6.tar.bz2 ayatana-ido-2481b74fa64122365eef5293ae86d71b5fae3fa6.zip |
merge lp:~charlesk/ido/nogtk2 to remove gtk2 support from the configure script and the source
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | configure.ac | 20 | ||||
-rw-r--r-- | example/Makefile.am | 4 | ||||
-rw-r--r-- | example/menus.c | 4 | ||||
-rw-r--r-- | example/messagedialog.c | 4 | ||||
-rw-r--r-- | src/Makefile.am | 5 | ||||
-rw-r--r-- | src/idocalendarmenuitem.c | 32 | ||||
-rw-r--r-- | src/idoentrymenuitem.c | 28 | ||||
-rw-r--r-- | src/idomessagedialog.c | 24 | ||||
-rw-r--r-- | src/idorange.c | 33 | ||||
-rw-r--r-- | src/idoscalemenuitem.c | 32 | ||||
-rw-r--r-- | tests/Makefile.am | 5 |
12 files changed, 4 insertions, 191 deletions
diff --git a/Makefile.am b/Makefile.am index 6cad78b..4b2a6d3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,10 +1,6 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} -if USE_GTK3 VER=3 -else -VER= -endif V = @ Q = $(V:1=) diff --git a/configure.ac b/configure.ac index 0646ee2..963de1e 100644 --- a/configure.ac +++ b/configure.ac @@ -80,22 +80,11 @@ AC_CHECK_FUNCS([memset munmap strcasecmp strdup]) AC_CHECK_LIBM GLIB_REQUIRED_VERSION=2.32.0 +GTK_REQUIRED_VERSION=3.4.0 + +PKG_CHECK_MODULES(GTK,[gtk+-3.0 >= $GTK_REQUIRED_VERSION + glib-2.0 >= $GLIB_REQUIRED_VERSION]) -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 - glib-2.0 >= GLIB_REQUIRED_VERSION]) -else - PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0.0 - glib-2.0 >= GLIB_REQUIRED_VERSION]) - AC_DEFINE_UNQUOTED(USE_GTK3, , [Use GTK3]) -fi AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) @@ -162,7 +151,6 @@ echo " ido $VERSION" echo " ===============================" echo "" echo " Prefix : ${prefix}" -echo " GTK : ${with_gtk}" echo " gcov : ${use_gcov}" echo "" echo " Documentation: ${enable_gtk_doc}" diff --git a/example/Makefile.am b/example/Makefile.am index b986b9b..a578404 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -1,8 +1,4 @@ -if USE_GTK3 VER=3 -else -VER= -endif noinst_PROGRAMS = \ messagedialog \ diff --git a/example/menus.c b/example/menus.c index 12a2284..5687b8e 100644 --- a/example/menus.c +++ b/example/menus.c @@ -40,11 +40,7 @@ main (int argc, char *argv[]) g_signal_connect (window, "delete-event", G_CALLBACK (gtk_main_quit), NULL); -#ifdef USE_GTK3 vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - vbox = gtk_vbox_new (FALSE, 0); -#endif gtk_container_add (GTK_CONTAINER (window), vbox); diff --git a/example/messagedialog.c b/example/messagedialog.c index 4ba866b..d9cfc21 100644 --- a/example/messagedialog.c +++ b/example/messagedialog.c @@ -41,11 +41,7 @@ main (int argc, char *argv[]) gtk_window_set_title (GTK_WINDOW (window), "Message Dialogs"); g_signal_connect (window, "destroy", gtk_main_quit, NULL); -#ifdef USE_GTK3 vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); -#else - vbox = gtk_vbox_new (FALSE, 0); -#endif gtk_container_add (GTK_CONTAINER (window), vbox); diff --git a/src/Makefile.am b/src/Makefile.am index 79e3e04..017874f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,10 +1,5 @@ -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 diff --git a/src/idocalendarmenuitem.c b/src/idocalendarmenuitem.c index da7c436..84bee80 100644 --- a/src/idocalendarmenuitem.c +++ b/src/idocalendarmenuitem.c @@ -27,13 +27,8 @@ #include "idocalendarmenuitem.h" #include "config.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, @@ -71,27 +66,16 @@ 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; @@ -132,11 +116,7 @@ ido_calendar_menu_item_init (IdoCalendarMenuItem *item) G_CALLBACK (calendar_move_focus_cb), item); -#ifdef USE_GTK3 priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - priv->box = gtk_hbox_new (FALSE, 0); -#endif gtk_box_pack_start (GTK_BOX (priv->box), priv->calendar, FALSE, FALSE, 0); @@ -213,7 +193,6 @@ ido_calendar_menu_item_button_press (GtkWidget *widget, gtk_widget_grab_focus (calendar); } -#if GTK_CHECK_VERSION (3, 0, 0) GdkEvent * newevent = gdk_event_copy((GdkEvent *)(event)); GList * children = gdk_window_get_children(gtk_widget_get_window(calendar)); GList * child; @@ -242,7 +221,6 @@ ido_calendar_menu_item_button_press (GtkWidget *widget, ((GdkEventButton *)newevent)->window = event->window; gdk_event_free(newevent); -#endif return TRUE; } @@ -254,20 +232,14 @@ static gboolean ido_calendar_menu_item_button_release (GtkWidget *widget, GdkEventButton *event) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *calendar = IDO_CALENDAR_MENU_ITEM (widget)->priv->calendar; GTK_WIDGET_GET_CLASS(calendar)->button_release_event(GTK_WIDGET(calendar), event); -#endif return TRUE; } 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; @@ -275,11 +247,7 @@ 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; diff --git a/src/idoentrymenuitem.c b/src/idoentrymenuitem.c index 088c559..5390d0b 100644 --- a/src/idoentrymenuitem.c +++ b/src/idoentrymenuitem.c @@ -27,13 +27,8 @@ #include "idoentrymenuitem.h" #include "config.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, @@ -66,27 +61,16 @@ 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; @@ -119,11 +103,7 @@ ido_entry_menu_item_init (IdoEntryMenuItem *item) G_CALLBACK (entry_move_focus_cb), item); -#ifdef USE_GTK3 priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - priv->box = gtk_hbox_new (FALSE, 0); -#endif gtk_box_pack_start (GTK_BOX (priv->box), priv->entry, FALSE, FALSE, 0); @@ -235,11 +215,7 @@ 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; @@ -247,11 +223,7 @@ 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; diff --git a/src/idomessagedialog.c b/src/idomessagedialog.c index d4a3e2f..41ff2e7 100644 --- a/src/idomessagedialog.c +++ b/src/idomessagedialog.c @@ -167,22 +167,14 @@ ido_message_dialog_focus_in_event (GtkWidget *widget, IdoTimeline *timeline; IdoMessageDialogMorphContext *context; -#ifdef USE_GTK3 gtk_widget_get_preferred_size (GTK_WIDGET (dialog), NULL, &start); -#else - gtk_widget_get_requisition (GTK_WIDGET (dialog), &start); -#endif priv->expanded = TRUE; gtk_widget_show (priv->action_area); gtk_widget_show (priv->secondary_label); -#ifdef USE_GTK3 gtk_widget_get_preferred_size (GTK_WIDGET (dialog), NULL, &end); -#else - gtk_widget_get_requisition (GTK_WIDGET (dialog), &end); -#endif gtk_widget_hide (priv->action_area); gtk_widget_hide (priv->secondary_label); @@ -289,14 +281,6 @@ 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) { va_start (args, message_format); @@ -379,11 +363,7 @@ ido_message_dialog_get_label (IdoMessageDialog *dialog, gboolean primary) for (list = children; list != NULL; list = list->next) { -#ifdef USE_GTK3 if (G_TYPE_FROM_INSTANCE (list->data) == GTK_TYPE_BOX && gtk_orientable_get_orientation (list->data) == GTK_ORIENTATION_HORIZONTAL) -#else - if (G_TYPE_FROM_INSTANCE (list->data) == GTK_TYPE_HBOX) -#endif { GList *hchildren; GList *hlist; @@ -393,11 +373,7 @@ ido_message_dialog_get_label (IdoMessageDialog *dialog, gboolean primary) for (hlist = hchildren; hlist != NULL; hlist = hlist->next) { -#ifdef USE_GTK3 if (G_TYPE_FROM_INSTANCE (hlist->data) == GTK_TYPE_BOX && gtk_orientable_get_orientation (hlist->data) == GTK_ORIENTATION_VERTICAL) -#else - if (G_TYPE_FROM_INSTANCE (hlist->data) == GTK_TYPE_VBOX) -#endif { GList *vlist; GtkWidget *vbox = GTK_WIDGET (hlist->data); diff --git a/src/idorange.c b/src/idorange.c index 7d7ee85..4f165bb 100644 --- a/src/idorange.c +++ b/src/idorange.c @@ -41,10 +41,6 @@ static void ido_range_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -#ifdef USE_GTK3 -static void ido_range_grab_notify (GtkWidget *widget, - gboolean was_grabbed); -#endif #define IDO_RANGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), IDO_TYPE_RANGE, IdoRangePrivate)) @@ -65,10 +61,6 @@ ido_range_class_init (IdoRangeClass *class) gobject_class->set_property = ido_range_set_property; gobject_class->get_property = ido_range_get_property; -#ifdef USE_GTK3 - widget_class->grab_notify = ido_range_grab_notify; -#endif - g_object_class_install_property (gobject_class, PROP_STYLE, g_param_spec_enum ("range-style", @@ -139,21 +131,6 @@ ido_range_set_property (GObject *object, } } -#ifdef USE_GTK3 -static void -ido_range_grab_notify (GtkWidget *widget, gboolean was_grabbed) -{ - /* - * FIXME: workaround for lp bug #865122. - * Without this handler, GtkRange will call remove_grab which results - * in an infinite loop of grab_notifies. - * - * The widget will still work properly, because grab-broken-event will get - * properly fired and internal state of GtkRange will be properly updated. - */ -} -#endif - static void ido_range_constructed (GObject *object) { @@ -176,16 +153,6 @@ ido_range_constructed (GObject *object) "knob-width", &width, "knob-height", &height, NULL); - -#ifndef USE_GTK3 - g_snprintf (buf, sizeof (buf), - "style \"ido-range\" {\n" - " GtkRange::slider-width = %d\n" - " GtkScale::slider-length = %d\n" - "} widget \"*.idorange-%p\" style \"ido-range\"\n", - width, height, range); - gtk_rc_parse_string (buf); -#endif } gtk_range_set_slider_size_fixed (GTK_RANGE (range), TRUE); diff --git a/src/idoscalemenuitem.c b/src/idoscalemenuitem.c index 4b60b8b..b3c80f6 100644 --- a/src/idoscalemenuitem.c +++ b/src/idoscalemenuitem.c @@ -144,27 +144,15 @@ ido_scale_menu_item_size_allocate (GtkWidget *widget, switch (priv->style) { case IDO_SCALE_MENU_ITEM_STYLE_IMAGE: -#ifdef USE_GTK3 gtk_widget_get_preferred_size (priv->primary_image, &primary_req, NULL); gtk_widget_get_preferred_size (priv->secondary_image, &secondary_req, NULL); -#else - gtk_widget_get_child_requisition (priv->primary_image, &primary_req); - gtk_widget_get_child_requisition (priv->secondary_image, &secondary_req); -#endif - primary_padding = gtk_widget_get_visible (priv->primary_image) ? primary_req.width : 0; secondary_padding = gtk_widget_get_visible (priv->secondary_image) ? secondary_req.width : 0; break; case IDO_SCALE_MENU_ITEM_STYLE_LABEL: -#ifdef USE_GTK3 gtk_widget_get_preferred_size (priv->primary_label, &primary_req, NULL); gtk_widget_get_preferred_size (priv->secondary_label, &secondary_req, NULL); -#else - gtk_widget_get_child_requisition (priv->primary_label, &primary_req); - gtk_widget_get_child_requisition (priv->secondary_label, &secondary_req); -#endif - primary_padding = gtk_widget_get_visible (priv->primary_label) ? primary_req.width : 0; secondary_padding = gtk_widget_get_visible (priv->secondary_label) ? secondary_req.width : 0; break; @@ -256,11 +244,7 @@ ido_scale_menu_item_constructed (GObject *object) G_CALLBACK (on_scale_button_press_or_release_event), NULL); -#ifdef USE_GTK3 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif priv->primary_image = gtk_image_new (); g_signal_connect (priv->primary_image, "notify", @@ -505,10 +489,6 @@ ido_scale_menu_item_button_press_event (GtkWidget *menuitem, IdoScaleMenuItemPrivate *priv = GET_PRIVATE (menuitem); gdouble x; -#ifndef USE_GTK3 - GtkWidget *scale = priv->scale; -#endif - // can we block emissions of "grab-notify" on parent?? translate_event_coordinates (menuitem, event->x, &x); @@ -517,28 +497,16 @@ ido_scale_menu_item_button_press_event (GtkWidget *menuitem, translate_event_coordinates (menuitem, event->x_root, &x); event->x_root = x; -#ifndef USE_GTK3 - ubuntu_gtk_widget_set_has_grab (scale, TRUE); -#endif - gtk_widget_event (priv->scale, ((GdkEvent *)(void*)(event))); -#ifndef USE_GTK3 - ubuntu_gtk_widget_set_has_grab (scale, FALSE); -#endif - if (!priv->grabbed) { priv->grabbed = TRUE; g_signal_emit (menuitem, signals[SLIDER_GRABBED], 0); } -#ifdef USE_GTK3 return FALSE; -#else - return TRUE; -#endif } static gboolean diff --git a/tests/Makefile.am b/tests/Makefile.am index 04e6cde..89b9b5b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,10 +1,5 @@ -if USE_GTK3 VER=3 IDOLIB = $(top_builddir)/src/libido3-0.1.la -else -VER= -IDOLIB = $(top_builddir)/src/libido-0.1.la -endif check_LIBRARIES = libgtest.a check_PROGRAMS = |