[gnumeric] Compiation: Improve gtk_table_get_size macro.



commit a142984677efd33d29a451bbcda11be35f774b03
Author: Morten Welinder <terra gnome org>
Date:   Mon Nov 8 11:53:10 2010 -0500

    Compiation: Improve gtk_table_get_size macro.

 configure.in       |   10 +++++++++-
 src/dead-kittens.h |   37 ++++++++++++++++++++++++-------------
 2 files changed, 33 insertions(+), 14 deletions(-)
---
diff --git a/configure.in b/configure.in
index c040f2b..70704ff 100644
--- a/configure.in
+++ b/configure.in
@@ -698,7 +698,7 @@ AC_CHECK_FUNCS(gtk_tree_view_column_get_button)
 AC_CHECK_FUNCS(gtk_widget_get_visible gtk_widget_set_visible gtk_widget_get_state gtk_widget_is_toplevel gtk_widget_get_window gtk_widget_get_can_focus gtk_widget_has_focus gtk_widget_get_style gtk_widget_get_allocation gtk_widget_is_sensitive gtk_widget_set_can_focus gtk_widget_get_realized)
 AC_CHECK_FUNCS(gsf_infile_msvba_steal_modules gsf_open_pkg_foreach_rel )
 
-AC_MSG_CHECKING([working GTK_WIDGET_REALIZED.])
+AC_MSG_CHECKING([for working GTK_WIDGET_REALIZED.])
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gtk/gtk.h>]],
 				[[GtkWidget *w = NULL;
 				(void)(GTK_WIDGET_REALIZED (w));]])],
@@ -714,6 +714,14 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gtk/gtk.h>]],
 		AC_MSG_RESULT(yes)],
 	       [AC_MSG_RESULT(no)])
 
+AC_MSG_CHECKING([for GtkTable::nrows])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gtk/gtk.h>]],
+				[[GtkTable *t = NULL;
+				(void)(t->nrows == t->ncols);]])],
+               [AC_DEFINE(HAVE_GTK_TABLE_NROWS, 1, [Define if GtkTable::nrows exists])
+		AC_MSG_RESULT(yes)],
+	       [AC_MSG_RESULT(no)])
+
 AC_MSG_CHECKING([for GtkTreeViewColumn::button])
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gtk/gtk.h>]],
 				[[GtkTreeViewColumn *c = NULL;
diff --git a/src/dead-kittens.h b/src/dead-kittens.h
index 1f5a11e..a6c41b4 100644
--- a/src/dead-kittens.h
+++ b/src/dead-kittens.h
@@ -12,7 +12,7 @@
 #endif
 
 #ifndef HAVE_GTK_ENTRY_GET_TEXT_LENGTH
-#define gtk_entry_get_text_length(x) g_utf8_strlen (gtk_entry_get_text (x), -1)
+#define gtk_entry_get_text_length(x) g_utf8_strlen(gtk_entry_get_text((x)),-1)
 #endif
 
 #ifndef HAVE_GTK_ENTRY_GET_TEXT_AREA
@@ -32,11 +32,11 @@
 #endif
 
 #ifndef HAVE_GTK_WIDGET_GET_VISIBLE
-#define gtk_widget_get_visible(_w_) GTK_WIDGET_VISIBLE(_w_)
+#define gtk_widget_get_visible(_w_) GTK_WIDGET_VISIBLE((_w_))
 #endif
 
 #ifndef HAVE_GTK_WIDGET_IS_SENSITIVE
-#define gtk_widget_is_sensitive(w) GTK_WIDGET_IS_SENSITIVE (w)
+#define gtk_widget_is_sensitive(w) GTK_WIDGET_IS_SENSITIVE ((w))
 #endif
 
 #ifndef HAVE_GTK_WIDGET_IS_TOPLEVEL
@@ -66,14 +66,14 @@
 #ifndef HAVE_GTK_WIDGET_SET_CAN_FOCUS
 #define gtk_widget_set_can_focus(w,t)					\
 	do {								\
-		if (t) GTK_WIDGET_SET_FLAGS ((w), GTK_CAN_FOCUS);	\
+		if ((t)) GTK_WIDGET_SET_FLAGS ((w), GTK_CAN_FOCUS);	\
 		else GTK_WIDGET_UNSET_FLAGS ((w), GTK_CAN_FOCUS);	\
 	} while (0)		     
 #endif
 
 #ifndef HAVE_GTK_WIDGET_GET_REALIZED
 #  ifdef HAVE_WORKING_GTK_WIDGET_REALIZED
-#    define gtk_widget_get_realized(w) GTK_WIDGET_REALIZED (w)
+#    define gtk_widget_get_realized(w) GTK_WIDGET_REALIZED ((w))
 #  else
 #    define gtk_widget_get_realized(wid) (((GTK_OBJECT (wid)->_g_sealed__flags) & GTK_REALIZED) != 0)
 #  endif
@@ -85,7 +85,7 @@
 
 #ifndef HAVE_GTK_ADJUSTMENT_CONFIGURE
 #define gtk_adjustment_configure(_a,_v,_l,_u,_si,_pi,_ps)	\
-  g_object_set (_a,						\
+  g_object_set ((_a),						\
                 "lower", (double)(_l),				\
                 "upper", (double)(_u),				\
                 "step-increment", (double)(_si),		\
@@ -110,13 +110,24 @@
 #endif
 
 #ifndef HAVE_GTK_TABLE_GET_SIZE
-/* At first sealed with no accessors.  */
-#define gtk_table_get_size(_t,_r,_c) do {		\
-  int *_pr = (_r);					\
-  int *_pc = (_c);					\
-  if (_pr) g_object_get (_t, "n-rows", _pr, NULL);	\
-  if (_pc) g_object_get (_t, "n-columns", _pc, NULL);	\
-} while (0)
+#  ifdef HAVE_GTK_TABLE_NROWS
+#     define gtk_table_get_size(_t,_r,_c) do {	\
+       int *_pr = (_r);				\
+       int *_pc = (_c);				\
+       GtkTable *_pt = (_t);			\
+       if (_pr) *_pr = _pt->nrows;		\
+       if (_pc) *_pc = _pt->ncols;		\
+     } while (0)
+#  else
+     /* At first sealed with no accessors.  */
+#     define gtk_table_get_size(_t,_r,_c) do {			\
+       int *_pr = (_r);						\
+       int *_pc = (_c);						\
+       GtkTable *_pt = (_t);					\
+       if (_pr) g_object_get (_pt, "n-rows", _pr, NULL);	\
+       if (_pc) g_object_get (_pt, "n-columns", _pc, NULL);	\
+     } while (0)
+#  endif
 #endif
 
 /* This function does not exist in gtk+ yet.  634100.  */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]