pangesture: Port to new API model

This commit is contained in:
Benjamin Otte 2018-03-09 00:03:15 +01:00 committed by Carlos Garnacho
parent 66223aaa08
commit 71991270b0
6 changed files with 14 additions and 21 deletions

View File

@ -276,13 +276,9 @@ gtk_gesture_pan_init (GtkGesturePan *gesture)
* Returns: a newly created #GtkGesturePan
**/
GtkGesture *
gtk_gesture_pan_new (GtkWidget *widget,
GtkOrientation orientation)
gtk_gesture_pan_new (GtkOrientation orientation)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
return g_object_new (GTK_TYPE_GESTURE_PAN,
"widget", widget,
"orientation", orientation,
NULL);
}

View File

@ -42,8 +42,7 @@ GDK_AVAILABLE_IN_ALL
GType gtk_gesture_pan_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkGesture * gtk_gesture_pan_new (GtkWidget *widget,
GtkOrientation orientation);
GtkGesture * gtk_gesture_pan_new (GtkOrientation orientation);
GDK_AVAILABLE_IN_ALL
GtkOrientation gtk_gesture_pan_get_orientation (GtkGesturePan *gesture);

View File

@ -993,7 +993,6 @@ gtk_paned_finalize (GObject *object)
gtk_paned_set_saved_focus (paned, NULL);
gtk_paned_set_first_paned (paned, NULL);
g_clear_object (&priv->pan_gesture);
g_clear_object (&priv->drag_gesture);
g_clear_object (&priv->motion_controller);
@ -1482,12 +1481,12 @@ gtk_paned_init (GtkPaned *paned)
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (paned));
/* Touch gesture */
gesture = gtk_gesture_pan_new (GTK_WIDGET (paned),
GTK_ORIENTATION_HORIZONTAL);
gesture = gtk_gesture_pan_new (GTK_ORIENTATION_HORIZONTAL);
connect_drag_gesture_signals (paned, gesture);
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), TRUE);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_CAPTURE);
gtk_widget_add_controller (GTK_WIDGET (paned), GTK_EVENT_CONTROLLER (gesture));
priv->pan_gesture = gesture;
/* Pointer gesture */

View File

@ -1931,9 +1931,10 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
G_CALLBACK (scrolled_window_drag_end_cb),
scrolled_window);
priv->pan_gesture = gtk_gesture_pan_new (widget, GTK_ORIENTATION_VERTICAL);
gtk_gesture_group (priv->pan_gesture, priv->drag_gesture);
priv->pan_gesture = gtk_gesture_pan_new (GTK_ORIENTATION_VERTICAL);
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->pan_gesture), TRUE);
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (priv->pan_gesture));
gtk_gesture_group (priv->pan_gesture, priv->drag_gesture);
priv->swipe_gesture = gtk_gesture_swipe_new ();
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (priv->swipe_gesture), TRUE);
@ -2616,7 +2617,6 @@ gtk_scrolled_window_finalize (GObject *object)
g_clear_object (&priv->drag_gesture);
g_clear_object (&priv->long_press_gesture);
g_clear_object (&priv->pan_gesture);
g_clear_object (&priv->scroll_controller);

View File

@ -70,8 +70,6 @@ struct _GtkShortcutsSection
gboolean has_filtered_group;
gboolean need_reflow;
GtkGesture *pan_gesture;
};
struct _GtkShortcutsSectionClass
@ -232,7 +230,6 @@ gtk_shortcuts_section_finalize (GObject *object)
g_clear_pointer (&self->name, g_free);
g_clear_pointer (&self->title, g_free);
g_clear_pointer (&self->view_name, g_free);
g_clear_object (&self->pan_gesture);
G_OBJECT_CLASS (gtk_shortcuts_section_parent_class)->finalize (object);
}
@ -417,6 +414,8 @@ gtk_shortcuts_section_class_init (GtkShortcutsSectionClass *klass)
static void
gtk_shortcuts_section_init (GtkShortcutsSection *self)
{
GtkGesture *gesture;
self->max_height = 15;
gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
@ -454,9 +453,10 @@ gtk_shortcuts_section_init (GtkShortcutsSection *self)
gtk_box_pack_end (GTK_BOX (self->footer), self->show_all);
gtk_widget_set_halign (self->show_all, GTK_ALIGN_END);
self->pan_gesture = gtk_gesture_pan_new (GTK_WIDGET (self->stack), GTK_ORIENTATION_HORIZONTAL);
g_signal_connect (self->pan_gesture, "pan",
gesture = gtk_gesture_pan_new (GTK_ORIENTATION_HORIZONTAL);
g_signal_connect (gesture, "pan",
G_CALLBACK (gtk_shortcuts_section_pan_gesture_pan), self);
gtk_widget_add_controller (GTK_WIDGET (self->stack), GTK_EVENT_CONTROLLER (gesture));
}
static void

View File

@ -475,7 +475,6 @@ gtk_switch_dispose (GObject *object)
g_clear_object (&priv->action_helper);
g_clear_object (&priv->pan_gesture);
g_clear_object (&priv->multipress_gesture);
G_OBJECT_CLASS (gtk_switch_parent_class)->dispose (object);
@ -631,8 +630,7 @@ gtk_switch_init (GtkSwitch *self)
GTK_PHASE_BUBBLE);
priv->multipress_gesture = gesture;
gesture = gtk_gesture_pan_new (GTK_WIDGET (self),
GTK_ORIENTATION_HORIZONTAL);
gesture = gtk_gesture_pan_new (GTK_ORIENTATION_HORIZONTAL);
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), FALSE);
gtk_gesture_single_set_exclusive (GTK_GESTURE_SINGLE (gesture), TRUE);
g_signal_connect (gesture, "pan",
@ -641,6 +639,7 @@ gtk_switch_init (GtkSwitch *self)
G_CALLBACK (gtk_switch_pan_gesture_drag_end), self);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_CAPTURE);
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
priv->pan_gesture = gesture;
/* Translators: if the "on" state label requires more than three