[nautilus] ui-utilities: Add custom function to display error dialog
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] ui-utilities: Add custom function to display error dialog
- Date: Wed, 8 Mar 2017 16:17:59 +0000 (UTC)
commit 460235b9c9ec414f82b3cf872118c1a51773c978
Author: Kartikeya Sharma <09kartikeya gmail com>
Date: Sat Mar 4 20:37:27 2017 +0530
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
src/nautilus-file-operations.c | 14 +++++++-------
src/nautilus-ui-utilities.c | 28 ++++++++++++++++++++++++++++
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 d25a93a..125be8d 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 cb7ab7b..819b768 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 2f7436e..60eac30 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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]