[network-manager-applet/lr/gtk4: 8/9] utils: support GTK4



commit 5407ab1a80fccf295974b2215d8b17494f3e7dbd
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Mon Feb 18 13:30:42 2019 +0100

    utils: support GTK4
    
    Cover a trivial difference with an ifdef.

 src/libnma/nma-ui-utils.c | 12 ++++++++++--
 src/utils/utils.c         | 11 ++++++++++-
 2 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/src/libnma/nma-ui-utils.c b/src/libnma/nma-ui-utils.c
index 6754f750..132bbda9 100644
--- a/src/libnma/nma-ui-utils.c
+++ b/src/libnma/nma-ui-utils.c
@@ -222,14 +222,22 @@ popup_menu_item_info_register (GtkWidget *item,
 static void
 icon_release_cb (GtkEntry *entry,
                  GtkEntryIconPosition position,
+#if !GTK_CHECK_VERSION(3,90,0)
                  GdkEventButton *event,
+#endif
                  gpointer data)
 {
        GtkMenu *menu = GTK_MENU (data);
+
        if (position == GTK_ENTRY_ICON_SECONDARY) {
-               gtk_widget_show_all (GTK_WIDGET (data));
+               gtk_widget_show (GTK_WIDGET (data));
                gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
-                               event->button, event->time);
+#if GTK_CHECK_VERSION(3,90,0)
+                               0, gtk_get_current_event_time()
+#else
+                               event->button, event->time
+#endif
+                                );
        }
 }
 
diff --git a/src/utils/utils.c b/src/utils/utils.c
index 694c521a..14ef82c6 100644
--- a/src/utils/utils.c
+++ b/src/utils/utils.c
@@ -332,10 +332,19 @@ utils_override_bg_color (GtkWidget *widget, GdkRGBA *rgba)
        if (rgba) {
                css = g_strdup_printf ("* { background-color: %s; background-image: none; }",
                                       gdk_rgba_to_string (rgba));
+#if GTK_CHECK_VERSION(3,90,0)
+               gtk_css_provider_load_from_data (provider, css, -1);
+#else
                gtk_css_provider_load_from_data (provider, css, -1, NULL);
+#endif
                g_free (css);
-       } else
+       } else {
+#if GTK_CHECK_VERSION(3,90,0)
+               gtk_css_provider_load_from_data (provider, "", -1);
+#else
                gtk_css_provider_load_from_data (provider, "", -1, NULL);
+#endif
+       }
 }
 
 void


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