[network-manager-applet/lr/gtk4-part1: 5/6] utils: some gtk4 hacks



commit c201cedfdb829e529eb6a8dae9a84641e0081500
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Wed Jun 27 20:03:38 2018 +0200

    utils: some gtk4 hacks

 src/libnma/nma-ui-utils.c | 13 +++++++++++--
 src/utils/utils.c         | 11 ++++++++++-
 2 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/src/libnma/nma-ui-utils.c b/src/libnma/nma-ui-utils.c
index 6754f750..73877b3b 100644
--- a/src/libnma/nma-ui-utils.c
+++ b/src/libnma/nma-ui-utils.c
@@ -222,14 +222,23 @@ 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);
+       GdkRectangle icon_area;
+
        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]