void board_window_apply_style (window_board_t *win) { /* check if the svg file is there */ if (win->svg) { struct stat buf; if (stat (win->svg, &buf) == -1) { g_free (win->svg); win->svg = NULL; } } /* otherwise set a default */ if (! win->svg) { int i; for (i = 0; svg_files[i] != NULL; i++) { struct stat buf; if (stat (svg_files[i], &buf) != -1) { win->svg = strdup (svg_files[i]); break; } } } if (! win->svg && win->hand_display_style == HAND_DISPLAY_STYLE_CARDS) /* still nothing... */ win->hand_display_style = HAND_DISPLAY_STYLE_TEXT; int h; for (h = 0; h < 4; h++) { hand_display_set_style(win->handdisp[h], win->hand_display_style); } hand_display_set_style(win->table, win->hand_display_style); window_card_set_style (win->hand_display_style); if (win->hand_display_style == HAND_DISPLAY_STYLE_CARDS && win->svg) { hand_display_set_svg (win->svg, win->card_width); } if (win->n_boards) show_board(CUR_BOARD, REDRAW_HANDS); }
static void hand_display_drag_begin (GtkWidget *hand, GdkDragContext *dc, gpointer data /* unused */) { HandDisplay *handdisp = HAND_DISPLAY (hand); assert (handdisp->cur_drag >= 0 && handdisp->cur_drag < 52); handdisp->cards[handdisp->cur_drag] |= HAND_DISPLAY_INVISIBLE_CARD; handdisp->cur_click = -1; redraw_card (hand, handdisp->cur_drag); /* create drag widget */ if (drag_win) { /* should be NULL, but happens sometimes */ gtk_widget_destroy (drag_win); drag_win = NULL; } drag_win = gtk_window_new (GTK_WINDOW_POPUP); GtkWidget *card = hand_display_new (HAND_DISPLAY_MODE_CARD); hand_display_set_style (HAND_DISPLAY (card), handdisp->style); hand_display_card_set_card (HAND_DISPLAY (card), handdisp->cur_drag); gtk_container_add (GTK_CONTAINER (drag_win), card); gtk_drag_set_icon_widget (dc, drag_win, 0, 0); gtk_widget_show_all (drag_win); }