Ejemplo n.º 1
0
int ZLGtkDialogManager::questionBox(const ZLResourceKey&, const std::string &message, const ZLResourceKey &button0, const ZLResourceKey &button1, const ZLResourceKey &button2) const {
	GtkDialog *dialog = GTK_DIALOG(hildon_note_new_confirmation_add_buttons(myWindow, message.c_str(), 0));

	if (!button0.Name.empty()) {
		gtk_dialog_add_button(dialog, gtkButtonName(button0).c_str(), 0);
	}
	if (!button1.Name.empty()) {
		gtk_dialog_add_button(dialog, gtkButtonName(button1).c_str(), 1);
	}
	if (!button2.Name.empty()) {
		gtk_dialog_add_button(dialog, gtkButtonName(button2).c_str(), 2);
	}

	gint response = gtk_dialog_run(dialog);

	gtk_widget_destroy(GTK_WIDGET(dialog));

	return response == GTK_RESPONSE_REJECT ? -1 : response;
}
Ejemplo n.º 2
0
void
dates_delete_cb (GtkWidget *source, DatesData *d)
{
    ECalComponentText summary;
    GtkWidget *widget;
    const char *orig_value;
    char *value;
#ifdef WITH_HILDON
    gchar *tmp;
#endif

    e_cal_component_get_summary (d->comp, &summary);
    widget = d->details_dialog;
    if (GTK_WIDGET_VISIBLE (widget))
	orig_value = gtk_entry_get_text (GTK_ENTRY (d->details_summary_entry));
    else if (summary.value)
	orig_value = summary.value;
    else if (summary.altrep)
	orig_value = summary.altrep;
    else {
	g_warning ("Deleting event with no summary");
	orig_value = _("Unknown event");
    }

    value = str_truncate (orig_value, 50);

#ifdef WITH_HILDON
    tmp = g_strdup_printf(_("Are you sure you want to delete event '%s'?"), value);
    widget = hildon_note_new_confirmation_add_buttons(
        GTK_WINDOW (d->main_window),
        tmp,
        _("Keep event"), GTK_RESPONSE_NO,
        _("Delete event"), GTK_RESPONSE_YES,
        NULL);
    g_free(tmp);
#else
    widget = gtk_message_dialog_new (
	GTK_WINDOW (d->main_window),
	GTK_DIALOG_MODAL,
	GTK_MESSAGE_QUESTION,
	GTK_BUTTONS_NONE,
	_("Are you sure you want to delete event '%s'?"),
	value);
    gtk_dialog_add_buttons (GTK_DIALOG (widget),
			    _("Keep event"), GTK_RESPONSE_NO,
			    _("Delete event"), GTK_RESPONSE_YES,
			    NULL);
#endif
    if (gtk_dialog_run (GTK_DIALOG (widget)) == GTK_RESPONSE_YES) {
	/* Reset event type, in case this was a new event */
	d->event_type = NORMAL;
		
	if (d->waiting == NONE) {
	    const char *uid = NULL;
	    e_cal_component_get_uid (d->comp, &uid);
	    e_cal_remove_object (d->cal, uid, NULL);

	    /* Hide the details dialog, in case we deleted
	     * from there.
	     */
	    dates_platform_details_dlg (d, FALSE);
	} else {
	    d->widgets = contacts_set_widgets_desensitive (
		d->details_dialog);
	    d->waiting = PENDING_DELETE;
	}
    }
	
    gtk_widget_destroy (widget);
    g_free (value);
}