[gimp/gtk3-port: 273/362] Replace lots of deprecated gtk_menu_popup(), only GimpUIManager left



commit b73f6b910c95d2275dbd06ac55558b92f1fe4e5a
Author: Michael Natterer <mitch gimp org>
Date:   Tue May 1 23:21:04 2018 +0200

    Replace lots of deprecated gtk_menu_popup(), only GimpUIManager left

 app/propgui/gimppropgui-utils.c       |   39 +++++++++-----------------------
 app/widgets/gimpdashboard.c           |   27 ++++------------------
 app/widgets/gimpsettingsbox.c         |   19 +++------------
 libgimpwidgets/gimpcolorbutton.c      |    4 +--
 libgimpwidgets/gimppreviewarea.c      |    7 +-----
 plug-ins/common/animation-play.c      |    5 +---
 plug-ins/common/colormap-remap.c      |    5 +---
 plug-ins/help-browser/dialog.c        |    5 +---
 plug-ins/ifs-compose/ifs-compose.c    |    4 +--
 plug-ins/imagemap/imap_menu.c         |    4 +-
 plug-ins/imagemap/imap_object_popup.c |    3 +-
 plug-ins/imagemap/imap_polygon.c      |    3 +-
 12 files changed, 30 insertions(+), 95 deletions(-)
---
diff --git a/app/propgui/gimppropgui-utils.c b/app/propgui/gimppropgui-utils.c
index a601e39..471b05e 100644
--- a/app/propgui/gimppropgui-utils.c
+++ b/app/propgui/gimppropgui-utils.c
@@ -28,8 +28,6 @@
 
 #include "propgui-types.h"
 
-#include "widgets/gimpwidgets-utils.h"
-
 #include "gimppropgui-utils.h"
 
 #include "gimp-intl.h"
@@ -37,18 +35,13 @@
 
 /*  local function prototypes  */
 
-static void      gimp_prop_kelvin_presets_menu_position (GtkMenu        *menu,
-                                                         gint           *x,
-                                                         gint           *y,
-                                                         gboolean       *push_in,
-                                                         gpointer        user_data);
-static gboolean  gimp_prop_kelvin_presets_button_press  (GtkWidget      *widget,
-                                                         GdkEventButton *bevent,
-                                                         GtkMenu        *menu);
-static void      gimp_prop_kelvin_presets_activate      (GtkWidget      *widget,
-                                                         GObject        *config);
-static void      gimp_prop_random_seed_new_clicked      (GtkButton      *button,
-                                                         GtkAdjustment  *adj);
+static gboolean  gimp_prop_kelvin_presets_button_press (GtkWidget      *widget,
+                                                        GdkEventButton *bevent,
+                                                        GtkMenu        *menu);
+static void      gimp_prop_kelvin_presets_activate     (GtkWidget      *widget,
+                                                        GObject        *config);
+static void      gimp_prop_random_seed_new_clicked     (GtkButton      *button,
+                                                        GtkAdjustment  *adj);
 
 
 /*  public functions  */
@@ -168,16 +161,6 @@ gimp_prop_random_seed_new (GObject     *config,
 
 /*  private functions  */
 
-static void
-gimp_prop_kelvin_presets_menu_position (GtkMenu  *menu,
-                                        gint     *x,
-                                        gint     *y,
-                                        gboolean *push_in,
-                                        gpointer  user_data)
-{
-  gimp_button_menu_position (user_data, menu, GTK_POS_LEFT, x, y);
-}
-
 static gboolean
 gimp_prop_kelvin_presets_button_press (GtkWidget      *widget,
                                        GdkEventButton *bevent,
@@ -185,10 +168,10 @@ gimp_prop_kelvin_presets_button_press (GtkWidget      *widget,
 {
   if (bevent->type == GDK_BUTTON_PRESS)
     {
-      gtk_menu_popup (menu,
-                      NULL, NULL,
-                      gimp_prop_kelvin_presets_menu_position, widget,
-                      bevent->button, bevent->time);
+      gtk_menu_popup_at_widget (menu, widget,
+                                GDK_GRAVITY_WEST,
+                                GDK_GRAVITY_NORTH_EAST,
+                                (GdkEvent *) bevent);
     }
 
   return TRUE;
diff --git a/app/widgets/gimpdashboard.c b/app/widgets/gimpdashboard.c
index 7932b62..453bf1a 100644
--- a/app/widgets/gimpdashboard.c
+++ b/app/widgets/gimpdashboard.c
@@ -50,7 +50,6 @@
 #include "gimpmeter.h"
 #include "gimpsessioninfo-aux.h"
 #include "gimpuimanager.h"
-#include "gimpwidgets-utils.h"
 #include "gimpwindowstrategy.h"
 
 #include "gimp-intl.h"
@@ -301,12 +300,6 @@ static void       gimp_dashboard_sample_object               (GimpDashboard
 static void       gimp_dashboard_container_remove            (GtkWidget           *widget,
                                                               GtkContainer        *container);
 
-static void       gimp_dashboard_group_menu_position         (GtkMenu             *menu,
-                                                              gint                *x,
-                                                              gint                *y,
-                                                              gboolean            *push_in,
-                                                              gpointer             user_data);
-
 static void       gimp_dashboard_update_groups               (GimpDashboard       *dashboard);
 static void       gimp_dashboard_update_group                (GimpDashboard       *dashboard,
                                                               Group                group);
@@ -1256,11 +1249,11 @@ gimp_dashboard_group_expander_button_press (GimpDashboard  *dashboard,
       bevent->y >= allocation.y                    &&
       bevent->y <  allocation.y + allocation.height)
     {
-      gtk_menu_popup (group_data->menu,
-                      NULL, NULL,
-                      gimp_dashboard_group_menu_position,
-                      group_data->menu_button,
-                      bevent->button, bevent->time);
+      gtk_menu_popup_at_widget (group_data->menu,
+                                group_data->menu_button,
+                                GDK_GRAVITY_WEST,
+                                GDK_GRAVITY_NORTH_EAST,
+                                (GdkEvent *) bevent);
 
       return TRUE;
     }
@@ -1901,16 +1894,6 @@ gimp_dashboard_container_remove (GtkWidget    *widget,
 }
 
 static void
-gimp_dashboard_group_menu_position (GtkMenu  *menu,
-                                    gint     *x,
-                                    gint     *y,
-                                    gboolean *push_in,
-                                    gpointer  user_data)
-{
-  gimp_button_menu_position (user_data, menu, GTK_POS_LEFT, x, y);
-}
-
-static void
 gimp_dashboard_update_groups (GimpDashboard *dashboard)
 {
   Group group;
diff --git a/app/widgets/gimpsettingsbox.c b/app/widgets/gimpsettingsbox.c
index 9609623..a56e319 100644
--- a/app/widgets/gimpsettingsbox.c
+++ b/app/widgets/gimpsettingsbox.c
@@ -39,7 +39,6 @@
 #include "gimpcontainerview.h"
 #include "gimpsettingsbox.h"
 #include "gimpsettingseditor.h"
-#include "gimpwidgets-utils.h"
 
 #include "gimp-intl.h"
 
@@ -575,16 +574,6 @@ gimp_settings_box_setting_selected (GimpContainerView *view,
     }
 }
 
-static void
-gimp_settings_box_menu_position (GtkMenu  *menu,
-                                 gint     *x,
-                                 gint     *y,
-                                 gboolean *push_in,
-                                 gpointer  user_data)
-{
-  gimp_button_menu_position (user_data, menu, GTK_POS_LEFT, x, y);
-}
-
 static gboolean
 gimp_settings_box_menu_press (GtkWidget       *widget,
                               GdkEventButton  *bevent,
@@ -594,10 +583,10 @@ gimp_settings_box_menu_press (GtkWidget       *widget,
 
   if (bevent->type == GDK_BUTTON_PRESS)
     {
-      gtk_menu_popup (GTK_MENU (private->menu),
-                      NULL, NULL,
-                      gimp_settings_box_menu_position, widget,
-                      bevent->button, bevent->time);
+      gtk_menu_popup_at_widget (GTK_MENU (private->menu), widget,
+                                GDK_GRAVITY_WEST,
+                                GDK_GRAVITY_NORTH_EAST,
+                                (GdkEvent *) bevent);
     }
 
   return TRUE;
diff --git a/libgimpwidgets/gimpcolorbutton.c b/libgimpwidgets/gimpcolorbutton.c
index aa4ae21..67427a8 100644
--- a/libgimpwidgets/gimpcolorbutton.c
+++ b/libgimpwidgets/gimpcolorbutton.c
@@ -535,9 +535,7 @@ gimp_color_button_button_press (GtkWidget      *widget,
 
       gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget));
 
-      gtk_menu_popup (GTK_MENU (menu),
-                      NULL, NULL, NULL, NULL,
-                      bevent->button, bevent->time);
+      gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) bevent);
     }
 
   return GTK_WIDGET_CLASS (parent_class)->button_press_event (widget, bevent);
diff --git a/libgimpwidgets/gimppreviewarea.c b/libgimpwidgets/gimppreviewarea.c
index 254ca28..a5b00e8 100644
--- a/libgimpwidgets/gimppreviewarea.c
+++ b/libgimpwidgets/gimppreviewarea.c
@@ -1946,10 +1946,5 @@ gimp_preview_area_menu_popup (GimpPreviewArea *area,
   gtk_menu_shell_append (GTK_MENU_SHELL (menu),
                          gimp_preview_area_menu_new (area, "check-size"));
 
-  if (event)
-    gtk_menu_popup (GTK_MENU (menu),
-                    NULL, NULL, NULL, NULL, event->button, event->time);
-  else
-    gtk_menu_popup (GTK_MENU (menu),
-                    NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time ());
+  gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
 }
diff --git a/plug-ins/common/animation-play.c b/plug-ins/common/animation-play.c
index 579cb57..602258f 100644
--- a/plug-ins/common/animation-play.c
+++ b/plug-ins/common/animation-play.c
@@ -305,10 +305,7 @@ popup_menu (GtkWidget      *widget,
   GtkWidget *menu = gtk_ui_manager_get_widget (ui_manager, "/anim-play-popup");
 
   gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget));
-  gtk_menu_popup (GTK_MENU (menu),
-                  NULL, NULL, NULL, NULL,
-                  event ? event->button : 0,
-                  event ? event->time   : gtk_get_current_event_time ());
+  gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
 
   return TRUE;
 }
diff --git a/plug-ins/common/colormap-remap.c b/plug-ins/common/colormap-remap.c
index 6ee8d83..8c67e08 100644
--- a/plug-ins/common/colormap-remap.c
+++ b/plug-ins/common/colormap-remap.c
@@ -557,10 +557,7 @@ remap_popup_menu (GtkWidget      *widget,
   GtkWidget *menu = gtk_ui_manager_get_widget (remap_ui, "/remap-popup");
 
   gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget));
-  gtk_menu_popup (GTK_MENU (menu),
-                  NULL, NULL, NULL, NULL,
-                  event ? event->button : 0,
-                  event ? event->time   : gtk_get_current_event_time ());
+  gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
 
   return TRUE;
 }
diff --git a/plug-ins/help-browser/dialog.c b/plug-ins/help-browser/dialog.c
index beb9de9..095ce0f 100644
--- a/plug-ins/help-browser/dialog.c
+++ b/plug-ins/help-browser/dialog.c
@@ -1058,10 +1058,7 @@ view_popup_menu (GtkWidget      *widget,
   menu = gtk_ui_manager_get_widget (ui_manager, path);
 
   gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget));
-  gtk_menu_popup (GTK_MENU (menu),
-                  NULL, NULL, NULL, NULL,
-                  event ? event->button : 0,
-                  event ? event->time   : gtk_get_current_event_time ());
+  gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
 
   return TRUE;
 }
diff --git a/plug-ins/ifs-compose/ifs-compose.c b/plug-ins/ifs-compose/ifs-compose.c
index ffad802..1bf98f1 100644
--- a/plug-ins/ifs-compose/ifs-compose.c
+++ b/plug-ins/ifs-compose/ifs-compose.c
@@ -1593,9 +1593,7 @@ design_area_button_press (GtkWidget      *widget,
 
       gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget));
 
-      gtk_menu_popup (GTK_MENU (menu),
-                      NULL, NULL, NULL, NULL,
-                      event->button, event->time);
+      gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
 
       return FALSE;
     }
diff --git a/plug-ins/imagemap/imap_menu.c b/plug-ins/imagemap/imap_menu.c
index c184319..8185d5c 100644
--- a/plug-ins/imagemap/imap_menu.c
+++ b/plug-ins/imagemap/imap_menu.c
@@ -493,8 +493,8 @@ void
 do_main_popup_menu(GdkEventButton *event)
 {
   GtkWidget *popup = gtk_ui_manager_get_widget (ui_manager, "/PopupMenu");
-  gtk_menu_popup (GTK_MENU (popup), NULL, NULL, NULL, NULL,
-                  event->button, event->time);
+
+  gtk_menu_popup_at_pointer (GTK_MENU (popup), (GdkEvent *) event);
 }
 
 void
diff --git a/plug-ins/imagemap/imap_object_popup.c b/plug-ins/imagemap/imap_object_popup.c
index bee4fdb..f3e3b61 100644
--- a/plug-ins/imagemap/imap_object_popup.c
+++ b/plug-ins/imagemap/imap_object_popup.c
@@ -42,8 +42,7 @@ object_handle_popup(ObjectPopup_t *popup, Object_t *obj, GdkEventButton *event)
                             (position < g_list_length(obj->list->list))
                             ? TRUE : FALSE);
 #endif
-   gtk_menu_popup(GTK_MENU(popup->menu), NULL, NULL, NULL, NULL,
-                  event->button, event->time);
+   gtk_menu_popup_at_pointer (GTK_MENU (popup->menu), (GdkEvent *) event);
 }
 
 void
diff --git a/plug-ins/imagemap/imap_polygon.c b/plug-ins/imagemap/imap_polygon.c
index 53d46a8..b30e47b 100644
--- a/plug-ins/imagemap/imap_polygon.c
+++ b/plug-ins/imagemap/imap_polygon.c
@@ -719,8 +719,7 @@ polygon_handle_popup (GdkEventButton *event, gboolean near_sash,
   gtk_widget_set_sensitive (delete, near_sash);
   gtk_widget_set_sensitive (insert, near_edge);
 
-  gtk_menu_popup(GTK_MENU(popup), NULL, NULL, NULL, NULL,
-                 event->button, event->time);
+  gtk_menu_popup_at_pointer (GTK_MENU (popup), (GdkEvent *) event);
 }
 
 static void


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