summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLogan Rathbone <poprocks@gmail.com>2023-01-24 20:31:30 -0500
committerLogan Rathbone <poprocks@gmail.com>2023-01-24 20:31:30 -0500
commit184285174106e1153577287dc0a2c01b761f44af (patch)
treebcb20e29d0a9d5681d15e997c2f0e7dbd560abdc /src
parent9c5bcb6591f7c15e354eee509989454ebb29236c (diff)
downloadzenity-184285174106e1153577287dc0a2c01b761f44af.tar.gz
color/filesel: ignore deprecations and fix signal handlers
These dialogs still use the old GtkDialog-based API.
Diffstat (limited to 'src')
-rw-r--r--src/color.c19
-rw-r--r--src/fileselection.c8
2 files changed, 13 insertions, 14 deletions
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 <string.h>
+/* 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 <config.h>
-/* 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)
{