[balsa/gtk4: 107/206] address-view: Build with gtk4




commit 5778b687f604f11cea1d12078b10651844f774b0
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Sep 21 16:59:35 2020 -0400

    address-view: Build with gtk4

 libbalsa/address-view.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/libbalsa/address-view.c b/libbalsa/address-view.c
index 8ef5cbe1a..2fc4cd450 100644
--- a/libbalsa/address-view.c
+++ b/libbalsa/address-view.c
@@ -252,7 +252,7 @@ lbav_entry_setup_matches(LibBalsaAddressView * address_view,
     const gchar *prefix;
     GList *match = NULL;
 
-    prefix = gtk_entry_get_text(entry);
+    prefix = gtk_editable_get_text(GTK_EDITABLE(entry));
     if (*prefix)
         match = lbav_get_matching_addresses(address_view, prefix, type);
     lbav_append_addresses(address_view, completion, match, prefix);
@@ -583,7 +583,7 @@ lbav_entry_changed_cb(GtkEntry * entry, LibBalsaAddressView * address_view)
 
     completion = gtk_entry_get_completion(entry);
 
-    if (gtk_widget_get_window(GTK_WIDGET(entry)))
+    if (gtk_widget_get_realized(GTK_WIDGET(entry)))
         lbav_entry_setup_matches(address_view, entry, completion,
                                  LIBBALSA_ADDRESS_VIEW_MATCH_FAST);
 }
@@ -593,13 +593,13 @@ lbav_entry_changed_cb(GtkEntry * entry, LibBalsaAddressView * address_view)
  */
 static gboolean
 lbav_key_pressed_cb(GtkEntry * entry,
-                    const GdkEvent * event,
+                    GdkEvent * event,
                     LibBalsaAddressView * address_view)
 {
     guint keyval;
     GtkEntryCompletion *completion;
 
-    if (!gdk_event_get_keyval(event, &keyval) || keyval != GDK_KEY_Escape)
+    if ((keyval = gdk_key_event_get_keyval(event)) != GDK_KEY_Escape)
         return FALSE;
 
     if (address_view->last_was_escape) {
@@ -678,7 +678,7 @@ lbav_completion_match_selected_cb(GtkEntryCompletion * completion,
     entry = gtk_entry_completion_get_entry(completion);
     g_signal_handlers_block_by_func(entry, lbav_entry_changed_cb,
                                     address_view);
-    gtk_entry_set_text(GTK_ENTRY(entry), name);
+    gtk_editable_set_text(GTK_EDITABLE(entry), name);
     g_signal_handlers_unblock_by_func(entry, lbav_entry_changed_cb,
                                       address_view);
 
@@ -731,7 +731,7 @@ static void
 lbav_editing_done(GtkCellEditable * cell_editable,
                   LibBalsaAddressView * address_view)
 {
-    const gchar *text = gtk_entry_get_text(GTK_ENTRY(cell_editable));
+    const gchar *text = gtk_editable_get_text(GTK_EDITABLE(cell_editable));
 
     lbav_set_text(address_view, text);
 }
@@ -753,7 +753,7 @@ lbav_notify_has_focus_cb(GtkEntry            *entry,
         return;
      }
 
-    the_entry = gtk_entry_get_text(entry);
+    the_entry = gtk_editable_get_text(GTK_EDITABLE(entry));
 
     if (the_entry != NULL && the_entry[0] != '\0') {
         GList *match;
@@ -771,7 +771,7 @@ lbav_notify_has_focus_cb(GtkEntry            *entry,
                 g_signal_handlers_block_by_func(entry,
                                                 lbav_entry_changed_cb,
                                                 address_view);
-                gtk_entry_set_text(entry, the_addr);
+                gtk_editable_set_text(GTK_EDITABLE(entry), the_addr);
                 g_signal_handlers_unblock_by_func(entry,
                                                   lbav_entry_changed_cb,
                                                   address_view);
@@ -925,17 +925,17 @@ lbav_sort_func(GtkTreeModel * model, GtkTreeIter * a, GtkTreeIter * b,
 
     /* Sort by type. */
     retval = type_a - type_b;
-    if (retval)
+    if (retval != 0)
         return retval;
 
     /* Within type, make sure a blank line sorts to the bottom. */
 
     gtk_tree_model_get(model, a, ADDRESS_NAME_COL, &name, -1);
-    is_blank_a = !name || !*name;
+    is_blank_a = (name == NULL) || (name[0] == '\0');
     g_free(name);
 
     gtk_tree_model_get(model, b, ADDRESS_NAME_COL, &name, -1);
-    is_blank_b = !name || !*name;
+    is_blank_b = (name == NULL) || (name[0] == '\0');
     g_free(name);
 
     return is_blank_a - is_blank_b;


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