mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-04 09:40:19 +00:00
toolbar: Stop using legacy event signals
We can reuse the button gesture here.
This commit is contained in:
parent
fa7ef93bc5
commit
7e02ad648c
@ -59,6 +59,7 @@
|
|||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
#include "gtkwindowprivate.h"
|
#include "gtkwindowprivate.h"
|
||||||
#include "gtkgesturemultipress.h"
|
#include "gtkgesturemultipress.h"
|
||||||
|
#include "gtkbuttonprivate.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -231,8 +232,10 @@ static void gtk_toolbar_real_style_changed (GtkToolbar *toolbar
|
|||||||
GtkToolbarStyle style);
|
GtkToolbarStyle style);
|
||||||
static gboolean gtk_toolbar_focus_home_or_end (GtkToolbar *toolbar,
|
static gboolean gtk_toolbar_focus_home_or_end (GtkToolbar *toolbar,
|
||||||
gboolean focus_home);
|
gboolean focus_home);
|
||||||
static gboolean gtk_toolbar_arrow_button_press (GtkWidget *button,
|
static void gtk_toolbar_arrow_button_press (GtkGesture *gesture,
|
||||||
GdkEventButton *event,
|
int n_press,
|
||||||
|
double x,
|
||||||
|
double y,
|
||||||
GtkToolbar *toolbar);
|
GtkToolbar *toolbar);
|
||||||
static void gtk_toolbar_arrow_button_clicked (GtkWidget *button,
|
static void gtk_toolbar_arrow_button_clicked (GtkWidget *button,
|
||||||
GtkToolbar *toolbar);
|
GtkToolbar *toolbar);
|
||||||
@ -572,7 +575,7 @@ gtk_toolbar_init (GtkToolbar *toolbar)
|
|||||||
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (toolbar));
|
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (toolbar));
|
||||||
|
|
||||||
priv->arrow_button = gtk_toggle_button_new ();
|
priv->arrow_button = gtk_toggle_button_new ();
|
||||||
g_signal_connect (priv->arrow_button, "button-press-event",
|
g_signal_connect (gtk_button_get_gesture (GTK_BUTTON (priv->arrow_button)), "pressed",
|
||||||
G_CALLBACK (gtk_toolbar_arrow_button_press), toolbar);
|
G_CALLBACK (gtk_toolbar_arrow_button_press), toolbar);
|
||||||
g_signal_connect (priv->arrow_button, "clicked",
|
g_signal_connect (priv->arrow_button, "clicked",
|
||||||
G_CALLBACK (gtk_toolbar_arrow_button_clicked), toolbar);
|
G_CALLBACK (gtk_toolbar_arrow_button_clicked), toolbar);
|
||||||
@ -2288,15 +2291,18 @@ gtk_toolbar_arrow_button_clicked (GtkWidget *button,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
gtk_toolbar_arrow_button_press (GtkWidget *button,
|
gtk_toolbar_arrow_button_press (GtkGesture *gesture,
|
||||||
GdkEventButton *event,
|
int n_press,
|
||||||
|
double x,
|
||||||
|
double y,
|
||||||
GtkToolbar *toolbar)
|
GtkToolbar *toolbar)
|
||||||
{
|
{
|
||||||
show_menu (toolbar, event);
|
GtkWidget *button;
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
||||||
|
|
||||||
return TRUE;
|
button = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
||||||
|
show_menu (toolbar, NULL);
|
||||||
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user