forked from AuroraMiddleware/gtk
Use gtk_event_controller_set_static_name
This avoids strdups.
This commit is contained in:
parent
b6a965a67c
commit
32796cad10
@ -2050,12 +2050,12 @@ connect_completion_signals (GtkEntryCompletion *completion)
|
||||
GtkEntryBuffer *buffer = gtk_text_get_buffer (text);
|
||||
|
||||
controller = completion->entry_key_controller = gtk_event_controller_key_new ();
|
||||
gtk_event_controller_set_name (controller, "gtk-entry-completion");
|
||||
gtk_event_controller_set_static_name (controller, "gtk-entry-completion");
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_entry_completion_key_pressed), completion);
|
||||
gtk_widget_add_controller (GTK_WIDGET (text), controller);
|
||||
controller = completion->entry_focus_controller = gtk_event_controller_focus_new ();
|
||||
gtk_event_controller_set_name (controller, "gtk-entry-completion");
|
||||
gtk_event_controller_set_static_name (controller, "gtk-entry-completion");
|
||||
g_signal_connect_swapped (controller, "leave", G_CALLBACK (text_focus_out), completion);
|
||||
gtk_widget_add_controller (GTK_WIDGET (text), controller);
|
||||
|
||||
|
@ -588,7 +588,7 @@ gtk_im_context_wayland_set_client_widget (GtkIMContext *context,
|
||||
GtkGesture *gesture;
|
||||
|
||||
gesture = gtk_gesture_click_new ();
|
||||
gtk_event_controller_set_name (GTK_EVENT_CONTROLLER (gesture), "wayland-im-context-click");
|
||||
gtk_event_controller_set_static_name (GTK_EVENT_CONTROLLER (gesture), "wayland-im-context-click");
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (gesture, "pressed",
|
||||
|
@ -51,13 +51,13 @@ gtk_shortcut_manager_create_controllers (GtkWidget *widget)
|
||||
model = gtk_flatten_list_model_new (G_LIST_MODEL (g_list_store_new (GTK_TYPE_SHORTCUT_CONTROLLER)));
|
||||
g_object_set_data_full (G_OBJECT (widget), "gtk-shortcut-manager-bubble", model, g_object_unref);
|
||||
controller = gtk_shortcut_controller_new_for_model (G_LIST_MODEL (model));
|
||||
gtk_event_controller_set_name (controller, "gtk-shortcut-manager-bubble");
|
||||
gtk_event_controller_set_static_name (controller, "gtk-shortcut-manager-bubble");
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
|
||||
model = gtk_flatten_list_model_new (G_LIST_MODEL (g_list_store_new (GTK_TYPE_SHORTCUT_CONTROLLER)));
|
||||
g_object_set_data_full (G_OBJECT (widget), "gtk-shortcut-manager-capture", model, g_object_unref);
|
||||
controller = gtk_shortcut_controller_new_for_model (G_LIST_MODEL (model));
|
||||
gtk_event_controller_set_name (controller, "gtk-shortcut-manager-capture");
|
||||
gtk_event_controller_set_static_name (controller, "gtk-shortcut-manager-capture");
|
||||
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
}
|
||||
|
@ -1856,7 +1856,7 @@ gtk_text_init (GtkText *self)
|
||||
GTK_TEXT_CONTENT (priv->selection_content)->self = self;
|
||||
|
||||
target = gtk_drop_target_new (G_TYPE_STRING, GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
||||
gtk_event_controller_set_name (GTK_EVENT_CONTROLLER (target), "gtk-text-drop-target");
|
||||
gtk_event_controller_set_static_name (GTK_EVENT_CONTROLLER (target), "gtk-text-drop-target");
|
||||
g_signal_connect (target, "accept", G_CALLBACK (gtk_text_drag_accept), self);
|
||||
g_signal_connect (target, "enter", G_CALLBACK (gtk_text_drag_motion), self);
|
||||
g_signal_connect (target, "motion", G_CALLBACK (gtk_text_drag_motion), self);
|
||||
@ -1881,7 +1881,7 @@ gtk_text_init (GtkText *self)
|
||||
G_CALLBACK (gtk_text_delete_surrounding_cb), self);
|
||||
|
||||
priv->drag_gesture = gtk_gesture_drag_new ();
|
||||
gtk_event_controller_set_name (GTK_EVENT_CONTROLLER (priv->drag_gesture), "gtk-text-drag-gesture");
|
||||
gtk_event_controller_set_static_name (GTK_EVENT_CONTROLLER (priv->drag_gesture), "gtk-text-drag-gesture");
|
||||
g_signal_connect (priv->drag_gesture, "drag-update",
|
||||
G_CALLBACK (gtk_text_drag_gesture_update), self);
|
||||
g_signal_connect (priv->drag_gesture, "drag-end",
|
||||
@ -1891,7 +1891,7 @@ gtk_text_init (GtkText *self)
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (priv->drag_gesture));
|
||||
|
||||
gesture = gtk_gesture_click_new ();
|
||||
gtk_event_controller_set_name (GTK_EVENT_CONTROLLER (gesture), "gtk-text-click-gesture");
|
||||
gtk_event_controller_set_static_name (GTK_EVENT_CONTROLLER (gesture), "gtk-text-click-gesture");
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (gtk_text_click_gesture_pressed), self);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
|
||||
@ -1899,14 +1899,14 @@ gtk_text_init (GtkText *self)
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
gtk_event_controller_set_name (controller, "gtk-text-motion-controller");
|
||||
gtk_event_controller_set_static_name (controller, "gtk-text-motion-controller");
|
||||
g_signal_connect (controller, "motion",
|
||||
G_CALLBACK (gtk_text_motion_controller_motion), self);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
||||
|
||||
priv->key_controller = gtk_event_controller_key_new ();
|
||||
gtk_event_controller_set_propagation_phase (priv->key_controller, GTK_PHASE_TARGET);
|
||||
gtk_event_controller_set_name (priv->key_controller, "gtk-text-key-controller");
|
||||
gtk_event_controller_set_static_name (priv->key_controller, "gtk-text-key-controller");
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
G_CALLBACK (gtk_text_key_controller_key_pressed), self);
|
||||
g_signal_connect_swapped (priv->key_controller, "im-update",
|
||||
@ -1916,7 +1916,7 @@ gtk_text_init (GtkText *self)
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), priv->key_controller);
|
||||
|
||||
priv->focus_controller = gtk_event_controller_focus_new ();
|
||||
gtk_event_controller_set_name (priv->focus_controller, "gtk-text-focus-controller");
|
||||
gtk_event_controller_set_static_name (priv->focus_controller, "gtk-text-focus-controller");
|
||||
g_signal_connect (priv->focus_controller, "notify::is-focus",
|
||||
G_CALLBACK (gtk_text_focus_changed), self);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), priv->focus_controller);
|
||||
|
@ -2362,7 +2362,7 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
|
||||
if (g_list_model_get_n_items (G_LIST_MODEL (GTK_WIDGET_CLASS (g_class)->priv->shortcuts)) > 0)
|
||||
{
|
||||
controller = gtk_shortcut_controller_new_for_model (G_LIST_MODEL (GTK_WIDGET_CLASS (g_class)->priv->shortcuts));
|
||||
gtk_event_controller_set_name (controller, "gtk-widget-class-shortcuts");
|
||||
gtk_event_controller_set_static_name (controller, "gtk-widget-class-shortcuts");
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
}
|
||||
|
||||
|
@ -1683,7 +1683,7 @@ gtk_window_init (GtkWindow *window)
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
|
||||
controller = gtk_event_controller_legacy_new ();
|
||||
gtk_event_controller_set_name (controller, "gtk-window-toplevel-focus");
|
||||
gtk_event_controller_set_static_name (controller, "gtk-window-toplevel-focus");
|
||||
g_signal_connect_swapped (controller, "event",
|
||||
G_CALLBACK (gtk_window_handle_focus), window);
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
@ -1694,7 +1694,7 @@ gtk_window_init (GtkWindow *window)
|
||||
shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (MENU_BAR_ACCEL, 0),
|
||||
gtk_callback_action_new (gtk_window_activate_menubar, NULL, NULL));
|
||||
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller), shortcut);
|
||||
gtk_event_controller_set_name (controller, "gtk-window-menubar-accel");
|
||||
gtk_event_controller_set_static_name (controller, "gtk-window-menubar-accel");
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
|
||||
priv->menubar_controller = controller;
|
||||
@ -2797,7 +2797,7 @@ gtk_window_set_application (GtkWindow *window,
|
||||
|
||||
app_accels = gtk_application_get_application_accels (priv->application);
|
||||
priv->application_shortcut_controller = gtk_shortcut_controller_new_for_model (gtk_application_accels_get_shortcuts (app_accels));
|
||||
gtk_event_controller_set_name (priv->application_shortcut_controller, "gtk-application-shortcuts");
|
||||
gtk_event_controller_set_static_name (priv->application_shortcut_controller, "gtk-application-shortcuts");
|
||||
gtk_event_controller_set_propagation_phase (priv->application_shortcut_controller, GTK_PHASE_CAPTURE);
|
||||
gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (priv->application_shortcut_controller), GTK_SHORTCUT_SCOPE_GLOBAL);
|
||||
gtk_widget_add_controller (GTK_WIDGET (window), priv->application_shortcut_controller);
|
||||
|
Loading…
Reference in New Issue
Block a user