[libegg/spread-table-dnd: 32/45] Add casts to silence compiler warnings



commit a22ef4360b4314bd4587cf82c6e215182a1ee48f
Author: David King <davidk openismus com>
Date:   Wed Mar 23 10:53:49 2011 +0100

    Add casts to silence compiler warnings

 libegg/column-chooser/test-tree-column.c |    2 +-
 libegg/dock/egg-dock-item.c              |    6 ++++--
 libegg/dock/egg-dock-layout.c            |    4 +++-
 libegg/dock/egg-dock-master.c            |   13 ++++++++-----
 libegg/dock/egg-dock-object.c            |   16 ++++++++++------
 libegg/dock/egg-dock-object.h            |    2 +-
 libegg/dock/egg-dock-placeholder.c       |    6 +++---
 libegg/dock/egg-dock.c                   |    4 +++-
 libegg/treeviewutils/test-multi-drag.c   |    2 +-
 9 files changed, 34 insertions(+), 21 deletions(-)
---
diff --git a/libegg/column-chooser/test-tree-column.c b/libegg/column-chooser/test-tree-column.c
index b1f26ec..eab3846 100644
--- a/libegg/column-chooser/test-tree-column.c
+++ b/libegg/column-chooser/test-tree-column.c
@@ -87,7 +87,7 @@ main (int argc, char *argv[])
 
   gtk_container_add (GTK_CONTAINER (scrolled_window), tree_view);
   gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
-  gtk_widget_show_all (egg_column_chooser_dialog_new (tree_view));
+  gtk_widget_show_all (egg_column_chooser_dialog_new (GTK_TREE_VIEW(tree_view)));
 
   gtk_widget_show_all (window);
   gtk_main ();
diff --git a/libegg/dock/egg-dock-item.c b/libegg/dock/egg-dock-item.c
index 7c6481e..a964424 100644
--- a/libegg/dock/egg-dock-item.c
+++ b/libegg/dock/egg-dock-item.c
@@ -49,6 +49,8 @@
 #include "libeggdocktypebuiltins.h"
 #include <util/eggmarshalers.h>
 
+/* Borrowed from gedit. */
+#define GBOOLEAN_TO_POINTER(i) (GINT_TO_POINTER ((i) ? 2 : 1))
 
 /* ----- Private prototypes ----- */
 
@@ -1427,7 +1429,7 @@ egg_dock_item_real_set_orientation (EggDockItem    *item,
     item->orientation = orientation;
 
 #if GTK_CHECK_VERSION(2,18,0)
-    if (gtk_widget_is_drawable (item))
+    if (gtk_widget_is_drawable (GTK_WIDGET (item)))
 #else
     if (GTK_WIDGET_DRAWABLE (item))
 #endif
@@ -1628,7 +1630,7 @@ egg_dock_item_hide_item (EggDockItem *item)
                                NULL);
 
     /* detach the item recursively */
-    egg_dock_object_detach (EGG_DOCK_OBJECT (item), TRUE);
+    egg_dock_object_detach (EGG_DOCK_OBJECT (item), GBOOLEAN_TO_POINTER (TRUE));
 
     egg_dock_object_thaw (EGG_DOCK_OBJECT (item));
 }
diff --git a/libegg/dock/egg-dock-layout.c b/libegg/dock/egg-dock-layout.c
index e003822..4d42ad4 100644
--- a/libegg/dock/egg-dock-layout.c
+++ b/libegg/dock/egg-dock-layout.c
@@ -36,6 +36,8 @@
 #include "egg-dock-layout.h"
 #include "egg-dock-placeholder.h"
 
+/* Borrowed from gedit. */
+#define GBOOLEAN_TO_POINTER(i) (GINT_TO_POINTER ((i) ? 2 : 1))
 
 /* ----- Private variables ----- */
 
@@ -983,7 +985,7 @@ egg_dock_layout_recursive_build (EggDockMaster *master,
 static void
 _egg_dock_layout_foreach_detach (EggDockObject *object)
 {
-    egg_dock_object_detach (object, TRUE);
+    egg_dock_object_detach (object, GBOOLEAN_TO_POINTER (TRUE));
 }
 
 static void
diff --git a/libegg/dock/egg-dock-master.c b/libegg/dock/egg-dock-master.c
index ea0578e..417b8f6 100644
--- a/libegg/dock/egg-dock-master.c
+++ b/libegg/dock/egg-dock-master.c
@@ -37,6 +37,9 @@
 #include "egg-dock-item.h"
 #include <util/eggmarshalers.h>
 
+/* Borrowed from gedit. */
+#define GBOOLEAN_TO_POINTER(i) (GINT_TO_POINTER ((i) ? 2 : 1))
+#define GPOINTER_TO_BOOLEAN(i) ((gboolean) ((GPOINTER_TO_INT(i) == 2) ? TRUE : FALSE))
 
 /* ----- Private prototypes ----- */
 
@@ -299,16 +302,16 @@ egg_dock_master_dispose (GObject *g_object)
 
 static void 
 foreach_lock_unlock (EggDockItem *item,
-                     gboolean     locked)
+                     gpointer     locked)
 {
     if (!EGG_IS_DOCK_ITEM (item))
         return;
     
-    g_object_set (item, "locked", locked, NULL);
+    g_object_set (item, "locked", GPOINTER_TO_BOOLEAN (locked), NULL);
     if (egg_dock_object_is_compound (EGG_DOCK_OBJECT (item)))
         gtk_container_foreach (GTK_CONTAINER (item),
                                (GtkCallback) foreach_lock_unlock,
-                               (gpointer) locked);
+                               locked);
 }
 
 static void
@@ -320,13 +323,13 @@ egg_dock_master_lock_unlock (EggDockMaster *master,
     for (l = master->toplevel_docks; l; l = l->next) {
         EggDock *dock = EGG_DOCK (l->data);
         if (dock->root)
-            foreach_lock_unlock (EGG_DOCK_ITEM (dock->root), locked);
+            foreach_lock_unlock (EGG_DOCK_ITEM (dock->root), GBOOLEAN_TO_POINTER (locked));
     }
 
     /* just to be sure hidden items are set too */
     egg_dock_master_foreach (master,
                              (GFunc) foreach_lock_unlock,
-                             (gpointer) locked);
+                             GBOOLEAN_TO_POINTER (locked));
 }
 
 static void
diff --git a/libegg/dock/egg-dock-object.c b/libegg/dock/egg-dock-object.c
index ad35a91..295fb11 100644
--- a/libegg/dock/egg-dock-object.c
+++ b/libegg/dock/egg-dock-object.c
@@ -41,7 +41,11 @@
 #include "egg-dock-notebook.h"
 #include "egg-dock-placeholder.h"
 
-typedef struct _EggDockObjectPrivate {
+/* Borrowed from gedit. */
+#define GBOOLEAN_TO_POINTER(i) (GINT_TO_POINTER ((i) ? 2 : 1))
+#define GPOINTER_TO_BOOLEAN(i) ((gboolean) ((GPOINTER_TO_INT(i) == 2) ? TRUE : FALSE))
+
+struct _EggDockObjectPrivate {
 	gpointer unused;
 };
 
@@ -261,7 +265,7 @@ static void
 egg_dock_object_foreach_detach (EggDockObject *object,
                                 gpointer       user_data)
 {
-    egg_dock_object_detach (object, TRUE);
+    egg_dock_object_detach (object, GPOINTER_TO_BOOLEAN(TRUE));
 }
 
 static void
@@ -339,7 +343,7 @@ egg_dock_object_real_detach (EggDockObject *object,
     if (recursive && egg_dock_object_is_compound (object)) {
         gtk_container_foreach (GTK_CONTAINER (object),
                                (GtkCallback) egg_dock_object_detach,
-                               (gpointer) recursive);
+                               GBOOLEAN_TO_POINTER(recursive));
     }
     
     /* detach the object itself */
@@ -432,7 +436,7 @@ egg_dock_object_is_compound (EggDockObject *object)
 
 void
 egg_dock_object_detach (EggDockObject *object,
-                        gboolean       recursive)
+                        gpointer       recursive)
 {
     g_return_if_fail (object != NULL);
 
@@ -442,7 +446,7 @@ egg_dock_object_detach (EggDockObject *object,
     /* freeze the object to avoid reducing while detaching children */
     egg_dock_object_freeze (object);
     EGG_DOCK_OBJECT_SET_FLAGS (object, EGG_DOCK_IN_DETACH);
-    g_signal_emit (object, egg_dock_object_signals [DETACH], 0, recursive);
+    g_signal_emit (object, egg_dock_object_signals [DETACH], 0, GPOINTER_TO_BOOLEAN(recursive));
     EGG_DOCK_OBJECT_UNSET_FLAGS (object, EGG_DOCK_IN_DETACH);
     egg_dock_object_thaw (object);
 }
@@ -602,7 +606,7 @@ egg_dock_object_unbind (EggDockObject *object)
 
     /* detach the object first */
     if (EGG_DOCK_OBJECT_ATTACHED (object))
-        egg_dock_object_detach (object, TRUE);
+        egg_dock_object_detach (object, GBOOLEAN_TO_POINTER(TRUE));
     
     if (object->master) {
         GObject *master = object->master;
diff --git a/libegg/dock/egg-dock-object.h b/libegg/dock/egg-dock-object.h
index d021eb8..1ac401c 100644
--- a/libegg/dock/egg-dock-object.h
+++ b/libegg/dock/egg-dock-object.h
@@ -152,7 +152,7 @@ GType          egg_dock_object_get_type          (void);
 gboolean       egg_dock_object_is_compound       (EggDockObject    *object);
 
 void           egg_dock_object_detach            (EggDockObject    *object,
-                                                  gboolean          recursive);
+                                                  gpointer          recursive);
 
 EggDockObject *egg_dock_object_get_parent_object (EggDockObject    *object);
 
diff --git a/libegg/dock/egg-dock-placeholder.c b/libegg/dock/egg-dock-placeholder.c
index 36d0d1b..93c50a1 100644
--- a/libegg/dock/egg-dock-placeholder.c
+++ b/libegg/dock/egg-dock-placeholder.c
@@ -159,8 +159,8 @@ egg_dock_placeholder_class_init (EggDockPlaceholderClass *klass)
 static void
 egg_dock_placeholder_instance_init (EggDockPlaceholder *ph)
 {
-    gtk_widget_set_has_window (ph, FALSE);
-    gtk_widget_set_can_focus (ph, FALSE);
+    gtk_widget_set_has_window (GTK_WIDGET (ph), FALSE);
+    gtk_widget_set_can_focus (GTK_WIDGET (ph), FALSE);
 
     ph->_priv = g_new0 (EggDockPlaceholderPrivate, 1);
 }
@@ -185,7 +185,7 @@ egg_dock_placeholder_set_property (GObject      *g_object,
             if (ph->_priv) {
                 ph->_priv->placement_stack =
                     g_slist_prepend (ph->_priv->placement_stack,
-                                     (gpointer) g_value_get_enum (value));
+                                     GINT_TO_POINTER (g_value_get_enum (value)));
             }
             break;
 	default:
diff --git a/libegg/dock/egg-dock.c b/libegg/dock/egg-dock.c
index 83046a5..fb92591 100644
--- a/libegg/dock/egg-dock.c
+++ b/libegg/dock/egg-dock.c
@@ -35,6 +35,8 @@
 
 #include <util/eggmarshalers.h>
 
+/* Borrowed from gedit. */
+#define GBOOLEAN_TO_POINTER(i) (GINT_TO_POINTER ((i) ? 2 : 1))
 
 /* ----- Private prototypes ----- */
 
@@ -779,7 +781,7 @@ egg_dock_detach (EggDockObject *object,
 
     /* detach children */
     if (recursive && dock->root) {
-        egg_dock_object_detach (dock->root, recursive);
+        egg_dock_object_detach (dock->root, GBOOLEAN_TO_POINTER (recursive));
     }
     EGG_DOCK_OBJECT_UNSET_FLAGS (object, EGG_DOCK_ATTACHED);
 }
diff --git a/libegg/treeviewutils/test-multi-drag.c b/libegg/treeviewutils/test-multi-drag.c
index 94a66c5..597fdb3 100644
--- a/libegg/treeviewutils/test-multi-drag.c
+++ b/libegg/treeviewutils/test-multi-drag.c
@@ -13,7 +13,7 @@ main (int argc, char *argv[])
   gtk_init (&argc, &argv);
 
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  model = gtk_list_store_new (1, G_TYPE_STRING);
+  model = GTK_TREE_MODEL (gtk_list_store_new (1, G_TYPE_STRING));
 
   for (i = 0; i < 20; i++)
     {



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