Reimplement event drag n' drop
Reintroduce the code using GTK4 tooling for in-process DnD. This is looking much better!
This commit is contained in:
@@ -1332,3 +1332,86 @@ out:
|
||||
if (out_meeting_url)
|
||||
*out_meeting_url = g_steal_pointer (&meeting_url);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GcalEvent *event;
|
||||
GcalAskRecurrenceCallback callback;
|
||||
gpointer user_data;
|
||||
} AskRecurrenceData;
|
||||
|
||||
static void
|
||||
on_message_dialog_response_cb (GtkDialog *dialog,
|
||||
gint 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));
|
||||
|
||||
data->callback (data->event, mod_type, data->user_data);
|
||||
g_clear_object (&data->event);
|
||||
g_clear_pointer (&data, g_free);
|
||||
}
|
||||
|
||||
void
|
||||
gcal_utils_ask_recurrence_modification_type (GtkWidget *parent,
|
||||
GcalEvent *event,
|
||||
GcalAskRecurrenceCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
AskRecurrenceData *data;
|
||||
GtkDialogFlags flags;
|
||||
ECalClient *client;
|
||||
GtkWidget *dialog;
|
||||
|
||||
data = g_new0 (AskRecurrenceData, 1);
|
||||
data->event = g_object_ref (event);
|
||||
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,
|
||||
_("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);
|
||||
|
||||
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);
|
||||
|
||||
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)));
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (on_message_dialog_response_cb), data);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user