diff options
author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2023-03-22 03:22:12 -0500 |
---|---|---|
committer | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2023-03-22 03:22:12 -0500 |
commit | 86de07b44f35f87da9d9105b209bde632d368671 (patch) | |
tree | 1a0b9bf7243bce157646a9977f2ec84a2fc98aab | |
parent | 08482043fc1f5ce69bb669dd24e17107b94d346f (diff) | |
download | pidgin-86de07b44f35f87da9d9105b209bde632d368671.tar.gz |
Move whiteboard clearing to AdwMessageDialog
As `GtkMessageDialog` is being deprecated.
Testing Done:
Compiled only.
Reviewed at https://reviews.imfreedom.org/r/2378/
-rw-r--r-- | pidgin/gtkwhiteboard.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/pidgin/gtkwhiteboard.c b/pidgin/gtkwhiteboard.c index f7d4e60767..74fbf9ed5b 100644 --- a/pidgin/gtkwhiteboard.c +++ b/pidgin/gtkwhiteboard.c @@ -24,6 +24,7 @@ #include <glib/gi18n-lib.h> #include <gtk/gtk.h> +#include <adwaita.h> #include <math.h> #ifndef M_PI @@ -354,18 +355,19 @@ static void pidgin_whiteboard_clear(PurpleWhiteboard *wb) } static void -pidgin_whiteboard_clear_response(GtkDialog *self, gint response, gpointer data) +pidgin_whiteboard_clear_response(G_GNUC_UNUSED AdwMessageDialog *self, + char *response, gpointer data) { PidginWhiteboard *gtkwb = (PidginWhiteboard *)data; - if(response == GTK_RESPONSE_YES) { - pidgin_whiteboard_clear(gtkwb->wb); - - /* Do protocol specific clearing procedures */ - purple_whiteboard_send_clear(gtkwb->wb); + if(!purple_strequal(response, "yes")) { + return; } - gtk_window_destroy(GTK_WINDOW(self)); + pidgin_whiteboard_clear(gtkwb->wb); + + /* Do protocol specific clearing procedures */ + purple_whiteboard_send_clear(gtkwb->wb); } static void @@ -373,17 +375,26 @@ pidgin_whiteboard_button_clear_press(G_GNUC_UNUSED GtkWidget *widget, gpointer data) { PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data); + AdwMessageDialog *dialog = NULL; /* Confirm whether the user really wants to clear */ - GtkWidget *dialog = gtk_message_dialog_new( - GTK_WINDOW(gtkwb), GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", - _("Do you really want to clear?")); + dialog = ADW_MESSAGE_DIALOG(adw_message_dialog_new( + GTK_WINDOW(gtkwb), + _("Clear whiteboard?"), + _("Do you want to clear this whiteboard?"))); + + adw_message_dialog_add_responses(dialog, "no", _("_No"), "yes", _("_Yes"), + NULL); + adw_message_dialog_set_response_appearance(dialog, "yes", + ADW_RESPONSE_DESTRUCTIVE); + adw_message_dialog_set_default_response(dialog, "yes"); + adw_message_dialog_set_close_response(dialog, "no"); g_signal_connect(dialog, "response", G_CALLBACK(pidgin_whiteboard_clear_response), gtkwb); - gtk_widget_show(dialog); + gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); + gtk_window_present_with_time(GTK_WINDOW(dialog), GDK_CURRENT_TIME); } static void |