pidgin/gtkutils.c

changeset 38833
47a8f1e4c414
parent 38827
3573c82d32d8
parent 38709
6c80734ca3b4
child 38993
7ea9422c67f3
equal deleted inserted replaced
38832:7ad7854d8e60 38833:47a8f1e4c414
1181 gint *y, 1181 gint *y,
1182 gboolean *push_in, 1182 gboolean *push_in,
1183 gpointer data) 1183 gpointer data)
1184 { 1184 {
1185 GtkWidget *widget; 1185 GtkWidget *widget;
1186 GtkStyleContext *context;
1187 GtkRequisition requisition; 1186 GtkRequisition requisition;
1188 GdkScreen *screen; 1187 GdkScreen *screen;
1189 GdkRectangle monitor; 1188 GdkRectangle monitor;
1190 gint monitor_num; 1189 gint monitor_num;
1191 gint space_left, space_right, space_above, space_below; 1190 gint space_left, space_right, space_above, space_below;
1307 *y = monitor.y; 1306 *y = monitor.y;
1308 } 1307 }
1309 } 1308 }
1310 1309
1311 1310
1312 void 1311 #if !GTK_CHECK_VERSION(3,22,0)
1312 static void
1313 pidgin_treeview_popup_menu_position_func(GtkMenu *menu, 1313 pidgin_treeview_popup_menu_position_func(GtkMenu *menu,
1314 gint *x, 1314 gint *x,
1315 gint *y, 1315 gint *y,
1316 gboolean *push_in, 1316 gboolean *push_in,
1317 gpointer data) 1317 gpointer data)
1328 1328
1329 *x += rect.x+rect.width; 1329 *x += rect.x+rect.width;
1330 *y += rect.y + rect.height; 1330 *y += rect.y + rect.height;
1331 pidgin_menu_position_func_helper(menu, x, y, push_in, data); 1331 pidgin_menu_position_func_helper(menu, x, y, push_in, data);
1332 } 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
1333 1363
1334 static void dnd_image_ok_callback(_DndData *data, int choice) 1364 static void dnd_image_ok_callback(_DndData *data, int choice)
1335 { 1365 {
1336 const gchar *shortname; 1366 const gchar *shortname;
1337 gchar *filedata; 1367 gchar *filedata;

mercurial