[file-roller] Make the error dialogs more modern
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] Make the error dialogs more modern
- Date: Sun, 26 Oct 2014 18:20:54 +0000 (UTC)
commit 34f417d2ba05bb7ab4236151188d0aaf653eca39
Author: Yosef Or Boczko <yoseforb src gnome org>
Date: Tue Aug 26 14:59:23 2014 +0300
Make the error dialogs more modern
Make it a real GtkMessageDialog.
Also, remove the icon, we not needs it anymore.
https://bugzilla.gnome.org/show_bug.cgi?id=735438
po/POTFILES.in | 1 -
src/file-roller.gresource.xml | 1 -
src/gtk-utils.c | 63 +++++++++--------
src/ui/Makefile.am | 1 -
src/ui/error-dialog.ui | 153 -----------------------------------------
5 files changed, 34 insertions(+), 185 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index cba8443..8e89ae8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -129,7 +129,6 @@ src/typedefs.h
[type: gettext/glade]src/ui/app-menu.ui
[type: gettext/glade]src/ui/ask-password.ui
[type: gettext/glade]src/ui/delete.ui
-[type: gettext/glade]src/ui/error-dialog.ui
[type: gettext/glade]src/ui/extract-dialog-options.ui
[type: gettext/glade]src/ui/file-selector.ui
[type: gettext/glade]src/ui/gears-menu.ui
diff --git a/src/file-roller.gresource.xml b/src/file-roller.gresource.xml
index b99ea0b..a4ef234 100644
--- a/src/file-roller.gresource.xml
+++ b/src/file-roller.gresource.xml
@@ -7,7 +7,6 @@
<file compressed="true">ui/app-menubar.ui</file>
<file compressed="true">ui/ask-password.ui</file>
<file compressed="true">ui/delete.ui</file>
- <file compressed="true">ui/error-dialog.ui</file>
<file compressed="true">ui/extract-dialog-options.ui</file>
<file compressed="true">ui/file-selector.ui</file>
<file compressed="true">ui/gears-menu.ui</file>
diff --git a/src/gtk-utils.c b/src/gtk-utils.c
index a20f268..a1aa90e 100644
--- a/src/gtk-utils.c
+++ b/src/gtk-utils.c
@@ -181,58 +181,63 @@ _gtk_error_dialog_new (GtkWindow *parent,
const char *secondary_text_format,
...)
{
- GtkBuilder *builder;
- GtkWidget *dialog;
- char *escaped_message;
- char *markup_text;
- gboolean view_output;
+ GtkWidget *dialog;
- builder = _gtk_builder_new_from_resource ("error-dialog.ui");
- dialog = _gtk_builder_get_widget (builder, "error_dialog");
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
- gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
- gtk_window_set_modal (GTK_WINDOW (dialog), (flags & GTK_DIALOG_MODAL));
- gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), (flags & GTK_DIALOG_DESTROY_WITH_PARENT));
- g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, builder);
+ dialog = gtk_message_dialog_new (parent,
+ flags,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "%s", primary_text);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
if (flags & GTK_DIALOG_MODAL)
_gtk_dialog_add_to_window_group (GTK_DIALOG (dialog));
/* label */
- escaped_message = g_markup_escape_text (primary_text, -1);
if (secondary_text_format != NULL) {
va_list args;
char *secondary_message;
- char *escaped_secondary_message;
va_start (args, secondary_text_format);
secondary_message = g_strdup_vprintf (secondary_text_format, args);
va_end (args);
- escaped_secondary_message = g_markup_escape_text (secondary_message, -1);
- markup_text = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
- escaped_message,
- escaped_secondary_message);
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), secondary_message);
- g_free (escaped_secondary_message);
g_free (secondary_message);
}
- else
- markup_text = g_strdup (escaped_message);
- gtk_label_set_markup (GTK_LABEL (_gtk_builder_get_widget (builder, "message_label")), markup_text);
- g_free (markup_text);
- g_free (escaped_message);
/* output */
- view_output = (row_output != NULL) && (secondary_text_format == NULL);
- if (view_output) {
+ if ((row_output != NULL) && (secondary_text_format == NULL)) {
+ GtkWidget *output_box;
+ GtkWidget *label;
+ GtkWidget *scrolled_window;
+ GtkWidget *text_view;
GtkTextBuffer *text_buffer;
GtkTextIter iter;
GList *scan;
- text_buffer = (GtkTextBuffer *) gtk_builder_get_object (builder, "output_textbuffer");
+ output_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
+ gtk_box_pack_end (GTK_BOX (gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog))),
+ output_box, TRUE, TRUE, 0);
+
+ label = gtk_label_new_with_mnemonic (_("C_ommand Line Output:"));
+ gtk_box_pack_start (GTK_BOX (output_box), label, FALSE, FALSE, 0);
+
+ scrolled_window = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
+ "shadow-type", GTK_SHADOW_IN,
+ "width-request", 450,
+ "height-request", 200,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (output_box), scrolled_window, TRUE, TRUE, 0);
+
+ text_view = gtk_text_view_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), text_view);
+ gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
+
+ text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
gtk_text_buffer_create_tag (text_buffer, "monospace",
"family", "monospace",
NULL);
@@ -252,9 +257,9 @@ _gtk_error_dialog_new (GtkWindow *parent,
gtk_text_buffer_insert (text_buffer, &iter, "\n", 1);
}
- }
- gtk_widget_set_visible (_gtk_builder_get_widget (builder, "output_box"), view_output);
+ gtk_widget_show_all (output_box);
+ }
return dialog;
}
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index 4e578dd..edce891 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -5,7 +5,6 @@ EXTRA_DIST = \
app-menubar.ui \
ask-password.ui \
delete.ui \
- error-dialog.ui \
extract-dialog-options.ui \
file-selector.ui \
gears-menu.ui \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]