[Xfce4-commits] [xfce/xfce4-panel] 03/03: Fix various warnings with Gtk3 (Bug #14135)

noreply at xfce.org noreply at xfce.org
Tue Jan 2 21:21:56 CET 2018


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-panel.

commit 43dfa79865eed5948c62847b1d03a8010e13d9a2
Author: Olivier Duchateau <duchateau.olivier at gmail.com>
Date:   Tue Jan 2 15:10:15 2018 +0100

    Fix various warnings with Gtk3 (Bug #14135)
    
    * replace 'gtk_menu_popup' by 'gtk_menu_popup_at_pointer' or
    	'gtk_menu_popup_at_widget'
    * 'gtk_dialog_set_alternative_button_order' is only for Gtk+ < 3.x
      (Bug #14129)
---
 libxfce4panel/xfce-panel-plugin.c           |  7 ++++++-
 panel/panel-window.c                        | 16 ++++++++++------
 plugins/actions/actions.c                   |  9 ++++++++-
 plugins/applicationsmenu/applicationsmenu.c |  9 +++++++++
 plugins/directorymenu/directorymenu.c       |  9 +++++++++
 plugins/launcher/launcher-dialog.c          |  7 +++++++
 plugins/launcher/launcher.c                 |  7 +++++++
 plugins/tasklist/tasklist-widget.c          | 23 +++++++++++++++++++++++
 plugins/windowmenu/windowmenu.c             | 14 ++++++++++++++
 9 files changed, 93 insertions(+), 8 deletions(-)

diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index dd169f2..630fc0a 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -991,7 +991,12 @@ xfce_panel_plugin_button_press_event (GtkWidget      *widget,
         gtk_widget_set_sensitive (item, plugin->priv->menu_blocked == 0);
 
       /* popup the menu */
-      gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, event->time);
+#if GTK_CHECK_VERSION (3, 22, 0)
+      gtk_menu_popup_at_pointer (menu, (GdkEvent *) event);
+#else
+      gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
+                      event->button, event->time);
+#endif
 
       return TRUE;
     }
diff --git a/panel/panel-window.c b/panel/panel-window.c
index a90da2d..78c45ca 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -165,7 +165,7 @@ static void         panel_window_update_autohide_window               (PanelWind
                                                                        WnckScreen       *screen,
                                                                        WnckWindow       *active_window);
 static void         panel_window_menu_popup                           (PanelWindow      *window,
-                                                                       guint32           event_time,
+                                                                       GdkEventButton   *event,
                                                                        gboolean          show_tic_tac_toe);
 static void         panel_window_plugins_update                       (PanelWindow      *window,
                                                                        PluginProp        prop);
@@ -1089,7 +1089,7 @@ panel_window_button_press_event (GtkWidget      *widget,
   else if (event->button == 3
            || (event->button == 1 && modifiers == GDK_CONTROL_MASK))
     {
-      panel_window_menu_popup (window, event->time, modifiers == GDK_SHIFT_MASK);
+      panel_window_menu_popup (window, event, modifiers == GDK_SHIFT_MASK);
 
       return TRUE;
     }
@@ -2675,9 +2675,9 @@ panel_window_menu_deactivate (GtkMenu     *menu,
 
 
 static void
-panel_window_menu_popup (PanelWindow *window,
-                         guint32      event_time,
-                         gboolean     show_tic_tac_toe)
+panel_window_menu_popup (PanelWindow    *window,
+                         GdkEventButton *event,
+                         gboolean        show_tic_tac_toe)
 {
   GtkWidget *menu;
   GtkWidget *item;
@@ -2801,8 +2801,12 @@ G_GNUC_END_IGNORE_DEPRECATIONS
       gtk_widget_show (item);
     }
 
+#if GTK_CHECK_VERSION (3, 22, 0)
+  gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
+#else
   gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
-                  NULL, NULL, 0, event_time);
+                  NULL, NULL, 0, event->time);
+#endif
 }
 
 
diff --git a/plugins/actions/actions.c b/plugins/actions/actions.c
index bfa88b0..6daa3a6 100644
--- a/plugins/actions/actions.c
+++ b/plugins/actions/actions.c
@@ -863,7 +863,7 @@ actions_plugin_action_dbus_can (GDBusProxy  *proxy,
                                    G_DBUS_CALL_FLAGS_NONE,
                                    -1,
                                    NULL,
-                                   error);
+                                   &error);
 
   if (G_LIKELY (retval))
     {
@@ -1329,7 +1329,14 @@ actions_plugin_menu (GtkWidget     *button,
         }
     }
 
+#if GTK_CHECK_VERSION (3, 22, 0)
+  gtk_menu_popup_at_widget (GTK_MENU (plugin->menu), button,
+                            GDK_GRAVITY_SOUTH_WEST,
+                            GDK_GRAVITY_NORTH_WEST,
+                            NULL);
+#else
   gtk_menu_popup (GTK_MENU (plugin->menu), NULL, NULL,
                   button != NULL ? xfce_panel_plugin_position_menu : NULL,
                   plugin, 1, gtk_get_current_event_time ());
+#endif
 }
diff --git a/plugins/applicationsmenu/applicationsmenu.c b/plugins/applicationsmenu/applicationsmenu.c
index 797ccaa..fdf7614 100644
--- a/plugins/applicationsmenu/applicationsmenu.c
+++ b/plugins/applicationsmenu/applicationsmenu.c
@@ -539,9 +539,11 @@ applications_menu_plugin_configure_plugin_icon_chooser (GtkWidget              *
                                          _("OK"), GTK_RESPONSE_ACCEPT,
                                          NULL);
   gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_ACCEPT);
+#if !GTK_CHECK_VERSION (3, 0, 0)
   gtk_dialog_set_alternative_button_order (GTK_DIALOG (chooser),
                                            GTK_RESPONSE_ACCEPT,
                                            GTK_RESPONSE_CANCEL, -1);
+#endif
 
   exo_icon_chooser_dialog_set_icon (EXO_ICON_CHOOSER_DIALOG (chooser),
       panel_str_is_empty (plugin->button_icon) ? DEFAULT_ICON_NAME : plugin->button_icon);
@@ -783,10 +785,17 @@ applications_menu_plugin_menu (GtkWidget              *button,
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
 
   /* show the menu */
+#if GTK_CHECK_VERSION (3, 22, 0)
+  gtk_menu_popup_at_widget (GTK_MENU (plugin->menu), button,
+                            GDK_GRAVITY_SOUTH_WEST,
+                            GDK_GRAVITY_NORTH_WEST,
+                            (GdkEvent *) event);
+#else
   gtk_menu_popup (GTK_MENU (plugin->menu), NULL, NULL,
                   button != NULL ? xfce_panel_plugin_position_menu : NULL,
                   plugin, 1,
                   event != NULL ? event->time : gtk_get_current_event_time ());
+#endif
 
   return TRUE;
 }
diff --git a/plugins/directorymenu/directorymenu.c b/plugins/directorymenu/directorymenu.c
index e4bf620..1e9696c 100644
--- a/plugins/directorymenu/directorymenu.c
+++ b/plugins/directorymenu/directorymenu.c
@@ -395,9 +395,11 @@ directory_menu_plugin_configure_plugin_icon_chooser (GtkWidget           *button
                                          _("OK"), GTK_RESPONSE_ACCEPT,
                                          NULL);
   gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_ACCEPT);
+#if !GTK_CHECK_VERSION (3, 0, 0)
   gtk_dialog_set_alternative_button_order (GTK_DIALOG (chooser),
                                            GTK_RESPONSE_ACCEPT,
                                            GTK_RESPONSE_CANCEL, -1);
+#endif
 
   if (!panel_str_is_empty (plugin->icon_name))
   exo_icon_chooser_dialog_set_icon (EXO_ICON_CHOOSER_DIALOG (chooser), plugin->icon_name);
@@ -1015,7 +1017,14 @@ directory_menu_plugin_menu (GtkWidget           *button,
                            g_object_unref);
   directory_menu_plugin_menu_load (menu, plugin);
 
+#if GTK_CHECK_VERSION (3, 22, 0)
+  gtk_menu_popup_at_widget (GTK_MENU (menu), button,
+                            GDK_GRAVITY_SOUTH_WEST,
+                            GDK_GRAVITY_NORTH_WEST,
+                            NULL);
+#else
   gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
                   button != NULL ? xfce_panel_plugin_position_menu : NULL,
                   plugin, 1, gtk_get_current_event_time ());
+#endif
 }
diff --git a/plugins/launcher/launcher-dialog.c b/plugins/launcher/launcher-dialog.c
index 39c59fb..fd224f2 100644
--- a/plugins/launcher/launcher-dialog.c
+++ b/plugins/launcher/launcher-dialog.c
@@ -660,10 +660,17 @@ launcher_dialog_tree_popup_menu (GtkWidget            *treeview,
 
   /* show the menu */
   menu = gtk_builder_get_object (dialog->builder, "popup-menu");
+#if GTK_CHECK_VERSION (3, 22, 0)
+  gtk_menu_popup_at_widget (GTK_MENU (menu), treeview,
+                            GDK_GRAVITY_SOUTH_WEST,
+                            GDK_GRAVITY_NORTH_WEST,
+                            NULL);
+#else
   gtk_menu_popup (GTK_MENU (menu),
                   NULL, treeview,
                   NULL, NULL, 3,
                   gtk_get_current_event_time ());
+  #endif
 
   return TRUE;
 }
diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
index 133b303..4111702 100644
--- a/plugins/launcher/launcher.c
+++ b/plugins/launcher/launcher.c
@@ -1653,10 +1653,17 @@ launcher_plugin_menu_popup (gpointer user_data)
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (plugin->arrow), TRUE);
 
   /* popup the menu */
+#if GTK_CHECK_VERSION (3, 22, 0)
+  gtk_menu_popup_at_widget (GTK_MENU (plugin->menu),
+                            plugin->button, GDK_GRAVITY_SOUTH_WEST,
+                            GDK_GRAVITY_NORTH_WEST,
+                            NULL);
+#else
   gtk_menu_popup (GTK_MENU (plugin->menu), NULL, NULL,
                   xfce_panel_plugin_position_menu,
                   XFCE_PANEL_PLUGIN (plugin), 1,
                   gtk_get_current_event_time ());
+#endif
 
   /* fallback to manual positioning, this is used with
    * drag motion over the arrow button */
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 904e6ba..4eedb54 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -1512,10 +1512,17 @@ xfce_tasklist_arrow_button_toggled (GtkWidget    *button,
         }
 
       gtk_menu_attach_to_widget (GTK_MENU (menu), button, NULL);
+#if GTK_CHECK_VERSION (3, 22, 0)
+      gtk_menu_popup_at_widget (GTK_MENU (menu),
+                                xfce_tasklist_get_panel_plugin (tasklist),
+                                GDK_GRAVITY_SOUTH_WEST,
+                                GDK_GRAVITY_NORTH_WEST, NULL);
+#else
       gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
                       xfce_panel_plugin_position_menu,
                       xfce_tasklist_get_panel_plugin (tasklist),
                       1, gtk_get_current_event_time ());
+#endif
     }
 }
 
@@ -2864,11 +2871,19 @@ xfce_tasklist_button_button_press_event (GtkWidget         *button,
           G_CALLBACK (gtk_widget_destroy), NULL);
 
       gtk_menu_attach_to_widget (GTK_MENU (menu), button, NULL);
+#if GTK_CHECK_VERSION (3, 22, 0)
+      gtk_menu_popup_at_widget (GTK_MENU (menu),
+                                xfce_tasklist_get_panel_plugin (child->tasklist),
+                                GDK_GRAVITY_SOUTH_WEST,
+                                GDK_GRAVITY_NORTH_WEST,
+                                (GdkEvent *) event);
+#else
       gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
                       child->type == CHILD_TYPE_WINDOW ? xfce_panel_plugin_position_menu : NULL,
                       xfce_tasklist_get_panel_plugin (child->tasklist),
                       event->button,
                       event->time);
+#endif
 
       return TRUE;
     }
@@ -3574,11 +3589,19 @@ xfce_tasklist_group_button_button_press_event (GtkWidget         *button,
           G_CALLBACK (xfce_tasklist_group_button_menu_destroy), group_child);
 
       gtk_menu_attach_to_widget (GTK_MENU (menu), button, NULL);
+#if GTK_CHECK_VERSION (3, 22, 0)
+      gtk_menu_popup_at_widget (GTK_MENU (menu),
+                                xfce_tasklist_get_panel_plugin (group_child->tasklist),
+                                GDK_GRAVITY_SOUTH_WEST,
+                                GDK_GRAVITY_NORTH_WEST,
+                                (GdkEvent *) event);
+#else
       gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
                       xfce_panel_plugin_position_menu,
                       xfce_tasklist_get_panel_plugin (group_child->tasklist),
                       event->button,
                       event->time);
+#endif
 
       return TRUE;
     }
diff --git a/plugins/windowmenu/windowmenu.c b/plugins/windowmenu/windowmenu.c
index f47e993..87cded7 100644
--- a/plugins/windowmenu/windowmenu.c
+++ b/plugins/windowmenu/windowmenu.c
@@ -943,8 +943,15 @@ window_menu_plugin_menu_window_item_activate (GtkWidget      *mi,
       g_signal_connect (G_OBJECT (menu), "selection-done",
           G_CALLBACK (window_menu_plugin_menu_actions_selection_done),
           gtk_widget_get_parent (mi));
+#if GTK_CHECK_VERSION (3, 20, 0)
+      gtk_menu_popup_at_widget (GTK_MENU (menu), mi,
+                                GDK_GRAVITY_SOUTH,
+                                GDK_GRAVITY_NORTH_WEST,
+                                (GdkEvent *) event);
+#else
       gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL,
                       NULL, event->button, event->time);
+#endif
 
       return TRUE;
     }
@@ -1392,7 +1399,14 @@ window_menu_plugin_menu (GtkWidget        *button,
   g_signal_connect (G_OBJECT (menu), "deactivate",
       G_CALLBACK (window_menu_plugin_menu_selection_done), button);
 
+#if GTK_CHECK_VERSION (3, 22, 0)
+  gtk_menu_popup_at_widget (GTK_MENU (menu), button,
+                            GDK_GRAVITY_SOUTH,
+                            GDK_GRAVITY_NORTH_WEST,
+                            NULL);
+#else
   gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
                   button != NULL ? xfce_panel_plugin_position_menu : NULL,
                   plugin, 1, gtk_get_current_event_time ());
+#endif
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list