gcal-utils: Use AdwMessageDialog
Use the new adaptive AdwMessageDialog widget where we previously used GtkMessageDialog.
This commit is contained in:
committed by
Georges Basile Stavracas Neto
parent
3ee8a3ae82
commit
9a9cfb5468
+18
-36
@@ -1260,31 +1260,19 @@ typedef struct
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
on_message_dialog_response_cb (GtkDialog *dialog,
|
on_message_dialog_response_cb (GtkDialog *dialog,
|
||||||
gint response,
|
const gchar *response,
|
||||||
AskRecurrenceData *data)
|
AskRecurrenceData *data)
|
||||||
{
|
{
|
||||||
GcalRecurrenceModType mod_type;
|
GcalRecurrenceModType mod_type;
|
||||||
|
|
||||||
switch (response)
|
if (g_strcmp0 (response, "this-only") == 0)
|
||||||
{
|
mod_type = GCAL_RECURRENCE_MOD_THIS_ONLY;
|
||||||
case GTK_RESPONSE_CANCEL:
|
else if (g_strcmp0 (response, "subsequent-events") == 0)
|
||||||
mod_type = GCAL_RECURRENCE_MOD_NONE;
|
mod_type = GCAL_RECURRENCE_MOD_THIS_AND_FUTURE;
|
||||||
break;
|
else if (g_strcmp0 (response, "all-events") == 0)
|
||||||
case GTK_RESPONSE_ACCEPT:
|
mod_type = GCAL_RECURRENCE_MOD_ALL;
|
||||||
mod_type = GCAL_RECURRENCE_MOD_THIS_ONLY;
|
else
|
||||||
break;
|
mod_type = GCAL_RECURRENCE_MOD_NONE;
|
||||||
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));
|
|
||||||
|
|
||||||
data->callback (data->event, mod_type, data->user_data);
|
data->callback (data->event, mod_type, data->user_data);
|
||||||
g_clear_object (&data->event);
|
g_clear_object (&data->event);
|
||||||
@@ -1299,7 +1287,6 @@ gcal_utils_ask_recurrence_modification_type (GtkWidget *parent,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
AskRecurrenceData *data;
|
AskRecurrenceData *data;
|
||||||
GtkDialogFlags flags;
|
|
||||||
ECalClient *client;
|
ECalClient *client;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
|
||||||
@@ -1308,30 +1295,25 @@ gcal_utils_ask_recurrence_modification_type (GtkWidget *parent,
|
|||||||
data->callback = callback;
|
data->callback = callback;
|
||||||
data->user_data = user_data;
|
data->user_data = user_data;
|
||||||
|
|
||||||
flags = GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT;
|
dialog = adw_message_dialog_new (GTK_WINDOW (gtk_widget_get_native (parent)),
|
||||||
|
_("Modify Multiple Events?"),
|
||||||
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_native (parent)),
|
|
||||||
flags,
|
|
||||||
GTK_MESSAGE_QUESTION,
|
|
||||||
GTK_BUTTONS_NONE,
|
|
||||||
_("The event you are trying to modify is recurring. The changes you have selected should be applied to:"));
|
_("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),
|
adw_message_dialog_add_responses (ADW_MESSAGE_DIALOG (dialog),
|
||||||
_("_Cancel"),
|
"close", _("_Cancel"),
|
||||||
GTK_RESPONSE_CANCEL,
|
"this-only", _("_Only This Event"),
|
||||||
_("_Only This Event"),
|
NULL);
|
||||||
GTK_RESPONSE_ACCEPT,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
client = gcal_calendar_get_client (gcal_event_get_calendar (event));
|
client = gcal_calendar_get_client (gcal_event_get_calendar (event));
|
||||||
|
|
||||||
if (!e_client_check_capability (E_CLIENT (client), E_CAL_STATIC_CAPABILITY_NO_THISANDFUTURE))
|
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)
|
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)));
|
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);
|
g_signal_connect (dialog, "response", G_CALLBACK (on_message_dialog_response_cb), data);
|
||||||
|
|
||||||
gtk_window_present (GTK_WINDOW (dialog));
|
gtk_window_present (GTK_WINDOW (dialog));
|
||||||
|
|||||||
Reference in New Issue
Block a user