diff options
author | Kartikeya Sharma <09kartikeya@gmail.com> | 2017-03-04 20:37:27 +0530 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2017-03-08 17:17:01 +0100 |
commit | 460235b9c9ec414f82b3cf872118c1a51773c978 (patch) | |
tree | fc2d8ced4463d559095388c4bd6239a4ae9783f1 | |
parent | f72f5f3c9d810b4d6e80926815526eb37a213c40 (diff) | |
download | nautilus-460235b9c9ec414f82b3cf872118c1a51773c978.tar.gz |
ui-utilities: Add custom function to display error dialog
Most of the things in eel are already in glib, or are already easy
enough to have them directly in the code. So we should remove eel which
is just another layer of abstraction that we don't need as it makes
it hard to follow the code.
This patch adds function to show error dialog (show_error_dialog)
which is to be used in place of eel_show_error_dialog.
https://bugzilla.gnome.org/show_bug.cgi?id=775092
-rw-r--r-- | src/nautilus-file-operations.c | 14 | ||||
-rw-r--r-- | src/nautilus-ui-utilities.c | 28 | ||||
-rw-r--r-- | src/nautilus-ui-utilities.h | 4 |
3 files changed, 39 insertions, 7 deletions
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c index d25a93a53..125be8d55 100644 --- a/src/nautilus-file-operations.c +++ b/src/nautilus-file-operations.c @@ -41,7 +41,6 @@ #include <eel/eel-glib-extensions.h> #include <eel/eel-gtk-extensions.h> -#include <eel/eel-stock-dialogs.h> #include <eel/eel-vfs-extensions.h> #include <glib/gi18n.h> @@ -60,6 +59,7 @@ #include "nautilus-file-utilities.h" #include "nautilus-file-undo-operations.h" #include "nautilus-file-undo-manager.h" +#include "nautilus-ui-utilities.h" /* TODO: TESTING!!! */ @@ -2590,9 +2590,9 @@ unmount_mount_callback (GObject *source_object, primary = g_strdup_printf (_("Unable to unmount %s"), mount_name); } - eel_show_error_dialog (primary, - error->message, - data->parent_window); + show_error_dialog (primary, + error->message, + data->parent_window); g_free (primary); } } @@ -2915,9 +2915,9 @@ volume_mount_cb (GObject *source_object, primary = g_strdup_printf (_("Unable to access ā%sā"), name); g_free (name); success = FALSE; - eel_show_error_dialog (primary, - error->message, - parent); + show_error_dialog (primary, + error->message, + parent); g_free (primary); } g_error_free (error); diff --git a/src/nautilus-ui-utilities.c b/src/nautilus-ui-utilities.c index cb7ab7b1e..819b7683f 100644 --- a/src/nautilus-ui-utilities.c +++ b/src/nautilus-ui-utilities.c @@ -460,3 +460,31 @@ get_text_for_date_range (GPtrArray *date_range, return label; } + +GtkDialog * +show_error_dialog (const gchar *primary_text, + const gchar *secondary_text, + GtkWindow *parent) +{ + GtkWidget *dialog; + + g_return_val_if_fail (parent != NULL, NULL); + + dialog = gtk_message_dialog_new (parent, + GTK_DIALOG_MODAL, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + "%s", primary_text); + + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), + "%s", secondary_text); + + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); + + gtk_widget_show (dialog); + + g_signal_connect (GTK_DIALOG (dialog), "response", + G_CALLBACK (gtk_widget_destroy), NULL); + + return GTK_DIALOG (dialog); +} diff --git a/src/nautilus-ui-utilities.h b/src/nautilus-ui-utilities.h index 2f7436e90..60eac3061 100644 --- a/src/nautilus-ui-utilities.h +++ b/src/nautilus-ui-utilities.h @@ -49,4 +49,8 @@ gboolean nautilus_file_date_in_between (guint64 file_unix_ gchar* get_text_for_date_range (GPtrArray *date_range, gboolean prefix_with_since); +GtkDialog * show_error_dialog (const gchar *primary_text, + const gchar *secondary_text, + GtkWindow *parent); + #endif /* NAUTILUS_UI_UTILITIES_H */ |