[gnumeric] compilation: gtk compatiblity work.



commit 3aa7fa312e1a353f8832800a2469452152a80500
Author: Morten Welinder <terra gnome org>
Date:   Wed Jun 9 11:25:04 2010 -0400

    compilation: gtk compatiblity work.

 ChangeLog                                 |    4 ++++
 configure.in                              |    2 +-
 src/Makefile.am                           |    2 ++
 src/dead-kittens.h                        |   26 ++++++++++++++++++++++++++
 src/dialogs/dialog-define-names.c         |    7 +------
 src/dialogs/dialog-function-select.c      |    1 +
 src/gnm-pane.c                            |   21 ++++++++++-----------
 src/item-cursor.c                         |    5 +----
 src/widgets/gnumeric-cell-renderer-text.c |    5 +----
 src/widgets/gnumeric-expr-entry.c         |    5 +----
 10 files changed, 48 insertions(+), 30 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 674f637..a7dfa84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-09  Morten Welinder  <terra gnome org>
+
+	* src/dead-kittens.h: New file for kittens killed by gtk.
+
 2010-06-09 Andreas J. Guelzow <aguelzow pyrshep ca>
 	
 	* component/Gnumeric-embed.xml.in: add Function Help
diff --git a/configure.in b/configure.in
index 7ae23ff..df2e770 100644
--- a/configure.in
+++ b/configure.in
@@ -689,7 +689,7 @@ LIBS="$GNUMERIC_LIBS $LIBS"
 
 AC_CHECK_FUNCS(g_date_set_time_t g_slice_alloc g_option_context_set_delocalize)
 AC_CHECK_FUNCS(pango_font_map_create_context)
-AC_CHECK_FUNCS(gtk_orientable_set_orientation gtk_adjustment_configure gtk_widget_get_state gtk_widget_is_toplevel gtk_widget_get_window gsf_open_pkg_foreach_rel gtk_dialog_get_content_area gtk_entry_get_buffer gtk_widget_get_can_focus gtk_entry_get_text_length gtk_entry_set_icon_from_stock)
+AC_CHECK_FUNCS(gtk_orientable_set_orientation gtk_adjustment_configure gtk_widget_set_visible gtk_widget_get_state gtk_widget_is_toplevel gtk_widget_get_window gsf_open_pkg_foreach_rel gtk_dialog_get_content_area gtk_entry_get_buffer gtk_widget_get_can_focus gtk_entry_get_text_length gtk_entry_set_icon_from_stock)
 AC_CHECK_FUNCS(gsf_infile_msvba_steal_modules)
 
 AC_MSG_CHECKING([for PANGO_WEIGHT_THIN etc.])
diff --git a/src/Makefile.am b/src/Makefile.am
index ca9b8f3..028d81a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,6 +10,8 @@ bin_PROGRAMS =
 check_PROGRAMS =
 noinst_PROGRAMS = sstest
 
+noinst_HEADERS = dead-kittens.h
+
 if WITH_GTK
   SUBDIRS += pixmaps dialogs widgets
   bin_PROGRAMS += gnumeric
diff --git a/src/dead-kittens.h b/src/dead-kittens.h
new file mode 100644
index 0000000..4c65041
--- /dev/null
+++ b/src/dead-kittens.h
@@ -0,0 +1,26 @@
+#ifndef GNUMERIC_GTK_DEAD_KITTENS_H
+#define GNUMERIC_GTK_DEAD_KITTENS_H
+
+/* To be included only from C files, not headers.  */
+
+#ifndef HAVE_GTK_ENTRY_GET_TEXT_LENGTH
+#define gtk_entry_get_text_length(x) g_utf8_strlen (gtk_entry_get_text (x), -1) 
+#endif
+
+#ifndef HAVE_GTK_WIDGET_SET_VISIBLE
+#define gtk_widget_set_visible(_w_,_v_) do { if (_v_) gtk_widget_show (_w_); else gtk_widget_hide (_w_); } while (0)
+#endif
+
+#ifndef HAVE_GTK_WIDGET_IS_TOPLEVEL
+#define gtk_widget_is_toplevel(w_) (GTK_WIDGET_FLAGS ((w_)) & GTK_TOPLEVEL)
+#endif
+
+#ifndef HAVE_GTK_WIDGET_GET_STATE
+#define gtk_widget_get_state(_w) GTK_WIDGET_STATE((_w))
+#endif
+
+#ifndef HAVE_GTK_WIDGET_GET_WINDOW
+#define gtk_widget_get_window(w) ((w)->window)
+#endif
+
+#endif
diff --git a/src/dialogs/dialog-define-names.c b/src/dialogs/dialog-define-names.c
index b35dd0f..6622a76 100644
--- a/src/dialogs/dialog-define-names.c
+++ b/src/dialogs/dialog-define-names.c
@@ -41,6 +41,7 @@
 #include <gui-util.h>
 #include <parse-util.h>
 #include <commands.h>
+#include <dead-kittens.h>
 #include <widgets/gnumeric-expr-entry.h>
 #include <widgets/gnumeric-cell-renderer-expr-entry.h>
 #include <widgets/gnumeric-cell-renderer-toggle.h>
@@ -52,12 +53,6 @@
 #define DEFINE_NAMES_KEY "define-names-dialog"
 #define PASTE_NAMES_KEY "paste-names-dialog"
 
-#ifndef HAVE_GTK_ENTRY_GET_TEXT_LENGTH
-#define gtk_entry_get_text_length(x) g_utf8_strlen (gtk_entry_get_text (x), -1) 
-#endif
-
-
-
 typedef struct {
 	GladeXML		*gui;
 	GtkWidget		*dialog;
diff --git a/src/dialogs/dialog-function-select.c b/src/dialogs/dialog-function-select.c
index 17a9ee4..a669bb5 100644
--- a/src/dialogs/dialog-function-select.c
+++ b/src/dialogs/dialog-function-select.c
@@ -38,6 +38,7 @@
 #include <expr.h>
 #include <value.h>
 #include <sheet.h>
+#include <dead-kittens.h>
 #include <gnumeric-gconf.h>
 
 #include <gsf/gsf-impl-utils.h>
diff --git a/src/gnm-pane.c b/src/gnm-pane.c
index 4c2e90e..3c38ccd 100644
--- a/src/gnm-pane.c
+++ b/src/gnm-pane.c
@@ -1011,13 +1011,11 @@ cb_pane_drag_data_received (GtkWidget *widget, GdkDragContext *context,
 {
 	double wx, wy;
 
-#ifdef DEBUG_DND
-	{
+	if (gnm_debug_flag ("dnd")) {
 		gchar *target_name = gdk_atom_name (selection_data->target);
 		g_printerr ("drag-data-received - %s\n", target_name);
 		g_free (target_name);
 	}
-#endif
 
 	goc_canvas_w2c (GOC_CANVAS (pane), x, y, &wx, &wy);
 	scg_drag_data_received (pane->simple.scg,
@@ -1031,11 +1029,12 @@ cb_pane_drag_data_get (GtkWidget *widget, GdkDragContext *context,
 		       guint info, guint time,
 		       SheetControlGUI *scg)
 {
-#ifdef DEBUG_DND
-	gchar *target_name = gdk_atom_name (selection_data->target);
-	g_printerr ("drag-data-get - %s \n", target_name);
-	g_free (target_name);
-#endif
+	if (gnm_debug_flag ("dnd")) {
+		gchar *target_name = gdk_atom_name (selection_data->target);
+		g_printerr ("drag-data-get - %s \n", target_name);
+		g_free (target_name);
+	}
+
 	scg_drag_data_get (scg, selection_data);
 }
 
@@ -2515,8 +2514,9 @@ gnm_pane_drag_begin (GnmPane *pane, SheetObject *so, GdkEvent *event)
 			gtk_target_list_unref (im_targets);
 		}
 	}
-#ifdef DEBUG_DND
-	{
+
+
+	if (gnm_debug_flag ("dnd")) {
 		GList *l;
 		g_printerr ("%d offered formats:\n", g_list_length (targets->list));
 		for (l = targets->list; l; l = l->next) {
@@ -2526,7 +2526,6 @@ gnm_pane_drag_begin (GnmPane *pane, SheetObject *so, GdkEvent *event)
 			g_free (target_name);
 		}
 	}
-#endif
 
 	context = gtk_drag_begin (GTK_WIDGET (canvas), targets,
 				  GDK_ACTION_COPY | GDK_ACTION_MOVE,
diff --git a/src/item-cursor.c b/src/item-cursor.c
index 7879a36..b0673ae 100644
--- a/src/item-cursor.c
+++ b/src/item-cursor.c
@@ -32,15 +32,12 @@
 #include "parse-util.h"
 #include "gui-util.h"
 #include "sheet-autofill.h"
+#include "dead-kittens.h"
 #include <gsf/gsf-impl-utils.h>
 #include <gtk/gtk.h>
 #include <goffice/goffice.h>
 #define GNUMERIC_ITEM "CURSOR"
 
-#ifndef HAVE_GTK_WIDGET_GET_WINDOW
-#define gtk_widget_get_window(w) ((w)->window)
-#endif
-
 #define ITEM_CURSOR_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST ((k), item_cursor_get_type (), ItemCursorClass))
 
 #define AUTO_HANDLE_WIDTH	2
diff --git a/src/widgets/gnumeric-cell-renderer-text.c b/src/widgets/gnumeric-cell-renderer-text.c
index 00692e2..b0075e6 100644
--- a/src/widgets/gnumeric-cell-renderer-text.c
+++ b/src/widgets/gnumeric-cell-renderer-text.c
@@ -17,12 +17,9 @@
  */
 
 #include <gnumeric-config.h>
+#include <dead-kittens.h>
 #include "gnumeric-cell-renderer-text.h"
 
-#ifndef HAVE_GTK_WIDGET_GET_STATE
-#define gtk_widget_get_state(_w) GTK_WIDGET_STATE((_w))
-#endif
-
 static void gnumeric_cell_renderer_text_class_init
     (GnumericCellRendererTextClass *cell_text_class);
 
diff --git a/src/widgets/gnumeric-expr-entry.c b/src/widgets/gnumeric-expr-entry.c
index 42dc444..cb2096a 100644
--- a/src/widgets/gnumeric-expr-entry.c
+++ b/src/widgets/gnumeric-expr-entry.c
@@ -32,6 +32,7 @@
 #include <number-match.h>
 #include <gnm-datetime.h>
 #include <gnumeric-gconf.h>
+#include <dead-kittens.h>
 #include <goffice/goffice.h>
 
 #include <gsf/gsf-impl-utils.h>
@@ -39,10 +40,6 @@
 #include <gdk/gdkkeysyms.h>
 #include <string.h>
 
-#ifndef HAVE_GTK_WIDGET_IS_TOPLEVEL
-#define gtk_widget_is_toplevel(w_) (GTK_WIDGET_FLAGS ((w_)) & GTK_TOPLEVEL)
-#endif
-
 typedef struct {
 	GnmRangeRef ref;
 	int	    text_start;



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