pidgin/gtkutils.c

changeset 38709
6c80734ca3b4
parent 38650
1b4854036b36
child 38833
47a8f1e4c414
equal deleted inserted replaced
38708:a65157d76fee 38709:6c80734ca3b4
1306 *y = monitor.y; 1306 *y = monitor.y;
1307 } 1307 }
1308 } 1308 }
1309 1309
1310 1310
1311 void 1311 #if !GTK_CHECK_VERSION(3,22,0)
1312 static void
1312 pidgin_treeview_popup_menu_position_func(GtkMenu *menu, 1313 pidgin_treeview_popup_menu_position_func(GtkMenu *menu,
1313 gint *x, 1314 gint *x,
1314 gint *y, 1315 gint *y,
1315 gboolean *push_in, 1316 gboolean *push_in,
1316 gpointer data) 1317 gpointer data)
1327 1328
1328 *x += rect.x+rect.width; 1329 *x += rect.x+rect.width;
1329 *y += rect.y + rect.height; 1330 *y += rect.y + rect.height;
1330 pidgin_menu_position_func_helper(menu, x, y, push_in, data); 1331 pidgin_menu_position_func_helper(menu, x, y, push_in, data);
1331 } 1332 }
1333 #endif
1334
1335
1336 void
1337 pidgin_menu_popup_at_treeview_selection(GtkWidget *menu, GtkWidget *treeview)
1338 {
1339 #if GTK_CHECK_VERSION(3,22,0)
1340 GtkTreePath *path;
1341 GtkTreeViewColumn *column;
1342 GdkWindow *bin_window;
1343 GdkRectangle rect;
1344
1345 gtk_tree_view_get_cursor(GTK_TREE_VIEW(treeview), &path, &column);
1346 g_return_if_fail(path != NULL);
1347 if (column == NULL)
1348 column = gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), 0);
1349 bin_window = gtk_tree_view_get_bin_window(GTK_TREE_VIEW(treeview));
1350 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(treeview), path, column, &rect);
1351 gtk_menu_popup_at_rect(GTK_MENU(menu), bin_window, &rect,
1352 GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST,
1353 NULL);
1354
1355 gtk_tree_path_free(path);
1356 #else
1357 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
1358 pidgin_treeview_popup_menu_position_func, treeview,
1359 0, GDK_CURRENT_TIME);
1360 #endif
1361 }
1362
1332 1363
1333 static void dnd_image_ok_callback(_DndData *data, int choice) 1364 static void dnd_image_ok_callback(_DndData *data, int choice)
1334 { 1365 {
1335 const gchar *shortname; 1366 const gchar *shortname;
1336 gchar *filedata; 1367 gchar *filedata;

mercurial