[gtk+] widget-factory: Avoid a legacy event handler
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] widget-factory: Avoid a legacy event handler
- Date: Wed, 13 Dec 2017 00:46:25 +0000 (UTC)
commit 76b93f55981e6c16480fb169bdac97ab97d60e30
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Dec 12 19:13:52 2017 -0500
widget-factory: Avoid a legacy event handler
We can use a gesture instead, here.
demos/widget-factory/widget-factory.c | 13 +++++++++++--
demos/widget-factory/widget-factory.ui | 1 -
2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 74022ec..64224d0 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -1278,8 +1278,13 @@ textbuffer_notify_selection (GObject *object, GParamSpec *pspec, GtkWidget *butt
}
static gboolean
-osd_frame_button_press (GtkWidget *frame, GdkEventButton *event, gpointer data)
+osd_frame_pressed (GtkGestureMultiPress *gesture,
+ int press,
+ double x,
+ double y,
+ gpointer data)
{
+ GtkWidget *frame = data;
GtkWidget *osd;
gboolean visible;
@@ -1650,6 +1655,7 @@ activate (GApplication *app)
gint i;
GPermission *permission;
GAction *action;
+ GtkGesture *gesture;
g_type_ensure (my_text_view_get_type ());
@@ -1668,7 +1674,6 @@ activate (GApplication *app)
gtk_builder_add_callback_symbol (builder, "on_page_combo_changed", (GCallback)on_page_combo_changed);
gtk_builder_add_callback_symbol (builder, "on_range_from_changed", (GCallback)on_range_from_changed);
gtk_builder_add_callback_symbol (builder, "on_range_to_changed", (GCallback)on_range_to_changed);
- gtk_builder_add_callback_symbol (builder, "osd_frame_button_press", (GCallback)osd_frame_button_press);
gtk_builder_add_callback_symbol (builder, "tab_close_cb", (GCallback)tab_close_cb);
gtk_builder_add_callback_symbol (builder, "increase_icon_size", (GCallback)increase_icon_size);
gtk_builder_add_callback_symbol (builder, "decrease_icon_size", (GCallback)decrease_icon_size);
@@ -1892,6 +1897,10 @@ activate (GApplication *app)
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget);
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget2);
+ widget = (GtkWidget *)gtk_builder_get_object (builder, "osd_frame");
+ gesture = gtk_gesture_multi_press_new (widget);
+ g_signal_connect (gesture, "pressed", G_CALLBACK (osd_frame_pressed), widget);
+
gtk_widget_show (GTK_WIDGET (window));
g_object_unref (builder);
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index 064c534..0b0f975 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -3032,7 +3032,6 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkFrame" id="osd_frame">
- <signal name="button-press-event" handler="osd_frame_button_press"/>
<child>
<object class="GtkPaned">
<property name="wide-handle">1</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]