Skip to content

Commit c4777b0

Browse files
raveit65raveit65
authored andcommitted
eel-gtk-extensions: replace deprecated gtk_menu_popup function
1 parent 42e5c91 commit c4777b0

5 files changed

Lines changed: 8 additions & 54 deletions

File tree

eel/eel-gtk-extensions.c

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -287,43 +287,12 @@ eel_gtk_window_set_initial_geometry_from_string (GtkWindow *window,
287287
* @event: The event that invoked this popup menu.
288288
**/
289289
void
290-
eel_pop_up_context_menu (GtkMenu *menu,
291-
gint16 offset_x,
292-
gint16 offset_y,
290+
eel_pop_up_context_menu (GtkMenu *menu,
293291
GdkEventButton *event)
294292
{
295-
GdkPoint offset;
296-
int button;
297-
298293
g_return_if_fail (GTK_IS_MENU (menu));
299294

300-
offset.x = offset_x;
301-
offset.y = offset_y;
302-
303-
/* The event button needs to be 0 if we're popping up this menu from
304-
* a button release, else a 2nd click outside the menu with any button
305-
* other than the one that invoked the menu will be ignored (instead
306-
* of dismissing the menu). This is a subtle fragility of the GTK menu code.
307-
*/
308-
309-
if (event)
310-
{
311-
button = event->type == GDK_BUTTON_RELEASE
312-
? 0
313-
: event->button;
314-
}
315-
else
316-
{
317-
button = 0;
318-
}
319-
320-
gtk_menu_popup (menu, /* menu */
321-
NULL, /* parent_menu_shell */
322-
NULL, /* parent_menu_item */
323-
NULL,
324-
&offset, /* data */
325-
button, /* button */
326-
event ? event->time : GDK_CURRENT_TIME); /* activate_time */
295+
gtk_menu_popup_at_pointer (menu, NULL);
327296

328297
g_object_ref_sink (menu);
329298
g_object_unref (menu);

eel/eel-gtk-extensions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
#include <gtk/gtk.h>
3333
#include <eel/eel-gdk-extensions.h>
3434

35-
#define EEL_DEFAULT_POPUP_MENU_DISPLACEMENT 2
36-
3735
/* GtkWindow */
3836
void eel_gtk_window_set_initial_geometry (GtkWindow *window,
3937
EelGdkGeometryFlags geometry_flags,
@@ -51,8 +49,6 @@ char * eel_gtk_window_get_geometry_string (GtkWindow
5149

5250
/* GtkMenu and GtkMenuItem */
5351
void eel_pop_up_context_menu (GtkMenu *menu,
54-
gint16 offset_x,
55-
gint16 offset_y,
5652
GdkEventButton *event);
5753
GtkMenuItem * eel_gtk_menu_append_separator (GtkMenu *menu);
5854
GtkMenuItem * eel_gtk_menu_insert_separator (GtkMenu *menu,

src/caja-information-panel.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,6 @@ caja_information_panel_press_event (GtkWidget *widget, GdkEventButton *event)
694694
{
695695
menu = caja_information_panel_create_context_menu (information_panel);
696696
eel_pop_up_context_menu (GTK_MENU(menu),
697-
EEL_DEFAULT_POPUP_MENU_DISPLACEMENT,
698-
EEL_DEFAULT_POPUP_MENU_DISPLACEMENT,
699697
event);
700698
}
701699
return TRUE;

src/caja-places-sidebar.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,8 +2791,6 @@ bookmarks_popup_menu (CajaPlacesSidebar *sidebar,
27912791
{
27922792
bookmarks_update_popup_menu (sidebar);
27932793
eel_pop_up_context_menu (GTK_MENU(sidebar->popup_menu),
2794-
EEL_DEFAULT_POPUP_MENU_DISPLACEMENT,
2795-
EEL_DEFAULT_POPUP_MENU_DISPLACEMENT,
27962794
event);
27972795
}
27982796

src/file-manager/fm-directory-view.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9136,10 +9136,8 @@ fm_directory_view_pop_up_selection_context_menu (FMDirectoryView *view,
91369136
update_context_menu_position_from_event (view, event);
91379137

91389138
eel_pop_up_context_menu (create_popup_menu
9139-
(view, FM_DIRECTORY_VIEW_POPUP_PATH_SELECTION),
9140-
EEL_DEFAULT_POPUP_MENU_DISPLACEMENT,
9141-
EEL_DEFAULT_POPUP_MENU_DISPLACEMENT,
9142-
event);
9139+
(view, FM_DIRECTORY_VIEW_POPUP_PATH_SELECTION),
9140+
event);
91439141
}
91449142

91459143
/**
@@ -9164,12 +9162,9 @@ fm_directory_view_pop_up_background_context_menu (FMDirectoryView *view,
91649162

91659163
update_context_menu_position_from_event (view, event);
91669164

9167-
91689165
eel_pop_up_context_menu (create_popup_menu
9169-
(view, FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND),
9170-
EEL_DEFAULT_POPUP_MENU_DISPLACEMENT,
9171-
EEL_DEFAULT_POPUP_MENU_DISPLACEMENT,
9172-
event);
9166+
(view, FM_DIRECTORY_VIEW_POPUP_PATH_BACKGROUND),
9167+
event);
91739168
}
91749169

91759170
static void
@@ -9181,10 +9176,8 @@ real_pop_up_location_context_menu (FMDirectoryView *view)
91819176
update_context_menu_position_from_event (view, view->details->location_popup_event);
91829177

91839178
eel_pop_up_context_menu (create_popup_menu
9184-
(view, FM_DIRECTORY_VIEW_POPUP_PATH_LOCATION),
9185-
EEL_DEFAULT_POPUP_MENU_DISPLACEMENT,
9186-
EEL_DEFAULT_POPUP_MENU_DISPLACEMENT,
9187-
view->details->location_popup_event);
9179+
(view, FM_DIRECTORY_VIEW_POPUP_PATH_LOCATION),
9180+
view->details->location_popup_event);
91889181
}
91899182

91909183
static void

0 commit comments

Comments
 (0)