From 184285174106e1153577287dc0a2c01b761f44af Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 20:31:30 -0500 Subject: color/filesel: ignore deprecations and fix signal handlers These dialogs still use the old GtkDialog-based API. --- src/color.c | 19 ++++++++++--------- src/fileselection.c | 8 +++----- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/color.c b/src/color.c index 667c1ad..d1f7c8e 100644 --- a/src/color.c +++ b/src/color.c @@ -30,9 +30,12 @@ #include "zenity.h" #include +/* TODO: port to GtkColorDialog */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + static ZenityData *zen_data; -static void zenity_colorselection_dialog_response (GtkWidget *widget, char *rstr, gpointer data); +static void zenity_colorselection_dialog_response (GtkWidget *widget, int response, gpointer data); void zenity_colorselection (ZenityData *data, ZenityColorData *color_data) @@ -44,10 +47,7 @@ zenity_colorselection (ZenityData *data, ZenityColorData *color_data) dialog = gtk_color_chooser_dialog_new (data->dialog_title, NULL); - g_signal_connect (G_OBJECT (dialog), - "response", - G_CALLBACK (zenity_colorselection_dialog_response), - color_data); + g_signal_connect (dialog, "response", G_CALLBACK (zenity_colorselection_dialog_response), color_data); if (color_data->color && gdk_rgba_parse (&color, color_data->color)) @@ -76,20 +76,19 @@ zenity_colorselection (ZenityData *data, ZenityColorData *color_data) } static void -zenity_colorselection_dialog_response (GtkWidget *widget, char *rstr, gpointer data) +zenity_colorselection_dialog_response (GtkWidget *widget, int response, gpointer data) { GdkRGBA color; - ZenityExitCode response = zenity_util_parse_dialog_response (rstr); switch (response) { - case ZENITY_OK: + case GTK_RESPONSE_OK: zenity_util_exit_code_with_data (ZENITY_OK, zen_data); gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &color); g_print ("%s\n", gdk_rgba_to_string (&color)); break; - case ZENITY_CANCEL: + case GTK_RESPONSE_CANCEL: zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL); break; @@ -102,3 +101,5 @@ zenity_colorselection_dialog_response (GtkWidget *widget, char *rstr, gpointer d } zenity_util_gapp_quit (GTK_WINDOW(widget), zen_data); } + +G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/src/fileselection.c b/src/fileselection.c index 4cf544d..cf6a481 100644 --- a/src/fileselection.c +++ b/src/fileselection.c @@ -31,14 +31,13 @@ #include -/* GtkFileChooser deprecated in 4.10, but we want to maintain backwards - * compatibility with GTK 4.0. +/* TODO: port to GtkFileDialog. */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS static ZenityData *zen_data; -static void zenity_fileselection_dialog_response (GtkWidget *widget, char *rstr, gpointer data); +static void zenity_fileselection_dialog_response (GtkWidget *widget, int response, gpointer data); void zenity_fileselection (ZenityData *data, ZenityFileData *file_data) @@ -182,11 +181,10 @@ zenity_fileselection_dialog_output (GtkFileChooser *chooser, } static void -zenity_fileselection_dialog_response (GtkWidget *widget, char *rstr, gpointer data) +zenity_fileselection_dialog_response (GtkWidget *widget, int response, gpointer data) { ZenityFileData *file_data = data; GtkFileChooser *chooser = GTK_FILE_CHOOSER (widget); - ZenityExitCode response = zenity_util_parse_dialog_response (rstr); switch (response) { -- cgit v1.2.1