mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
Use GSlice for GtkSelectionData. (#515060, Christian Persch)
2008-02-12 Matthias Clasen <mclasen@redhat.com> * gtk/gtkclipboard-quartz.c: * gtkquartz.c: * gtkselection.c: Use GSlice for GtkSelectionData. (#515060, Christian Persch) svn path=/trunk/; revision=19533
This commit is contained in:
parent
49f20887af
commit
945db7f6a6
@ -1,3 +1,10 @@
|
||||
2008-02-12 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkclipboard-quartz.c:
|
||||
* gtkquartz.c:
|
||||
* gtkselection.c: Use GSlice for GtkSelectionData. (#515060,
|
||||
Christian Persch)
|
||||
|
||||
2008-02-12 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
* gtk/gtktreeview.c (gtk_tree_view_real_select_cursor_row),
|
||||
|
@ -858,7 +858,7 @@ gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,
|
||||
count = [types count];
|
||||
atom_list = _gtk_quartz_pasteboard_types_to_atom_list (types);
|
||||
|
||||
selection_data = g_new (GtkSelectionData, 1);
|
||||
selection_data = g_slice_new (GtkSelectionData);
|
||||
selection_data->selection = clipboard->selection;
|
||||
selection_data->target = target;
|
||||
selection_data->type = GDK_SELECTION_TYPE_ATOM;
|
||||
|
@ -156,7 +156,7 @@ _gtk_quartz_get_selection_data_from_pasteboard (NSPasteboard *pasteboard,
|
||||
{
|
||||
GtkSelectionData *selection_data = NULL;
|
||||
|
||||
selection_data = g_new0 (GtkSelectionData, 1);
|
||||
selection_data = g_slice_new0 (GtkSelectionData);
|
||||
selection_data->selection = selection;
|
||||
selection_data->target = target;
|
||||
|
||||
|
@ -198,7 +198,7 @@ GtkTargetList *
|
||||
gtk_target_list_new (const GtkTargetEntry *targets,
|
||||
guint ntargets)
|
||||
{
|
||||
GtkTargetList *result = g_new (GtkTargetList, 1);
|
||||
GtkTargetList *result = g_slice_new (GtkTargetList);
|
||||
result->list = NULL;
|
||||
result->ref_count = 1;
|
||||
|
||||
@ -246,13 +246,13 @@ gtk_target_list_unref (GtkTargetList *list)
|
||||
while (tmp_list)
|
||||
{
|
||||
GtkTargetPair *pair = tmp_list->data;
|
||||
g_free (pair);
|
||||
g_slice_free (GtkTargetPair, pair);
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
g_list_free (list->list);
|
||||
g_free (list);
|
||||
g_slice_free (GtkTargetList, list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ gtk_target_list_add (GtkTargetList *list,
|
||||
|
||||
g_return_if_fail (list != NULL);
|
||||
|
||||
pair = g_new (GtkTargetPair, 1);
|
||||
pair = g_slice_new (GtkTargetPair);
|
||||
pair->target = target;
|
||||
pair->flags = flags;
|
||||
pair->info = info;
|
||||
@ -483,7 +483,7 @@ gtk_target_list_add_table (GtkTargetList *list,
|
||||
|
||||
for (i=ntargets-1; i >= 0; i--)
|
||||
{
|
||||
GtkTargetPair *pair = g_new (GtkTargetPair, 1);
|
||||
GtkTargetPair *pair = g_slice_new (GtkTargetPair);
|
||||
pair->target = gdk_atom_intern (targets[i].target, FALSE);
|
||||
pair->flags = targets[i].flags;
|
||||
pair->info = targets[i].info;
|
||||
@ -514,7 +514,7 @@ gtk_target_list_remove (GtkTargetList *list,
|
||||
|
||||
if (pair->target == target)
|
||||
{
|
||||
g_free (pair);
|
||||
g_slice_free (GtkTargetPair, pair);
|
||||
|
||||
list->list = g_list_remove_link (list->list, tmp_list);
|
||||
g_list_free_1 (tmp_list);
|
||||
@ -690,14 +690,14 @@ gtk_selection_owner_set_for_display (GdkDisplay *display,
|
||||
current_selections = g_list_remove_link (current_selections,
|
||||
tmp_list);
|
||||
g_list_free (tmp_list);
|
||||
g_free (selection_info);
|
||||
g_slice_free (GtkSelectionInfo, selection_info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (selection_info == NULL)
|
||||
{
|
||||
selection_info = g_new (GtkSelectionInfo, 1);
|
||||
selection_info = g_slice_new (GtkSelectionInfo);
|
||||
selection_info->selection = selection;
|
||||
selection_info->widget = widget;
|
||||
selection_info->time = time;
|
||||
@ -795,7 +795,7 @@ gtk_selection_target_list_get (GtkWidget *widget,
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
sellist = g_new (GtkSelectionTargetList, 1);
|
||||
sellist = g_slice_new (GtkSelectionTargetList);
|
||||
sellist->selection = selection;
|
||||
sellist->list = gtk_target_list_new (NULL, 0);
|
||||
|
||||
@ -821,7 +821,7 @@ gtk_selection_target_list_remove (GtkWidget *widget)
|
||||
|
||||
gtk_target_list_unref (sellist->list);
|
||||
|
||||
g_free (sellist);
|
||||
g_slice_free (GtkSelectionTargetList, sellist);
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
@ -858,7 +858,7 @@ gtk_selection_clear_targets (GtkWidget *widget,
|
||||
{
|
||||
lists = g_list_delete_link (lists, tmp_list);
|
||||
gtk_target_list_unref (sellist->list);
|
||||
g_free (sellist);
|
||||
g_slice_free (GtkSelectionTargetList, sellist);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -985,7 +985,7 @@ gtk_selection_remove_all (GtkWidget *widget)
|
||||
current_selections = g_list_remove_link (current_selections,
|
||||
tmp_list);
|
||||
g_list_free (tmp_list);
|
||||
g_free (selection_info);
|
||||
g_slice_free (GtkSelectionInfo, selection_info);
|
||||
}
|
||||
|
||||
tmp_list = next;
|
||||
@ -1046,7 +1046,7 @@ gtk_selection_convert (GtkWidget *widget,
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
info = g_new (GtkRetrievalInfo, 1);
|
||||
info = g_slice_new (GtkRetrievalInfo);
|
||||
|
||||
info->widget = widget;
|
||||
info->selection = selection;
|
||||
@ -1088,8 +1088,10 @@ gtk_selection_convert (GtkWidget *widget,
|
||||
time_);
|
||||
|
||||
g_free (selection_data.data);
|
||||
selection_data.data = NULL;
|
||||
selection_data.length = -1;
|
||||
|
||||
g_free (info);
|
||||
g_slice_free (GtkRetrievalInfo, info);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -1142,7 +1144,7 @@ gtk_selection_data_set (GtkSelectionData *selection_data,
|
||||
if (length < 0)
|
||||
selection_data->data = NULL;
|
||||
else
|
||||
selection_data->data = g_strdup("");
|
||||
selection_data->data = (guchar *) g_strdup ("");
|
||||
}
|
||||
|
||||
selection_data->length = length;
|
||||
@ -1161,7 +1163,7 @@ selection_set_string (GtkSelectionData *selection_data,
|
||||
{
|
||||
gtk_selection_data_set (selection_data,
|
||||
GDK_SELECTION_TYPE_STRING,
|
||||
8, latin1, strlen (latin1));
|
||||
8, (guchar *) latin1, strlen (latin1));
|
||||
g_free (latin1);
|
||||
|
||||
return TRUE;
|
||||
@ -1292,13 +1294,13 @@ selection_set_text_plain (GtkSelectionData *selection_data,
|
||||
|
||||
gtk_selection_data_set (selection_data,
|
||||
selection_data->target,
|
||||
8, result, strlen (result));
|
||||
8, (guchar *) result, strlen (result));
|
||||
g_free (result);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
static guchar *
|
||||
selection_get_text_plain (GtkSelectionData *selection_data)
|
||||
{
|
||||
const gchar *charset = NULL;
|
||||
@ -1306,7 +1308,7 @@ selection_get_text_plain (GtkSelectionData *selection_data)
|
||||
gsize len;
|
||||
GError *error = NULL;
|
||||
|
||||
str = g_strdup (selection_data->data);
|
||||
str = g_strdup ((const gchar *) selection_data->data);
|
||||
len = selection_data->length;
|
||||
|
||||
if (selection_data->type == text_plain_atom)
|
||||
@ -1343,7 +1345,7 @@ selection_get_text_plain (GtkSelectionData *selection_data)
|
||||
result = normalize_to_lf (str, len);
|
||||
g_free (str);
|
||||
|
||||
return result;
|
||||
return (guchar *) result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1430,7 +1432,7 @@ gtk_selection_data_get_text (GtkSelectionData *selection_data)
|
||||
selection_data->length,
|
||||
&list);
|
||||
if (count > 0)
|
||||
result = list[0];
|
||||
result = (guchar *) list[0];
|
||||
|
||||
for (i = 1; i < count; i++)
|
||||
g_free (list[i]);
|
||||
@ -2052,7 +2054,7 @@ gtk_selection_clear (GtkWidget *widget,
|
||||
{
|
||||
current_selections = g_list_remove_link (current_selections, tmp_list);
|
||||
g_list_free (tmp_list);
|
||||
g_free (selection_info);
|
||||
g_slice_free (GtkSelectionInfo, selection_info);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -2100,7 +2102,7 @@ _gtk_selection_request (GtkWidget *widget,
|
||||
if (tmp_list == NULL)
|
||||
return FALSE;
|
||||
|
||||
info = g_new (GtkIncrInfo, 1);
|
||||
info = g_slice_new (GtkIncrInfo);
|
||||
|
||||
g_object_ref (widget);
|
||||
|
||||
@ -2138,7 +2140,7 @@ _gtk_selection_request (GtkWidget *widget,
|
||||
GDK_NONE,
|
||||
event->time);
|
||||
g_free (mult_atoms);
|
||||
g_free (info);
|
||||
g_slice_free (GtkIncrInfo, info);
|
||||
gdk_error_trap_pop ();
|
||||
return TRUE;
|
||||
}
|
||||
@ -2316,7 +2318,7 @@ _gtk_selection_request (GtkWidget *widget,
|
||||
if (info->num_incrs == 0)
|
||||
{
|
||||
g_free (info->conversions);
|
||||
g_free (info);
|
||||
g_slice_free (GtkIncrInfo, info);
|
||||
}
|
||||
|
||||
g_object_unref (widget);
|
||||
@ -2484,7 +2486,7 @@ gtk_selection_incr_timeout (GtkIncrInfo *info)
|
||||
/* FIXME: we should check if requestor window is still in use,
|
||||
and if not, remove it? */
|
||||
|
||||
g_free (info);
|
||||
g_slice_free (GtkIncrInfo, info);
|
||||
|
||||
retval = FALSE; /* remove timeout */
|
||||
}
|
||||
@ -2728,7 +2730,7 @@ gtk_selection_retrieval_timeout (GtkRetrievalInfo *info)
|
||||
}
|
||||
|
||||
g_free (info->buffer);
|
||||
g_free (info);
|
||||
g_slice_free (GtkRetrievalInfo, info);
|
||||
|
||||
retval = FALSE; /* remove timeout */
|
||||
}
|
||||
@ -2916,7 +2918,7 @@ gtk_selection_data_copy (GtkSelectionData *data)
|
||||
|
||||
g_return_val_if_fail (data != NULL, NULL);
|
||||
|
||||
new_data = g_new (GtkSelectionData, 1);
|
||||
new_data = g_slice_new (GtkSelectionData);
|
||||
*new_data = *data;
|
||||
|
||||
if (data->data)
|
||||
@ -2942,7 +2944,7 @@ gtk_selection_data_free (GtkSelectionData *data)
|
||||
|
||||
g_free (data->data);
|
||||
|
||||
g_free (data);
|
||||
g_slice_free (GtkSelectionData, data);
|
||||
}
|
||||
|
||||
GType
|
||||
|
Loading…
Reference in New Issue
Block a user