event-editor-dialog: Port to new callback-based ask API
This commit is contained in:
@@ -943,97 +943,6 @@ is_source_enabled (ESource *source)
|
||||
return e_source_selectable_get_selected (selectable);
|
||||
}
|
||||
|
||||
static void
|
||||
on_dialog_response_cb (GtkDialog *dialog,
|
||||
gint response,
|
||||
gint *out_response)
|
||||
{
|
||||
*out_response = response;
|
||||
}
|
||||
|
||||
/**
|
||||
* ask_recurrence_modification_type:
|
||||
* @parent: a #GtkWidget
|
||||
* @modtype: an #ECalObjModType
|
||||
* @source: an #ESource
|
||||
*
|
||||
* Assigns the appropriate modtype while modifying an event
|
||||
* based on user's choice in the GtkMessageDialog that pops up.
|
||||
* The modtype helps the user choose the part of recurrent events
|
||||
* to modify. Such as Only This Event, Subsequent events
|
||||
* or All events.
|
||||
*
|
||||
* Returns: %TRUE if user chooses appropriate option and
|
||||
* @modtype is assigned, %FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
ask_recurrence_modification_type (GtkWidget *parent,
|
||||
GcalRecurrenceModType *modtype,
|
||||
GcalCalendar *calendar)
|
||||
{
|
||||
GtkDialogFlags flags;
|
||||
ECalClient *client;
|
||||
GtkWidget *dialog;
|
||||
gboolean is_set;
|
||||
gint result = 0;
|
||||
|
||||
flags = GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT;
|
||||
*modtype = GCAL_RECURRENCE_MOD_THIS_ONLY;
|
||||
|
||||
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 (calendar);
|
||||
|
||||
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_dialog_response_cb), &result);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
|
||||
while (result == 0)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
is_set = FALSE;
|
||||
break;
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
*modtype = GCAL_RECURRENCE_MOD_THIS_ONLY;
|
||||
is_set = TRUE;
|
||||
break;
|
||||
case GTK_RESPONSE_OK:
|
||||
*modtype = GCAL_RECURRENCE_MOD_THIS_AND_FUTURE;
|
||||
is_set = TRUE;
|
||||
break;
|
||||
case GTK_RESPONSE_YES:
|
||||
*modtype = GCAL_RECURRENCE_MOD_ALL;
|
||||
is_set = TRUE;
|
||||
break;
|
||||
default:
|
||||
is_set = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
|
||||
return is_set;
|
||||
}
|
||||
|
||||
struct
|
||||
{
|
||||
const gchar *territory;
|
||||
|
||||
@@ -114,10 +114,6 @@ gboolean should_change_date_for_scroll (gdouble
|
||||
|
||||
gboolean is_source_enabled (ESource *source);
|
||||
|
||||
gboolean ask_recurrence_modification_type (GtkWidget *parent,
|
||||
GcalRecurrenceModType *modtype,
|
||||
GcalCalendar *calendar);
|
||||
|
||||
gboolean is_workday (guint day);
|
||||
|
||||
GList* filter_children_by_uid_and_modtype (GtkWidget *widget,
|
||||
|
||||
Reference in New Issue
Block a user