From: Huang Peng Date: Mon, 2 Jun 2008 11:17:29 +0000 (+0800) Subject: Check inotify in configure, and make code works without inotify. X-Git-Tag: 0.1.0.20080810~454 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9823c20eb65c7eb0d9a38398a0a4a3ab9a845b66;p=platform%2Fupstream%2Fibus.git Check inotify in configure, and make code works without inotify. --- diff --git a/configure.ac b/configure.ac index f8ccc916..f1c55558 100644 --- a/configure.ac +++ b/configure.ac @@ -23,11 +23,11 @@ # $Id: $ # AC_INIT([ibus],[0.0.1],[https://bugs.launchpad.net/ibus],[ibus]) - AM_INIT_AUTOMAKE([1.10]) +AC_GNU_SOURCE + AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) -AC_GNU_SOURCE # define PACKAGE_VERSION_* variables AS_VERSION @@ -42,7 +42,8 @@ AC_ISC_POSIX AC_HEADER_STDC AM_PROG_LIBTOOL - +# check inotify +AC_CHECK_HEADERS([sys/inotify.h]) # check glib2 AM_PATH_GLIB_2_0 diff --git a/gtk2/gikimclient.c b/gtk2/gikimclient.c index 48f7b5ac..cf4423b2 100644 --- a/gtk2/gikimclient.c +++ b/gtk2/gikimclient.c @@ -17,11 +17,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ +#include #include #include #include #include -#include #include #include #include @@ -29,6 +29,10 @@ #include #include #include +#ifdef HAVE_SYS_INOTIFY_H +#define HAVE_INOTIFY +# include +#endif #include "gikimclient.h" #define IBUS_NAME "org.freedesktop.IBus" @@ -42,10 +46,13 @@ struct _GikIMClientPrivate { #if USE_DBUS_SESSION_BUS DBusConnection *dbus; #endif + +#ifdef HAVE_INOTIFY /* inotify */ gint inotify_wd; GIOChannel *inotify_channel; guint inotify_source; +#endif DBusConnection *ibus; gboolean enable; @@ -298,6 +305,7 @@ _gik_im_client_ibus_close (GikIMClient *client) } } +#ifdef HAVE_INOTIFY static gboolean _gik_im_client_inotify_cb (GIOChannel *source, GIOCondition condition, GikIMClient *client) { @@ -321,6 +329,7 @@ _gik_im_client_inotify_cb (GIOChannel *source, GIOCondition condition, GikIMClie g_free (p); } +#endif static void gik_im_client_init (GikIMClient *obj) @@ -330,6 +339,8 @@ gik_im_client_init (GikIMClient *obj) DBusError error; GikIMClient *client = GIK_IM_CLIENT (obj); GikIMClientPrivate *priv; + +#ifdef HAVE_INOTIFY gint inotify_fd; gchar *watch_path; struct stat stat_buf; @@ -361,8 +372,7 @@ gik_im_client_init (GikIMClient *obj) (GIOFunc)_gik_im_client_inotify_cb, (gpointer)client); g_free (watch_path); - - +#endif #if USE_DBUS_SESSION_BUS /* @@ -449,8 +459,10 @@ gik_im_client_finalize (GObject *obj) g_assert (client == _client); +#ifdef HAVE_INOTIFY g_io_channel_unref (priv->inotify_channel); g_source_remove (priv->inotify_source); +#endif if (priv->preedit_string) { g_free (priv->preedit_string);