]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkmain.c
Merge branch 'master' into toolpalette
[~andy/gtk] / gtk / gtkmain.c
index ca9e874bc2f0c886966a7e03bf7268152acbd31f..bfee6da93b31b179209c00c1f5ec8aea310de0a7 100644 (file)
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
-#include <config.h>
+#include "config.h"
 
 #include <glib.h>
 #include "gdkconfig.h"
 
 #include <locale.h>
 
-#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
-#include <libintl.h>
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -49,8 +45,6 @@
 #undef STRICT
 #endif
 
-#include <pango/pango-types.h> /* For pango_language_from_string */
-
 #include "gtkintl.h"
 
 #include "gtkaccelmap.h"
 #include "gtkmain.h"
 #include "gtkmodules.h"
 #include "gtkrc.h"
+#include "gtkrecentmanager.h"
 #include "gtkselection.h"
 #include "gtksettings.h"
 #include "gtkwidget.h"
 #include "gtkwindow.h"
 #include "gtktooltip.h"
-#include "gtkprivate.h"
 #include "gtkdebug.h"
 #include "gtkalias.h"
 
 #include "gdk/gdkprivate.h" /* for GDK_WINDOW_DESTROYED */
 
+#ifdef G_OS_WIN32
+
+static HMODULE gtk_dll;
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+        DWORD     fdwReason,
+        LPVOID    lpvReserved)
+{
+  switch (fdwReason)
+    {
+    case DLL_PROCESS_ATTACH:
+      gtk_dll = (HMODULE) hinstDLL;
+      break;
+    }
+
+  return TRUE;
+}
+
+/* These here before inclusion of gtkprivate.h so that the original
+ * GTK_LIBDIR and GTK_LOCALEDIR definitions are seen. Yeah, this is a
+ * bit sucky.
+ */
+const gchar *
+_gtk_get_libdir (void)
+{
+  static char *gtk_libdir = NULL;
+  if (gtk_libdir == NULL)
+    {
+      gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+      gchar *slash = strrchr (root, '\\');
+      if (g_ascii_strcasecmp (slash + 1, ".libs") == 0)
+       gtk_libdir = GTK_LIBDIR;
+      else
+       gtk_libdir = g_build_filename (root, "lib", NULL);
+      g_free (root);
+    }
+
+  return gtk_libdir;
+}
+
+const gchar *
+_gtk_get_localedir (void)
+{
+  static char *gtk_localedir = NULL;
+  if (gtk_localedir == NULL)
+    {
+      const gchar *p;
+      gchar *root, *temp;
+      
+      /* GTK_LOCALEDIR ends in either /lib/locale or
+       * /share/locale. Scan for that slash.
+       */
+      p = GTK_LOCALEDIR + strlen (GTK_LOCALEDIR);
+      while (*--p != '/')
+       ;
+      while (*--p != '/')
+       ;
+
+      root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+      temp = g_build_filename (root, p, NULL);
+      g_free (root);
+
+      /* gtk_localedir is passed to bindtextdomain() which isn't
+       * UTF-8-aware.
+       */
+      gtk_localedir = g_win32_locale_filename_from_utf8 (temp);
+      g_free (temp);
+    }
+  return gtk_localedir;
+}
+
+#endif
+
+#include "gtkprivate.h"
+
 /* Private type definitions
  */
 typedef struct _GtkInitFunction                 GtkInitFunction;
@@ -92,14 +162,14 @@ struct _GtkQuitFunction
   GtkCallbackMarshal marshal;
   GtkFunction function;
   gpointer data;
-  GtkDestroyNotify destroy;
+  GDestroyNotify destroy;
 };
 
 struct _GtkClosure
 {
   GtkCallbackMarshal marshal;
   gpointer data;
-  GtkDestroyNotify destroy;
+  GDestroyNotify destroy;
 };
 
 struct _GtkKeySnooperData
@@ -201,7 +271,7 @@ static const GDebugKey gtk_debug_keys[] = {
  *   The returned string is owned by GTK+ and should not be modified
  *   or freed.
  **/
-gchar*
+const gchar*
 gtk_check_version (guint required_major,
                   guint required_minor,
                   guint required_micro)
@@ -267,48 +337,18 @@ check_setugid (void)
 
 #ifdef G_OS_WIN32
 
-G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
-
 const gchar *
 _gtk_get_datadir (void)
 {
   static char *gtk_datadir = NULL;
   if (gtk_datadir == NULL)
-    gtk_datadir = g_win32_get_package_installation_subdirectory
-      (GETTEXT_PACKAGE, dll_name, "share");
-
-  return gtk_datadir;
-}
-
-const gchar *
-_gtk_get_libdir (void)
-{
-  static char *gtk_libdir = NULL;
-  if (gtk_libdir == NULL)
-    gtk_libdir = g_win32_get_package_installation_subdirectory
-      (GETTEXT_PACKAGE, dll_name, "lib");
-
-  return gtk_libdir;
-}
-
-const gchar *
-_gtk_get_localedir (void)
-{
-  static char *gtk_localedir = NULL;
-  if (gtk_localedir == NULL)
     {
-      gchar *temp;
-      
-      temp = g_win32_get_package_installation_subdirectory
-        (GETTEXT_PACKAGE, dll_name, "lib\\locale");
-
-      /* gtk_localedir is passed to bindtextdomain() which isn't
-       * UTF-8-aware.
-       */
-      gtk_localedir = g_win32_locale_filename_from_utf8 (temp);
-      g_free (temp);
+      gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+      gtk_datadir = g_build_filename (root, "share", NULL);
+      g_free (root);
     }
-  return gtk_localedir;
+
+  return gtk_datadir;
 }
 
 const gchar *
@@ -316,8 +356,11 @@ _gtk_get_sysconfdir (void)
 {
   static char *gtk_sysconfdir = NULL;
   if (gtk_sysconfdir == NULL)
-    gtk_sysconfdir = g_win32_get_package_installation_subdirectory
-      (GETTEXT_PACKAGE, dll_name, "etc");
+    {
+      gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+      gtk_sysconfdir = g_build_filename (root, "etc", NULL);
+      g_free (root);
+    }
 
   return gtk_sysconfdir;
 }
@@ -327,8 +370,7 @@ _gtk_get_data_prefix (void)
 {
   static char *gtk_data_prefix = NULL;
   if (gtk_data_prefix == NULL)
-    gtk_data_prefix = g_win32_get_package_installation_directory
-      (GETTEXT_PACKAGE, dll_name);
+    gtk_data_prefix = g_win32_get_package_installation_directory_of_module (gtk_dll);
 
   return gtk_data_prefix;
 }
@@ -510,22 +552,13 @@ enum_locale_proc (LPTSTR locale)
 #endif
 
 static void
-do_pre_parse_initialization (int    *argc,
-                            char ***argv)
+setlocale_initialization (void)
 {
-  const gchar *env_string;
-  
-#if    0
-  g_set_error_handler (gtk_error);
-  g_set_warning_handler (gtk_warning);
-  g_set_message_handler (gtk_message);
-  g_set_print_handler (gtk_print);
-#endif
+  static gboolean initialized = FALSE;
 
-  if (pre_initialized)
+  if (initialized)
     return;
-
-  pre_initialized = TRUE;
+  initialized = TRUE;
 
   if (do_setlocale)
     {
@@ -590,6 +623,25 @@ do_pre_parse_initialization (int    *argc,
        g_warning ("Locale not supported by C library.\n\tUsing the fallback 'C' locale.");
 #endif
     }
+}
+
+static void
+do_pre_parse_initialization (int    *argc,
+                            char ***argv)
+{
+  const gchar *env_string;
+  
+#if    0
+  g_set_error_handler (gtk_error);
+  g_set_warning_handler (gtk_warning);
+  g_set_message_handler (gtk_message);
+  g_set_print_handler (gtk_print);
+#endif
+
+  if (pre_initialized)
+    return;
+
+  pre_initialized = TRUE;
 
   gdk_pre_parse_libgtk_only ();
   gdk_event_handler_set ((GdkEventFunc)gtk_main_do_event, NULL, NULL);
@@ -613,6 +665,8 @@ do_pre_parse_initialization (int    *argc,
 static void
 gettext_initialization (void)
 {
+  setlocale_initialization ();
+
 #ifdef ENABLE_NLS
   bindtextdomain (GETTEXT_PACKAGE, GTK_LOCALEDIR);
   bindtextdomain (GETTEXT_PACKAGE "-properties", GTK_LOCALEDIR);
@@ -632,6 +686,10 @@ do_post_parse_initialization (int    *argc,
 
   gettext_initialization ();
 
+#ifdef SIGPIPE
+  signal (SIGPIPE, SIG_IGN);
+#endif
+
   if (g_fatal_warnings)
     {
       GLogLevelFlags fatal_mask;
@@ -651,15 +709,17 @@ do_post_parse_initialization (int    *argc,
    * it isn't default:LTR or default:RTL it will not work 
    */
     char *e = _("default:LTR");
-    if (strcmp (e, "default:RTL")==0) {
+    if (strcmp (e, "default:RTL")==0) 
       gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
-    } else if (strcmp (e, "default:LTR")) {
+    else if (strcmp (e, "default:LTR"))
       g_warning ("Whoever translated default:LTR did so wrongly.\n");
-    }
   }
 
-  gtk_type_init (0);
- _gtk_accel_map_init ();  
+  /* do what the call to gtk_type_init() used to do */
+  g_type_init ();
+  gtk_object_get_type ();
+
+  _gtk_accel_map_init ();
   _gtk_rc_init ();
 
   /* Set the 'initialized' flag.
@@ -672,6 +732,10 @@ do_post_parse_initialization (int    *argc,
       _gtk_modules_init (argc, argv, gtk_modules_string->str);
       g_string_free (gtk_modules_string, TRUE);
     }
+  else
+    {
+      _gtk_modules_init (argc, argv, NULL);
+    }
 }
 
 
@@ -710,7 +774,7 @@ post_parse_hook (GOptionContext *context,
          g_set_error (error, 
                       G_OPTION_ERROR, 
                       G_OPTION_ERROR_FAILED,
-                      "cannot open display: %s",
+                      _("Cannot open display: %s"),
                       display_name ? display_name : "" );
          
          return FALSE;
@@ -731,7 +795,7 @@ post_parse_hook (GOptionContext *context,
  * with g_option_context_add_group(), if you are using 
  * g_option_context_parse() to parse your commandline arguments.
  *
- * Returns a #GOptionGroup for the commandline arguments recognized
+ * Returns: a #GOptionGroup for the commandline arguments recognized
  *   by GTK+
  *
  * Since: 2.6
@@ -785,9 +849,9 @@ gtk_get_option_group (gboolean open_default_display)
 gboolean
 gtk_init_with_args (int            *argc,
                    char         ***argv,
-                   char           *parameter_string,  
+                   const char     *parameter_string,
                    GOptionEntry   *entries,
-                   char           *translation_domain,
+                   const char     *translation_domain,
                    GError        **error)
 {
   GOptionContext *context;
@@ -795,7 +859,7 @@ gtk_init_with_args (int            *argc,
   gboolean retval;
 
   if (gtk_initialized)
-    return TRUE;
+    return gdk_display_open_default_libgtk_only () != NULL;
 
   gettext_initialization ();
 
@@ -925,6 +989,15 @@ gtk_init_check (int         *argc,
  * the GUI for some reason. If you want your program to fall back to a 
  * textual interface you want to call gtk_init_check() instead.
  * </para></note>
+ *
+ * <note><para>
+ * Since 2.18, GTK+ calls <literal>signal (SIGPIPE, SIG_IGN)</literal>
+ * during initialization, to ignore SIGPIPE signals, since these are
+ * almost never wanted in graphical applications. If you do need to
+ * handle SIGPIPE for some reason, reset the handler after gtk_init(),
+ * but notice that other libraries (e.g. libdbus or gvfs) might do
+ * similar things.
+ * </para></note>
  **/
 void
 gtk_init (int *argc, char ***argv)
@@ -932,7 +1005,9 @@ gtk_init (int *argc, char ***argv)
   if (!gtk_init_check (argc, argv))
     {
       const char *display_name_arg = gdk_get_display_arg_name ();
-      g_warning ("cannot open display: %s", display_name_arg ? display_name_arg : " ");
+      if (display_name_arg == NULL)
+        display_name_arg = getenv("DISPLAY");
+      g_warning ("cannot open display: %s", display_name_arg ? display_name_arg : "");
       exit (1);
     }
 }
@@ -1188,9 +1263,14 @@ gtk_main (void)
 
   gtk_main_loop_level--;
 
-  /* Try storing all clipboard data we have */
   if (gtk_main_loop_level == 0)
-    _gtk_clipboard_store_all ();
+    {
+      /* Try storing all clipboard data we have */
+      _gtk_clipboard_store_all ();
+
+      /* Synchronize the recent manager singleton */
+      _gtk_recent_manager_sync ();
+    }
 }
 
 guint
@@ -1324,6 +1404,7 @@ rewrite_event_for_grabs (GdkEvent *event)
 {
   GdkWindow *grab_window;
   GtkWidget *event_widget, *grab_widget;
+  gpointer grab_widget_ptr;
   gboolean owner_events;
   GdkDisplay *display;
 
@@ -1356,7 +1437,8 @@ rewrite_event_for_grabs (GdkEvent *event)
     }
 
   event_widget = gtk_get_event_widget (event);
-  gdk_window_get_user_data (grab_window, (void**) &grab_widget);
+  gdk_window_get_user_data (grab_window, &grab_widget_ptr);
+  grab_widget = grab_widget_ptr;
 
   if (grab_widget &&
       gtk_main_get_window_group (grab_widget) != gtk_main_get_window_group (event_widget))
@@ -1371,42 +1453,9 @@ gtk_main_do_event (GdkEvent *event)
   GtkWidget *event_widget;
   GtkWidget *grab_widget;
   GtkWindowGroup *window_group;
-  GdkEvent *next_event;
   GdkEvent *rewritten_event = NULL;
   GList *tmp_list;
 
-  /* If there are any events pending then get the next one.
-   */
-  next_event = gdk_event_peek ();
-  
-  /* Try to compress enter/leave notify events. These event
-   *  pairs occur when the mouse is dragged quickly across
-   *  a window with many buttons (or through a menu). Instead
-   *  of highlighting and de-highlighting each widget that
-   *  is crossed it is better to simply de-highlight the widget
-   *  which contained the mouse initially and highlight the
-   *  widget which ends up containing the mouse.
-   */
-  if (next_event)
-    if (((event->type == GDK_ENTER_NOTIFY) ||
-        (event->type == GDK_LEAVE_NOTIFY)) &&
-       ((next_event->type == GDK_ENTER_NOTIFY) ||
-        (next_event->type == GDK_LEAVE_NOTIFY)) &&
-       (next_event->type != event->type) &&
-       (next_event->any.window == event->any.window))
-      {
-       /* Throw both the peeked copy and the queued copy away 
-        */
-       gdk_event_free (next_event);
-       next_event = gdk_event_get ();
-       gdk_event_free (next_event);
-       
-       return;
-      }
-
-  if (next_event)
-    gdk_event_free (next_event);
-
   if (event->type == GDK_SETTING)
     {
       _gtk_settings_handle_event (&event->setting);
@@ -1523,7 +1572,15 @@ gtk_main_do_event (GdkEvent *event)
          gdk_window_end_paint (event->any.window);
        }
       else
-       gtk_widget_send_expose (event_widget, event);
+       {
+         /* The app may paint with a previously allocated cairo_t,
+            which will draw directly to the window. We can't catch cairo
+            drap operatoins to automatically flush the window, thus we
+            need to explicitly flush any outstanding moves or double
+            buffering */
+         gdk_window_flush (event->any.window);
+         gtk_widget_send_expose (event_widget, event);
+       }
       break;
 
     case GDK_PROPERTY_NOTIFY:
@@ -1539,6 +1596,7 @@ gtk_main_do_event (GdkEvent *event)
     case GDK_VISIBILITY_NOTIFY:
     case GDK_WINDOW_STATE:
     case GDK_GRAB_BROKEN:
+    case GDK_DAMAGE:
       gtk_widget_event (event_widget, event);
       break;
 
@@ -1565,25 +1623,15 @@ gtk_main_do_event (GdkEvent *event)
       break;
       
     case GDK_ENTER_NOTIFY:
+      GTK_PRIVATE_SET_FLAG (event_widget, GTK_HAS_POINTER);
+      _gtk_widget_set_pointer_window (event_widget, event->any.window);
       if (GTK_WIDGET_IS_SENSITIVE (grab_widget))
-       {
-         g_object_ref (event_widget);
-         
-         gtk_widget_event (grab_widget, event);
-         if (event_widget == grab_widget)
-           GTK_PRIVATE_SET_FLAG (event_widget, GTK_LEAVE_PENDING);
-         
-         g_object_unref (event_widget);
-       }
+       gtk_widget_event (grab_widget, event);
       break;
       
     case GDK_LEAVE_NOTIFY:
-      if (GTK_WIDGET_LEAVE_PENDING (event_widget))
-       {
-         GTK_PRIVATE_UNSET_FLAG (event_widget, GTK_LEAVE_PENDING);
-         gtk_widget_event (event_widget, event);
-       }
-      else if (GTK_WIDGET_IS_SENSITIVE (grab_widget))
+      GTK_PRIVATE_UNSET_FLAG (event_widget, GTK_HAS_POINTER);
+      if (GTK_WIDGET_IS_SENSITIVE (grab_widget))
        gtk_widget_event (grab_widget, event);
       break;
       
@@ -1644,7 +1692,7 @@ gtk_main_get_window_group (GtkWidget   *widget)
   if (widget)
     toplevel = gtk_widget_get_toplevel (widget);
 
-  if (toplevel && GTK_IS_WINDOW (toplevel))
+  if (GTK_IS_WINDOW (toplevel))
     return gtk_window_get_group (GTK_WINDOW (toplevel));
   else
     return gtk_window_get_group (NULL);
@@ -1656,6 +1704,7 @@ typedef struct
   GtkWidget *new_grab_widget;
   gboolean   was_grabbed;
   gboolean   is_grabbed;
+  gboolean   from_grab;
 } GrabNotifyInfo;
 
 static void
@@ -1677,13 +1726,31 @@ gtk_grab_notify_foreach (GtkWidget *child,
   is_shadowed = info->new_grab_widget && !info->is_grabbed;
 
   g_object_ref (child);
+
+  if ((was_shadowed || is_shadowed) && GTK_IS_CONTAINER (child))
+    gtk_container_forall (GTK_CONTAINER (child), gtk_grab_notify_foreach, info);
   
+  if (is_shadowed)
+    {
+      GTK_PRIVATE_SET_FLAG (child, GTK_SHADOWED);
+      if (!was_shadowed && GTK_WIDGET_HAS_POINTER (child)
+         && GTK_WIDGET_IS_SENSITIVE (child))
+       _gtk_widget_synthesize_crossing (child, info->new_grab_widget,
+                                        GDK_CROSSING_GTK_GRAB);
+    }
+  else
+    {
+      GTK_PRIVATE_UNSET_FLAG (child, GTK_SHADOWED);
+      if (was_shadowed && GTK_WIDGET_HAS_POINTER (child)
+         && GTK_WIDGET_IS_SENSITIVE (child))
+       _gtk_widget_synthesize_crossing (info->old_grab_widget, child,
+                                        info->from_grab ? GDK_CROSSING_GTK_GRAB
+                                        : GDK_CROSSING_GTK_UNGRAB);
+    }
+
   if (was_shadowed != is_shadowed)
     _gtk_widget_grab_notify (child, was_shadowed);
   
-  if ((was_shadowed || is_shadowed) && GTK_IS_CONTAINER (child))
-    gtk_container_forall (GTK_CONTAINER (child), gtk_grab_notify_foreach, info);
-      
   g_object_unref (child);
   
   info->was_grabbed = was_grabbed;
@@ -1693,7 +1760,8 @@ gtk_grab_notify_foreach (GtkWidget *child,
 static void
 gtk_grab_notify (GtkWindowGroup *group,
                 GtkWidget      *old_grab_widget,
-                GtkWidget      *new_grab_widget)
+                GtkWidget      *new_grab_widget,
+                gboolean        from_grab)
 {
   GList *toplevels;
   GrabNotifyInfo info;
@@ -1703,6 +1771,7 @@ gtk_grab_notify (GtkWindowGroup *group,
 
   info.old_grab_widget = old_grab_widget;
   info.new_grab_widget = new_grab_widget;
+  info.from_grab = from_grab;
 
   g_object_ref (group);
 
@@ -1747,7 +1816,7 @@ gtk_grab_add (GtkWidget *widget)
       g_object_ref (widget);
       group->grabs = g_slist_prepend (group->grabs, widget);
 
-      gtk_grab_notify (group, old_grab_widget, widget);
+      gtk_grab_notify (group, old_grab_widget, widget, TRUE);
     }
 }
 
@@ -1783,7 +1852,7 @@ gtk_grab_remove (GtkWidget *widget)
       else
        new_grab_widget = NULL;
 
-      gtk_grab_notify (group, widget, new_grab_widget);
+      gtk_grab_notify (group, widget, new_grab_widget, FALSE);
       
       g_object_unref (widget);
     }
@@ -1868,7 +1937,7 @@ gtk_quit_add_full (guint          main_level,
                   GtkFunction          function,
                   GtkCallbackMarshal   marshal,
                   gpointer             data,
-                  GtkDestroyNotify     destroy)
+                  GDestroyNotify       destroy)
 {
   static guint quit_id = 1;
   GtkQuitFunction *quitf;
@@ -1986,7 +2055,7 @@ gtk_timeout_add_full (guint32              interval,
                      GtkFunction        function,
                      GtkCallbackMarshal marshal,
                      gpointer           data,
-                     GtkDestroyNotify   destroy)
+                     GDestroyNotify     destroy)
 {
   if (marshal)
     {
@@ -2025,7 +2094,7 @@ gtk_idle_add_full (gint                   priority,
                   GtkFunction          function,
                   GtkCallbackMarshal   marshal,
                   gpointer             data,
-                  GtkDestroyNotify     destroy)
+                  GDestroyNotify       destroy)
 {
   if (marshal)
     {
@@ -2079,7 +2148,7 @@ gtk_input_add_full (gint          source,
                    GdkInputFunction    function,
                    GtkCallbackMarshal  marshal,
                    gpointer            data,
-                   GtkDestroyNotify    destroy)
+                   GDestroyNotify      destroy)
 {
   if (marshal)
     {
@@ -2094,7 +2163,7 @@ gtk_input_add_full (gint          source,
                                 condition,
                                 (GdkInputFunction) gtk_invoke_input,
                                 closure,
-                                (GdkDestroyNotify) gtk_destroy_closure);
+                                (GDestroyNotify) gtk_destroy_closure);
     }
   else
     return gdk_input_add_full (source, condition, function, data, destroy);
@@ -2225,11 +2294,15 @@ GtkWidget*
 gtk_get_event_widget (GdkEvent *event)
 {
   GtkWidget *widget;
+  gpointer widget_ptr;
 
   widget = NULL;
   if (event && event->any.window && 
       (event->type == GDK_DESTROY || !GDK_WINDOW_DESTROYED (event->any.window)))
-    gdk_window_get_user_data (event->any.window, (void**) &widget);
+    {
+      gdk_window_get_user_data (event->any.window, &widget_ptr);
+      widget = widget_ptr;
+    }
   
   return widget;
 }
@@ -2301,7 +2374,7 @@ gtk_propagate_event (GtkWidget *widget,
       GtkWidget *window;
 
       window = gtk_widget_get_toplevel (widget);
-      if (window && GTK_IS_WINDOW (window))
+      if (GTK_IS_WINDOW (window))
        {
          /* If there is a grab within the window, give the grab widget
           * a first crack at the key event
@@ -2312,7 +2385,7 @@ gtk_propagate_event (GtkWidget *widget,
          if (!handled_event)
            {
              window = gtk_widget_get_toplevel (widget);
-             if (window && GTK_IS_WINDOW (window))
+             if (GTK_IS_WINDOW (window))
                {
                  if (GTK_WIDGET_IS_SENSITIVE (window))
                    gtk_widget_event (window, event);
@@ -2403,7 +2476,7 @@ gtk_print (gchar *str)
       window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
       
       gtk_signal_connect (GTK_OBJECT (window), "destroy",
-                         (GtkSignalFunc) gtk_widget_destroyed,
+                         G_CALLBACK (gtk_widget_destroyed),
                          &window);
       
       gtk_window_set_title (GTK_WINDOW (window), "Messages");
@@ -2454,7 +2527,7 @@ gtk_print (gchar *str)
       
       button = gtk_button_new_with_label ("close");
       gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
-                                (GtkSignalFunc) gtk_widget_hide,
+                                G_CALLBACK (gtk_widget_hide),
                                 GTK_OBJECT (window));
       gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
       GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);