[libgd/wip/ernestask/gtk4: 8/33] Replace GtkTarget{Entry, List} with GdkContentFormats
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgd/wip/ernestask/gtk4: 8/33] Replace GtkTarget{Entry, List} with GdkContentFormats
- Date: Sun, 11 Mar 2018 08:18:06 +0000 (UTC)
commit da333557d83cb0cac83fe618ff127c4fec2a9197
Author: Ernestas Kulik <ernestask gnome org>
Date: Mon Mar 5 18:31:22 2018 +0200
Replace GtkTarget{Entry,List} with GdkContentFormats
Also see c863ac0f90dfdeea5e17293594686063187d689c in GTK+ about the
same-app checks.
libgd/gd-main-icon-box.c | 15 ++++++++++-----
libgd/gd-main-icon-view.c | 9 ++++++---
libgd/gd-main-list-view.c | 9 ++++++---
3 files changed, 22 insertions(+), 11 deletions(-)
---
diff --git a/libgd/gd-main-icon-box.c b/libgd/gd-main-icon-box.c
index 3e982ca..0f9323a 100644
--- a/libgd/gd-main-icon-box.c
+++ b/libgd/gd-main-icon-box.c
@@ -681,7 +681,7 @@ gd_main_icon_box_motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
{
GdMainIconBox *self = GD_MAIN_ICON_BOX (widget);
GdMainIconBoxPrivate *priv;
- GtkTargetList *targets;
+ GdkContentFormats *formats;
gboolean res;
gint button;
@@ -701,10 +701,10 @@ gd_main_icon_box_motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
priv->dnd_button = -1;
priv->dnd_started = TRUE;
- targets = gtk_drag_source_get_target_list (GTK_WIDGET (self));
+ formats = gtk_drag_source_get_target_list (GTK_WIDGET (self));
gtk_drag_begin_with_coordinates (GTK_WIDGET (self),
- targets,
+ formats,
GDK_ACTION_COPY,
button,
(GdkEvent *) event,
@@ -932,7 +932,10 @@ static void
gd_main_icon_box_init (GdMainIconBox *self)
{
GdMainIconBoxPrivate *priv;
- const GtkTargetEntry targets[] = { { (gchar *) "text/uri-list", GTK_TARGET_OTHER_APP, 0 } };
+ const gchar *targets[] = {
+ "text/uri-list",
+ };
+ g_autoptr (GdkContentFormats) formats = NULL;
priv = gd_main_icon_box_get_instance_private (self);
@@ -941,11 +944,13 @@ gd_main_icon_box_init (GdMainIconBox *self)
gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (self), 3);
gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (self), GTK_SELECTION_NONE);
+ formats = gdk_content_formats_new (targets, G_N_ELEMENTS (targets));
+
/* We need to ensure that rubberband selection and DnD don't step
* on each others toes. We set start_button_mask to 0 to retain
* control over when to begin a drag.
*/
- gtk_drag_source_set (GTK_WIDGET (self), 0, targets, G_N_ELEMENTS (targets), GDK_ACTION_COPY);
+ gtk_drag_source_set (GTK_WIDGET (self), 0, formats, GDK_ACTION_COPY);
priv->dnd_button = -1;
priv->dnd_start_x = -1.0;
diff --git a/libgd/gd-main-icon-view.c b/libgd/gd-main-icon-view.c
index 263eba6..5390571 100644
--- a/libgd/gd-main-icon-view.c
+++ b/libgd/gd-main-icon-view.c
@@ -120,9 +120,10 @@ gd_main_icon_view_constructed (GObject *obj)
GdMainIconView *self = GD_MAIN_ICON_VIEW (obj);
GdMainIconViewPrivate *priv;
GtkCellRenderer *cell;
- const GtkTargetEntry targets[] = {
- { (char *) "text/uri-list", GTK_TARGET_OTHER_APP, 0 }
+ const gchar *targets[] = {
+ "text/uri-list",
};
+ g_autoptr (GdkContentFormats) formats = NULL;
priv = gd_main_icon_view_get_instance_private (self);
@@ -157,9 +158,11 @@ gd_main_icon_view_constructed (GObject *obj)
set_attributes_from_model (self);
+ formats = gdk_content_formats_new (targets, G_N_ELEMENTS (targets));
+
gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW (self),
GDK_BUTTON1_MASK,
- targets, 1,
+ formats,
GDK_ACTION_COPY);
}
diff --git a/libgd/gd-main-list-view.c b/libgd/gd-main-list-view.c
index 00fe5e0..f4ab4ef 100644
--- a/libgd/gd-main-list-view.c
+++ b/libgd/gd-main-list-view.c
@@ -111,9 +111,10 @@ gd_main_list_view_constructed (GObject *obj)
GdMainListView *self = GD_MAIN_LIST_VIEW (obj);
GtkCellRenderer *cell;
GtkTreeSelection *selection;
- const GtkTargetEntry targets[] = {
- { "text/uri-list", GTK_TARGET_OTHER_APP, 0 }
+ const gchar *targets[] = {
+ "text/uri-list"
};
+ g_autoptr (GdkContentFormats) formats = NULL;
G_OBJECT_CLASS (gd_main_list_view_parent_class)->constructed (obj);
@@ -159,9 +160,11 @@ gd_main_list_view_constructed (GObject *obj)
set_attributes_from_model (self);
+ formats = gdk_content_formats_new (targets, G_N_ELEMENTS (targets));
+
gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (self),
GDK_BUTTON1_MASK,
- targets, 1,
+ formats,
GDK_ACTION_COPY);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]