diff options
author | Michael Terry <mike@mterry.name> | 2011-06-01 15:24:28 -0400 |
---|---|---|
committer | Michael Terry <mike@mterry.name> | 2011-06-01 15:24:28 -0400 |
commit | 5ddcf6b51cdcb8d793748ff4a812f843a0d4f6e7 (patch) | |
tree | 67cdd3557d77ae36dbc61ed05cd6c136bf4f2fe8 | |
parent | 3e67ec3d19dd4e31ec68b1b9c33f4b330c7672a3 (diff) | |
download | ayatana-ido-5ddcf6b51cdcb8d793748ff4a812f843a0d4f6e7.tar.gz ayatana-ido-5ddcf6b51cdcb8d793748ff4a812f843a0d4f6e7.tar.bz2 ayatana-ido-5ddcf6b51cdcb8d793748ff4a812f843a0d4f6e7.zip |
allow building either gtk2 or gtk3 versions; some deprecation cleanups
-rw-r--r-- | Makefile.am | 18 | ||||
-rw-r--r-- | configure.ac | 16 | ||||
-rw-r--r-- | libido3.pc.in | 11 | ||||
-rw-r--r-- | src/Makefile.am | 20 | ||||
-rw-r--r-- | src/idomessagedialog.c | 8 | ||||
-rw-r--r-- | src/idoscalemenuitem.c | 7 |
6 files changed, 59 insertions, 21 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 1f644c0..fc26c5b 100644 --- a/configure.ac +++ b/configure.ac @@ -68,7 +68,20 @@ AC_FUNC_MALLOC AC_FUNC_MMAP AC_CHECK_FUNCS([memset munmap strcasecmp strdup]) -PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 2.19.7) +PKG_PROG_PKG_CONFIG + +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/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/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 |