[giggle] Introduce helper function to show error dialogs
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [giggle] Introduce helper function to show error dialogs
- Date: Thu, 22 Apr 2010 01:46:23 +0000 (UTC)
commit 78e78b17db6b0f4487b24d9b7bf4e952bf76768d
Author: Javier Jardón <jjardon gnome org>
Date: Thu Apr 22 03:36:19 2010 +0200
Introduce helper function to show error dialogs
src/giggle-helpers.c | 22 +++++++++++++++++++++-
src/giggle-helpers.h | 3 +++
src/giggle-window.c | 2 +-
3 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/src/giggle-helpers.c b/src/giggle-helpers.c
index 1d34798..d5419ba 100644
--- a/src/giggle-helpers.c
+++ b/src/giggle-helpers.c
@@ -23,6 +23,8 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
#include "giggle-helpers.h"
#include "libgiggle-git/giggle-git.h"
@@ -164,6 +166,24 @@ giggle_ui_manager_get_action_group (GtkUIManager *manager,
}
void
+giggle_error_dialog (GtkWindow *window,
+ GError *error)
+{
+ GtkWidget *widget;
+
+ widget = gtk_message_dialog_new (window,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "%s", _("An error ocurred:"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (widget),
+ "%s", error->message);
+
+ gtk_dialog_run (GTK_DIALOG (widget));
+ gtk_widget_destroy (widget);
+}
+
+void
giggle_open_file (GtkWidget *widget,
const char *directory,
const char *filename)
@@ -185,7 +205,7 @@ giggle_open_file (GtkWidget *widget,
uri, gtk_get_current_event_time (),
&error);
if (error != NULL) {
- g_warning ("%s: %s", G_STRFUNC, error->message);
+ giggle_error_dialog (GTK_WINDOW (widget), error);
g_clear_error (&error);
}
diff --git a/src/giggle-helpers.h b/src/giggle-helpers.h
index 8e2367e..c9df2e5 100644
--- a/src/giggle-helpers.h
+++ b/src/giggle-helpers.h
@@ -40,6 +40,9 @@ void giggle_open_file (GtkWidget *wi
const char *directory,
const char *filename);
+void giggle_error_dialog (GtkWindow *window,
+ GError *error);
+
G_END_DECLS
#endif /* __GIGGLE_DUMMY_H__ */
diff --git a/src/giggle-window.c b/src/giggle-window.c
index 7d1cad6..b5d15c6 100644
--- a/src/giggle-window.c
+++ b/src/giggle-window.c
@@ -898,7 +898,7 @@ window_visit_uri (GiggleWindow *window,
&error);
if (error != NULL) {
- g_warning ("%s: %s", G_STRFUNC, error->message);
+ giggle_error_dialog (GTK_WINDOW (window), error);
g_clear_error (&error);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]