[gnome-calendar/wip/cdavis/use-adw-message-dialog] gcal-utils: Use AdwMessageDialog
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/cdavis/use-adw-message-dialog] gcal-utils: Use AdwMessageDialog
- Date: Wed, 6 Jul 2022 22:28:26 +0000 (UTC)
commit 5f747b694c62a521627ac90d6c119c65e9f5d6bd
Author: Christopher Davis <christopherdavis gnome org>
Date: Wed Jul 6 18:26:44 2022 -0400
gcal-utils: Use AdwMessageDialog
Use the new adaptive AdwMessageDialog widget
where we previously used GtkMessageDialog.
src/utils/gcal-utils.c | 53 +++++++++++++++++---------------------------------
1 file changed, 18 insertions(+), 35 deletions(-)
---
diff --git a/src/utils/gcal-utils.c b/src/utils/gcal-utils.c
index 2b9f26f3..da4e5bdb 100644
--- a/src/utils/gcal-utils.c
+++ b/src/utils/gcal-utils.c
@@ -1264,29 +1264,19 @@ typedef struct
static void
on_message_dialog_response_cb (GtkDialog *dialog,
- gint response,
+ char *response,
AskRecurrenceData *data)
{
GcalRecurrenceModType mod_type;
- switch (response)
- {
- case GTK_RESPONSE_CANCEL:
- mod_type = GCAL_RECURRENCE_MOD_NONE;
- break;
- case GTK_RESPONSE_ACCEPT:
- mod_type = GCAL_RECURRENCE_MOD_THIS_ONLY;
- break;
- case GTK_RESPONSE_OK:
- mod_type = GCAL_RECURRENCE_MOD_THIS_AND_FUTURE;
- break;
- case GTK_RESPONSE_YES:
- mod_type = GCAL_RECURRENCE_MOD_ALL;
- break;
- default:
- mod_type = GCAL_RECURRENCE_MOD_NONE;
- break;
- }
+ if (g_strcmp0 (response, "this-only"))
+ mod_type = GCAL_RECURRENCE_MOD_THIS_ONLY;
+ else if (g_strcmp0 (response, "subsequent-events"))
+ mod_type = GCAL_RECURRENCE_MOD_THIS_AND_FUTURE;
+ else if (g_strcmp0 (response, "all-events"))
+ mod_type = GCAL_RECURRENCE_MOD_ALL;
+ else
+ mod_type = GCAL_RECURRENCE_MOD_NONE;
gtk_window_destroy (GTK_WINDOW (dialog));
@@ -1302,7 +1292,6 @@ gcal_utils_ask_recurrence_modification_type (GtkWidget *parent,
gpointer user_data)
{
AskRecurrenceData *data;
- GtkDialogFlags flags;
ECalClient *client;
GtkWidget *dialog;
@@ -1311,28 +1300,22 @@ gcal_utils_ask_recurrence_modification_type (GtkWidget *parent,
data->callback = callback;
data->user_data = user_data;
- flags = GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_native (parent)),
- flags,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
+ dialog = adw_message_dialog_new (GTK_WINDOW (gtk_widget_get_native (parent)),
+ NULL,
_("The event you are trying to modify is recurring. The changes you have
selected should be applied to:"));
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- _("_Cancel"),
- GTK_RESPONSE_CANCEL,
- _("_Only This Event"),
- GTK_RESPONSE_ACCEPT,
- NULL);
+ adw_message_dialog_add_responses (ADW_MESSAGE_DIALOG (dialog),
+ "cancel", _("_Cancel"),
+ "this-only", _("_Only This Event"),
+ NULL);
client = gcal_calendar_get_client (gcal_event_get_calendar (event));
if (!e_client_check_capability (E_CLIENT (client), E_CAL_STATIC_CAPABILITY_NO_THISANDFUTURE))
- gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Subsequent events"), GTK_RESPONSE_OK);
+ adw_message_dialog_add_response (ADW_MESSAGE_DIALOG (dialog), "subsequent-events", _("_Subsequent
events"));
- gtk_dialog_add_button (GTK_DIALOG (dialog), _("_All events"), GTK_RESPONSE_YES);
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (gtk_widget_get_native (parent)));
+ adw_message_dialog_add_response (ADW_MESSAGE_DIALOG (dialog), "all-events", _("_All events"));
+ adw_message_dialog_set_close_response (ADW_MESSAGE_DIALOG (dialog), "cancel");
g_signal_connect (dialog, "response", G_CALLBACK (on_message_dialog_response_cb), data);
gtk_window_present (GTK_WINDOW (dialog));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]