[balsa/gtk4: 217/289] Various: Do not cast GtkEventController to itself




commit bc245d0c8fc03d4e7151b39278442e5e7e966206
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu Oct 22 13:25:37 2020 -0400

    Various: Do not cast GtkEventController to itself

 src/balsa-index.c     | 13 +++++--------
 src/balsa-message.c   |  2 +-
 src/toolbar-factory.c |  2 +-
 3 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/src/balsa-index.c b/src/balsa-index.c
index ec86c984f..79fd24419 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -355,6 +355,7 @@ balsa_index_init(BalsaIndex * index)
     GtkTreeViewColumn *column;
     GtkGesture *gesture;
     GtkEventController *controller;
+    GtkDragSource *drag_source;
     gint height;
 
 #if defined(TREE_VIEW_FIXED_HEIGHT)
@@ -510,7 +511,7 @@ balsa_index_init(BalsaIndex * index)
     /* we also want to handle key presses (shift-F10) to pop up context menus if
      * necessary, now that GtkWidget::popup_menu has gone away. */
     controller = gtk_event_controller_key_new();
-    gtk_widget_add_controller(GTK_WIDGET(index), GTK_EVENT_CONTROLLER(controller));
+    gtk_widget_add_controller(GTK_WIDGET(index), controller);
     g_signal_connect(controller, "key-pressed", G_CALLBACK(bndx_key_pressed_cb), index);
 
     /* catch thread expand events */
@@ -529,13 +530,9 @@ balsa_index_init(BalsaIndex * index)
                            NULL);
     gtk_tree_view_set_enable_search(tree_view, FALSE);
 
-    {
-        GtkDragSource *drag_source;
-
-        drag_source = gtk_drag_source_new();
-        gtk_widget_add_controller(GTK_WIDGET(index), GTK_EVENT_CONTROLLER(drag_source));
-        g_signal_connect(drag_source, "prepare", G_CALLBACK(bndx_drag_source_prepare), index);
-    }
+    drag_source = gtk_drag_source_new();
+    gtk_widget_add_controller(GTK_WIDGET(index), GTK_EVENT_CONTROLLER(drag_source));
+    g_signal_connect(drag_source, "prepare", G_CALLBACK(bndx_drag_source_prepare), index);
 
     balsa_index_set_column_widths(index);
 }
diff --git a/src/balsa-message.c b/src/balsa-message.c
index 452f7874f..b1be9c65f 100644
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@ -267,7 +267,7 @@ bm_header_tl_buttons(BalsaMessage * balsa_message)
     gtk_widget_set_tooltip_text(button, _("Select message part to display"));
 
     key_controller = gtk_event_controller_key_new();
-    gtk_widget_add_controller(button, GTK_EVENT_CONTROLLER(key_controller));
+    gtk_widget_add_controller(button, key_controller);
     g_signal_connect(key_controller, "focus-in",
                     G_CALLBACK(balsa_mime_widget_limit_focus), balsa_message);
     g_signal_connect(key_controller, "focus-out",
diff --git a/src/toolbar-factory.c b/src/toolbar-factory.c
index 60c714c19..d8cd0f9a4 100644
--- a/src/toolbar-factory.c
+++ b/src/toolbar-factory.c
@@ -829,7 +829,7 @@ balsa_toolbar_new(BalsaToolbarModel * model,
     g_signal_connect(gesture, "pressed", G_CALLBACK(tm_gesture_pressed), info);
 
     key_controller = gtk_event_controller_key_new();
-    gtk_widget_add_controller(toolbar, GTK_EVENT_CONTROLLER(key_controller));
+    gtk_widget_add_controller(toolbar, key_controller);
     g_signal_connect(key_controller, "key-pressed", G_CALLBACK(tm_key_pressed), info);
 
     gtk_widget_add_css_class(toolbar, "toolbar");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]