From 2a586e0449415f98891417c321fa4829cab94fba Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Fri, 8 Nov 2024 09:16:30 +0100 Subject: [PATCH] fix last deprecated code Thanks https://stackoverflow.com/questions/70655268/drawing-to-gtk-gdk-drawing-area-with-cairo#70658500 --- src/x49gpng/ui.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/x49gpng/ui.c b/src/x49gpng/ui.c index 5125e25..e6d024c 100644 --- a/src/x49gpng/ui.c +++ b/src/x49gpng/ui.c @@ -1148,11 +1148,9 @@ static gboolean react_to_focus_lost( GtkWidget* widget, GdkEventFocus* event, gp static void ui_open_file_dialog( x49gp_t* x49gp, const char* prompt, GtkFileChooserAction action, char** filename ) { - GtkWidget* dialog; x49gp_ui_t* ui = x49gp->ui; - - dialog = gtk_file_chooser_dialog_new( prompt, GTK_WINDOW( ui->window ), action, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, - GTK_RESPONSE_ACCEPT, NULL ); + GtkWidget* dialog = gtk_file_chooser_dialog_new( prompt, GTK_WINDOW( ui->window ), action, "_Cancel", GTK_RESPONSE_CANCEL, "_Open", + GTK_RESPONSE_ACCEPT, NULL ); gtk_file_chooser_set_local_only( GTK_FILE_CHOOSER( dialog ), true ); gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER( dialog ), false ); @@ -1510,15 +1508,13 @@ static gboolean react_to_key_event( GtkWidget* widget, GdkEventKey* event, gpoin return true; } -static int redraw_lcd( GtkWidget* widget, GdkEventExpose* event, gpointer user_data ) +static int redraw_lcd( GtkWidget* widget, cairo_t* cr, gpointer user_data ) { x49gp_t* x49gp = user_data; x49gp_ui_t* ui = x49gp->ui; - cairo_t* cr = gdk_cairo_create( gtk_widget_get_window( widget ) ); cairo_set_source_surface( cr, ui->lcd_surface, 0, 0 ); cairo_paint( cr ); - cairo_destroy( cr ); return false; }