[gimp] app: don't access GtkTargetList's members directly
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: don't access GtkTargetList's members directly
- Date: Mon, 28 Sep 2015 13:30:00 +0000 (UTC)
commit 560841606ca6e2396cc2bd9910c4190914666895
Author: Michael Natterer <mitch gimp org>
Date: Mon Sep 28 15:28:57 2015 +0200
app: don't access GtkTargetList's members directly
It's an opaque struct in GTK+ 3.x, so let's fix it here instead of
adding another patch to the gtk3-port branch.
app/widgets/gimpdnd.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/app/widgets/gimpdnd.c b/app/widgets/gimpdnd.c
index 5a6c643..3883f75 100644
--- a/app/widgets/gimpdnd.c
+++ b/app/widgets/gimpdnd.c
@@ -954,14 +954,15 @@ gimp_dnd_data_source_remove (GimpDndType data_type,
{
GtkTargetList *new_list;
GtkTargetEntry *targets;
- gint n_targets;
+ gint n_targets_old;
+ gint n_targets_new;
gint i;
- targets = gtk_target_table_new_from_list (target_list, &n_targets);
+ targets = gtk_target_table_new_from_list (target_list, &n_targets_old);
new_list = gtk_target_list_new (NULL, 0);
- for (i = 0; i < n_targets; i++)
+ for (i = 0; i < n_targets_old; i++)
{
if (targets[i].info != data_type)
{
@@ -972,14 +973,16 @@ gimp_dnd_data_source_remove (GimpDndType data_type,
}
}
- gtk_target_table_free (targets, n_targets);
+ gtk_target_table_free (targets, n_targets_old);
- if (g_list_length (target_list->list) !=
- g_list_length (new_list->list))
+ targets = gtk_target_table_new_from_list (new_list, &n_targets_new);
+ gtk_target_table_free (targets, n_targets_new);
+
+ if (n_targets_old != n_targets_new)
{
list_changed = TRUE;
- if (new_list->list)
+ if (n_targets_new > 0)
gtk_drag_source_set_target_list (widget, new_list);
else
gtk_drag_source_set_target_list (widget, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]