X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkselection.c;h=b76090be200499f7ef0b1e96d4157ee2b7d7d56a;hb=a8698a24c7a53fe4d34211053529f14747f7ce5f;hp=5715b50f4036c8efd930b81dbb18d11028ead88b;hpb=f8794ccccadc91bd37a4fe19577fc789cf0d0107;p=~andy%2Fgtk diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c index 5715b50f4..b76090be2 100644 --- a/gtk/gtkselection.c +++ b/gtk/gtkselection.c @@ -152,8 +152,8 @@ struct _GtkRetrievalInfo /* Local Functions */ static void gtk_selection_init (void); -static gint gtk_selection_incr_timeout (GtkIncrInfo *info); -static gint gtk_selection_retrieval_timeout (GtkRetrievalInfo *info); +static gboolean gtk_selection_incr_timeout (GtkIncrInfo *info); +static gboolean gtk_selection_retrieval_timeout (GtkRetrievalInfo *info); static void gtk_selection_retrieval_report (GtkRetrievalInfo *info, GdkAtom type, gint format, @@ -1090,7 +1090,8 @@ gtk_selection_convert (GtkWidget *widget, current_retrievals = g_list_append (current_retrievals, info); gdk_selection_convert (widget->window, selection, target, time_); - g_timeout_add (1000, (GSourceFunc) gtk_selection_retrieval_timeout, info); + gdk_threads_add_timeout (1000, + (GSourceFunc) gtk_selection_retrieval_timeout, info); return TRUE; } @@ -1115,8 +1116,7 @@ gtk_selection_data_set (GtkSelectionData *selection_data, const guchar *data, gint length) { - if (selection_data->data) - g_free (selection_data->data); + g_free (selection_data->data); selection_data->type = type; selection_data->format = format; @@ -1310,7 +1310,7 @@ selection_get_text_plain (GtkSelectionData *selection_data) { gchar *tmp = str; str = g_convert_with_fallback (tmp, len, - charset, "UTF-8", + "UTF-8", charset, NULL, NULL, &len, &error); g_free (tmp); @@ -1620,7 +1620,6 @@ gtk_selection_data_get_uris (GtkSelectionData *selection_data) selection_data->type == text_uri_list_atom) { gchar **list; - gint i; gint count = gdk_text_property_to_utf8_list_for_display (selection_data->display, utf8_atom, selection_data->format, @@ -2132,6 +2131,7 @@ _gtk_selection_request (GtkWidget *widget, event->time); g_free (mult_atoms); g_free (info); + gdk_error_trap_pop (); return TRUE; } gdk_error_trap_pop (); @@ -2168,6 +2168,8 @@ _gtk_selection_request (GtkWidget *widget, info->conversions[i].target = ((GdkAtom *)mult_atoms)[2*i]; info->conversions[i].property = ((GdkAtom *)mult_atoms)[2*i+1]; } + + g_free (mult_atoms); } } else /* only a single conversion */ @@ -2261,7 +2263,7 @@ _gtk_selection_request (GtkWidget *widget, gdk_window_get_events (info->requestor) | GDK_PROPERTY_CHANGE_MASK); current_incrs = g_list_append (current_incrs, info); - g_timeout_add (1000, (GSourceFunc) gtk_selection_incr_timeout, info); + gdk_threads_add_timeout (1000, (GSourceFunc) gtk_selection_incr_timeout, info); } /* If it was a MULTIPLE request, set the property to indicate which @@ -2450,8 +2452,6 @@ gtk_selection_incr_timeout (GtkIncrInfo *info) GList *tmp_list; gboolean retval; - GDK_THREADS_ENTER (); - /* Determine if retrieval has finished by checking if it still in list of pending retrievals */ @@ -2487,8 +2487,6 @@ gtk_selection_incr_timeout (GtkIncrInfo *info) retval = TRUE; /* timeout will happen again */ } - GDK_THREADS_LEAVE (); - return retval; } @@ -2694,14 +2692,12 @@ _gtk_selection_property_notify (GtkWidget *widget, * results: *************************************************************/ -static gint +static gboolean gtk_selection_retrieval_timeout (GtkRetrievalInfo *info) { GList *tmp_list; gboolean retval; - GDK_THREADS_ENTER (); - /* Determine if retrieval has finished by checking if it still in list of pending retrievals */ @@ -2735,8 +2731,6 @@ gtk_selection_retrieval_timeout (GtkRetrievalInfo *info) retval = TRUE; /* timeout will happen again */ } - GDK_THREADS_LEAVE (); - return retval; } @@ -2938,8 +2932,7 @@ gtk_selection_data_free (GtkSelectionData *data) { g_return_if_fail (data != NULL); - if (data->data) - g_free (data->data); + g_free (data->data); g_free (data); }