[nautilus/wip/cdavis/use-adw-message-dialog: 243/249] eel-stock-dialogs: Remove message dialogs
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/cdavis/use-adw-message-dialog: 243/249] eel-stock-dialogs: Remove message dialogs
- Date: Sat, 6 Aug 2022 18:39:05 +0000 (UTC)
commit 2bfc3f35845ff752b24023ea327dedcf81d13497
Author: Christopher Davis <christopherdavis gnome org>
Date: Wed Jul 6 20:09:53 2022 -0400
eel-stock-dialogs: Remove message dialogs
Now that we have AdwMessageDialog to provide a GNOME-compliant
message dialog API, we don't need the functions from eel.
This commit removes all of the functions for creating
dialogs from eel-stock-dialogs.
eel/eel-stock-dialogs.c | 145 ------------------------------------------------
eel/eel-stock-dialogs.h | 25 ---------
2 files changed, 170 deletions(-)
---
diff --git a/eel/eel-stock-dialogs.c b/eel/eel-stock-dialogs.c
index dbc3ddb53..3446b9d7c 100644
--- a/eel/eel-stock-dialogs.c
+++ b/eel/eel-stock-dialogs.c
@@ -316,148 +316,3 @@ eel_timed_wait_stop (EelCancelCallback cancel_callback,
timed_wait_free (wait);
}
-
-GtkDialog *
-eel_show_simple_dialog (GtkWidget *parent,
- GtkMessageType message_type,
- const char *primary_text,
- const char *secondary_text,
- ...)
-{
- va_list button_title_args;
- const char *button_title;
- GtkWidget *dialog;
- GtkWidget *top_widget, *chosen_parent;
- int response_id;
-
- /* Parent it if asked to. */
- chosen_parent = NULL;
- if (parent != NULL)
- {
- top_widget = GTK_WIDGET (gtk_widget_get_root (parent));
- if (GTK_IS_WINDOW (top_widget))
- {
- chosen_parent = top_widget;
- }
- }
-
- /* Create the dialog. */
- dialog = gtk_message_dialog_new (GTK_WINDOW (chosen_parent),
- GTK_DIALOG_MODAL,
- message_type,
- GTK_BUTTONS_NONE,
- NULL);
-
- g_object_set (dialog,
- "text", primary_text,
- "secondary-text", secondary_text,
- NULL);
-
- va_start (button_title_args, secondary_text);
- response_id = 0;
- while (1)
- {
- button_title = va_arg (button_title_args, const char *);
- if (button_title == NULL)
- {
- break;
- }
- gtk_dialog_add_button (GTK_DIALOG (dialog), button_title, response_id);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), response_id);
- response_id++;
- }
- va_end (button_title_args);
-
- gtk_widget_show (dialog);
-
- return GTK_DIALOG (dialog);
-}
-
-static GtkDialog *
-create_message_dialog (const char *primary_text,
- const char *secondary_text,
- GtkMessageType type,
- GtkButtonsType buttons_type,
- GtkWindow *parent)
-{
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (parent,
- GTK_DIALOG_MODAL,
- type,
- buttons_type,
- NULL);
- if (parent)
- {
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- }
-
- g_object_set (dialog,
- "text", primary_text,
- "secondary-text", secondary_text,
- NULL);
-
- return GTK_DIALOG (dialog);
-}
-
-/**
- * eel_show_yes_no_dialog:
- *
- * Create and show a dialog asking a question with two choices.
- * The caller needs to set up any necessary callbacks
- * for the buttons. Use eel_create_question_dialog instead
- * if any visual changes need to be made, to avoid flashiness.
- * @question: The text of the question.
- * @yes_label: The label of the "yes" button.
- * @no_label: The label of the "no" button.
- * @parent: The parent window for this dialog.
- */
-GtkDialog *
-eel_show_yes_no_dialog (const char *primary_text,
- const char *secondary_text,
- const char *yes_label,
- const char *no_label,
- GtkWindow *parent)
-{
- GtkDialog *dialog = NULL;
- dialog = eel_create_question_dialog (primary_text,
- secondary_text,
- no_label, GTK_RESPONSE_CANCEL,
- yes_label, GTK_RESPONSE_YES,
- GTK_WINDOW (parent));
- gtk_widget_show (GTK_WIDGET (dialog));
- return dialog;
-}
-
-/**
- * eel_create_question_dialog:
- *
- * Create a dialog asking a question with at least two choices.
- * The caller needs to set up any necessary callbacks
- * for the buttons. The dialog is not yet shown, so that the
- * caller can add additional buttons or make other visual changes
- * without causing flashiness.
- * @question: The text of the question.
- * @answer_0: The label of the leftmost button (index 0)
- * @answer_1: The label of the 2nd-to-leftmost button (index 1)
- * @parent: The parent window for this dialog.
- */
-GtkDialog *
-eel_create_question_dialog (const char *primary_text,
- const char *secondary_text,
- const char *answer_1,
- int response_1,
- const char *answer_2,
- int response_2,
- GtkWindow *parent)
-{
- GtkDialog *dialog;
-
- dialog = create_message_dialog (primary_text,
- secondary_text,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- parent);
- gtk_dialog_add_buttons (dialog, answer_1, response_1, answer_2, response_2, NULL);
- return dialog;
-}
diff --git a/eel/eel-stock-dialogs.h b/eel/eel-stock-dialogs.h
index 064afb490..8136735e9 100644
--- a/eel/eel-stock-dialogs.h
+++ b/eel/eel-stock-dialogs.h
@@ -38,28 +38,3 @@ void eel_timed_wait_start_with_duration (int duration,
GtkWindow *parent_window);
void eel_timed_wait_stop (EelCancelCallback cancel_callback,
gpointer callback_data);
-
-/* Basic dialog with buttons. */
-GtkDialog *eel_show_simple_dialog (GtkWidget *parent,
- GtkMessageType message_type,
- const char *primary_text,
- const char *secondary_text,
- ...);
-
-/* Variations on gnome stock dialogs; these do line wrapping, we don't
- * bother with non-parented versions, we allow setting the title,
- * primary, and secondary messages, and we return GtkDialog pointers
- * instead of GtkWidget pointers.
- */
-GtkDialog *eel_show_yes_no_dialog (const char *primary_text,
- const char *secondary_text,
- const char *yes_label,
- const char *no_label,
- GtkWindow *parent);
-GtkDialog *eel_create_question_dialog (const char *primary_text,
- const char *secondary_text,
- const char *answer_one,
- int response_one,
- const char *answer_two,
- int response_two,
- GtkWindow *parent);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]