gcal-utils: Use AdwMessageDialog

Use the new adaptive AdwMessageDialog widget
where we previously used GtkMessageDialog.
This commit is contained in:
Christopher Davis
2023-06-17 18:49:19 -03:00
committed by Georges Basile Stavracas Neto
parent 3ee8a3ae82
commit 9a9cfb5468
+18 -36
View File
@@ -1260,31 +1260,19 @@ typedef struct
static void
on_message_dialog_response_cb (GtkDialog *dialog,
gint response,
const gchar *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;
}
gtk_window_destroy (GTK_WINDOW (dialog));
if (g_strcmp0 (response, "this-only") == 0)
mod_type = GCAL_RECURRENCE_MOD_THIS_ONLY;
else if (g_strcmp0 (response, "subsequent-events") == 0)
mod_type = GCAL_RECURRENCE_MOD_THIS_AND_FUTURE;
else if (g_strcmp0 (response, "all-events") == 0)
mod_type = GCAL_RECURRENCE_MOD_ALL;
else
mod_type = GCAL_RECURRENCE_MOD_NONE;
data->callback (data->event, mod_type, data->user_data);
g_clear_object (&data->event);
@@ -1299,7 +1287,6 @@ gcal_utils_ask_recurrence_modification_type (GtkWidget *parent,
gpointer user_data)
{
AskRecurrenceData *data;
GtkDialogFlags flags;
ECalClient *client;
GtkWidget *dialog;
@@ -1308,30 +1295,25 @@ 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)),
_("Modify Multiple Events?"),
_("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),
"close", _("_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"));
if (show_mod_all)
gtk_dialog_add_button (GTK_DIALOG (dialog), _("_All events"), GTK_RESPONSE_YES);
adw_message_dialog_add_response (ADW_MESSAGE_DIALOG (dialog), "all-events", _("_All Events"));
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (gtk_widget_get_native (parent)));
g_signal_connect (dialog, "response", G_CALLBACK (on_message_dialog_response_cb), data);
gtk_window_present (GTK_WINDOW (dialog));