aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-09-29 22:47:32 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-09-29 22:47:32 +0800
commitd3b09614221d075452496a5198a3910d07eb2818 (patch)
treed1ebe21e94248478e77443f01cd9991d2315f5ed /e-util
parente41b4083a60c2a8c4879ea3a7fc2e1d29a01720b (diff)
downloadgsoc2013-evolution-d3b09614221d075452496a5198a3910d07eb2818.tar
gsoc2013-evolution-d3b09614221d075452496a5198a3910d07eb2818.tar.gz
gsoc2013-evolution-d3b09614221d075452496a5198a3910d07eb2818.tar.bz2
gsoc2013-evolution-d3b09614221d075452496a5198a3910d07eb2818.tar.lz
gsoc2013-evolution-d3b09614221d075452496a5198a3910d07eb2818.tar.xz
gsoc2013-evolution-d3b09614221d075452496a5198a3910d07eb2818.tar.zst
gsoc2013-evolution-d3b09614221d075452496a5198a3910d07eb2818.zip
EAlert cleanups.
Clean up the header, drop some unused cruft.
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-alert-dialog.c16
-rw-r--r--e-util/e-alert.c42
-rw-r--r--e-util/e-alert.h108
3 files changed, 57 insertions, 109 deletions
diff --git a/e-util/e-alert-dialog.c b/e-util/e-alert-dialog.c
index 021812e590..1aa238cdcc 100644
--- a/e-util/e-alert-dialog.c
+++ b/e-util/e-alert-dialog.c
@@ -102,17 +102,6 @@ e_alert_dialog_dispose (GObject *object)
}
static void
-dialog_response_cb (GtkWidget *w, guint button, gpointer user_data)
-{
- EAlertDialogPrivate *priv = ALERT_DIALOG_PRIVATE (w);
-
- if (button == GTK_RESPONSE_HELP) {
- g_signal_stop_emission_by_name(w, "response");
- e_display_help (GTK_WINDOW (w), e_alert_peek_help_uri (priv->alert));
- }
-}
-
-static void
e_alert_dialog_init (EAlertDialog *self)
{
self->priv = ALERT_DIALOG_PRIVATE (self);
@@ -157,11 +146,6 @@ e_alert_dialog_constructed (GObject *obj)
gtk_window_set_modal ((GtkWindow *)self, TRUE);
gtk_window_set_destroy_with_parent ((GtkWindow *)self, TRUE);
- if (e_alert_peek_help_uri (alert)) {
- gtk_dialog_add_button ((GtkDialog*) self, GTK_STOCK_HELP, GTK_RESPONSE_HELP);
- g_signal_connect(self, "response", G_CALLBACK(dialog_response_cb), NULL);
- }
-
b = e_alert_peek_buttons (alert);
if (b == NULL) {
gtk_dialog_add_button ((GtkDialog*) self, GTK_STOCK_OK, GTK_RESPONSE_OK);
diff --git a/e-util/e-alert.c b/e-util/e-alert.c
index e4e698fae7..49ba6af36b 100644
--- a/e-util/e-alert.c
+++ b/e-util/e-alert.c
@@ -41,6 +41,10 @@
#define d(x)
+#define E_ALERT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ALERT, EAlertPrivate))
+
struct _e_alert {
guint32 flags;
const gchar *id;
@@ -49,7 +53,6 @@ struct _e_alert {
const gchar *title;
const gchar *primary;
const gchar *secondary;
- const gchar *help_uri;
gboolean scroll;
struct _e_alert_button *buttons;
};
@@ -70,17 +73,11 @@ static struct _e_alert_button default_ok_button = {
static struct _e_alert default_alerts[] = {
{ GTK_DIALOG_MODAL, "error", 3, GTK_RESPONSE_OK,
- N_("Evolution Error"), "{0}", "{1}", NULL, FALSE,
- &default_ok_button },
- { GTK_DIALOG_MODAL, "error-primary", 3, GTK_RESPONSE_OK,
- N_("Evolution Error"), "{0}", NULL, NULL, FALSE,
+ N_("Evolution Error"), "{0}", "{1}", FALSE,
&default_ok_button },
{ GTK_DIALOG_MODAL, "warning", 1, GTK_RESPONSE_OK,
- N_("Evolution Warning"), "{0}", "{1}", NULL, FALSE,
- &default_ok_button },
- { GTK_DIALOG_MODAL, "warning-primary", 1, GTK_RESPONSE_OK,
- N_("Evolution Warning"), "{0}", NULL, NULL, FALSE,
- &default_ok_button },
+ N_("Evolution Warning"), "{0}", "{1}", FALSE,
+ &default_ok_button }
};
/* ********************************************************************** */
@@ -141,18 +138,13 @@ G_DEFINE_TYPE (
e_alert,
G_TYPE_OBJECT)
-#define ALERT_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), E_TYPE_ALERT, EAlertPrivate))
-
-enum
-{
+enum {
PROP_0,
PROP_TAG,
PROP_ARGS
};
-struct _EAlertPrivate
-{
+struct _EAlertPrivate {
gchar *tag;
GPtrArray *args;
struct _e_alert *definition;
@@ -166,7 +158,6 @@ struct _EAlertPrivate
<title>Window Title</title>?
<primary>Primary error text.</primary>?
<secondary>Secondary error text.</secondary>?
- <help uri="help uri"/> ?
<button stock="stock-button-id"? label="button label"?
response="response_id"? /> *
</error>
@@ -280,12 +271,6 @@ e_alert_load (const gchar *path)
e->title = g_strdup (dgettext (table->translation_domain, tmp));
xmlFree (tmp);
}
- } else if (!strcmp((gchar *)scan->name, "help")) {
- tmp = (gchar *)xmlGetProp(scan, (const guchar *)"uri");
- if (tmp) {
- e->help_uri = g_strdup (tmp);
- xmlFree (tmp);
- }
} else if (!strcmp((gchar *)scan->name, "button")) {
struct _e_alert_button *b;
gchar *label = NULL;
@@ -497,7 +482,7 @@ e_alert_class_init (EAlertClass *klass)
static void
e_alert_init (EAlert *self)
{
- self->priv = ALERT_PRIVATE (self);
+ self->priv = E_ALERT_GET_PRIVATE (self);
}
/**
@@ -681,13 +666,6 @@ e_alert_get_secondary_text (EAlert *alert,
return g_string_free (formatted, FALSE);
}
-const gchar *
-e_alert_peek_help_uri (EAlert *alert)
-{
- g_return_val_if_fail (alert && alert->priv && alert->priv->definition, NULL);
- return alert->priv->definition->help_uri;
-}
-
gboolean
e_alert_get_scroll (EAlert *alert)
{
diff --git a/e-util/e-alert.h b/e-util/e-alert.h
index 04b9e120ef..4c515b53f4 100644
--- a/e-util/e-alert.h
+++ b/e-util/e-alert.h
@@ -22,28 +22,34 @@
*
*/
-#ifndef _E_ALERT_H
-#define _E_ALERT_H
+#ifndef E_ALERT_H
+#define E_ALERT_H
#include <stdarg.h>
#include <gtk/gtk.h>
-/*
- * Some standard alerts, if these are altered or added to,
- * update devel-docs/misc/errors.txt
- *
- * Several more basic ones are needed.
- */
-
-#define E_ALERT_INFO "builtin:info"
-#define E_ALERT_INFO_PRIMARY "builtin:info-primary"
-#define E_ALERT_WARNING "builtin:warning"
-#define E_ALERT_WARNING_PRIMARY "builtin:warning-primary"
-#define E_ALERT_ERROR "builtin:error"
-#define E_ALERT_ERROR_PRIMARY "builtin:error-primary"
+/* Standard GObject macros */
+#define E_TYPE_ALERT \
+ (e_alert_get_type())
+#define E_ALERT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_ALERT, EAlert))
+#define E_ALERT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_ALERT, EAlertClass))
+#define E_IS_ALERT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_ALERT))
+#define E_IS_ALERT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_ALERT))
+#define E_ALERT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_ALERT, EAlertClass))
/* takes filename, returns OK if yes */
-#define E_ALERT_ASK_FILE_EXISTS_OVERWRITE "system:ask-save-file-exists-overwrite"
+#define E_ALERT_ASK_FILE_EXISTS_OVERWRITE \
+ "system:ask-save-file-exists-overwrite"
/* takes filename, reason */
#define E_ALERT_NO_SAVE_FILE "system:no-save-file"
/* takes filename, reason */
@@ -51,28 +57,6 @@
G_BEGIN_DECLS
-#define E_TYPE_ALERT e_alert_get_type()
-
-#define E_ALERT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- E_TYPE_ALERT, EAlert))
-
-#define E_ALERT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- E_TYPE_ALERT, EAlertClass))
-
-#define E_IS_ALERT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- E_TYPE_ALERT))
-
-#define E_IS_ALERT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- E_TYPE_ALERT))
-
-#define E_ALERT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- E_TYPE_ALERT, EAlertClass))
-
typedef struct _EAlert EAlert;
typedef struct _EAlertClass EAlertClass;
typedef struct _EAlertPrivate EAlertPrivate;
@@ -84,33 +68,35 @@ struct _e_alert_button {
gint response;
};
-struct _EAlert
-{
- GObject parent;
- EAlertPrivate *priv;
+struct _EAlert {
+ GObject parent;
+ EAlertPrivate *priv;
};
-struct _EAlertClass
-{
- GObjectClass parent_class;
+struct _EAlertClass {
+ GObjectClass parent_class;
};
-GType e_alert_get_type (void);
-
-EAlert *e_alert_new (const gchar *tag, ...) G_GNUC_NULL_TERMINATED;
-EAlert *e_alert_new_valist (const gchar *tag, va_list ap);
-EAlert *e_alert_new_array (const gchar *tag, GPtrArray *args);
-
-guint32 e_alert_get_flags (EAlert *alert);
-const gchar *e_alert_peek_stock_image (EAlert *alert);
-gint e_alert_get_default_response (EAlert *alert);
-gchar *e_alert_get_title (EAlert *alert, gboolean escaped);
-gchar *e_alert_get_primary_text (EAlert *alert, gboolean escaped);
-gchar *e_alert_get_secondary_text (EAlert *alert, gboolean escaped);
-const gchar *e_alert_peek_help_uri (EAlert *alert);
-gboolean e_alert_get_scroll (EAlert *alert);
-struct _e_alert_button *e_alert_peek_buttons (EAlert *alert);
+GType e_alert_get_type (void);
+EAlert * e_alert_new (const gchar *tag,
+ ...) G_GNUC_NULL_TERMINATED;
+EAlert * e_alert_new_valist (const gchar *tag,
+ va_list ap);
+EAlert * e_alert_new_array (const gchar *tag,
+ GPtrArray *args);
+guint32 e_alert_get_flags (EAlert *alert);
+const gchar * e_alert_peek_stock_image (EAlert *alert);
+gint e_alert_get_default_response (EAlert *alert);
+gchar * e_alert_get_title (EAlert *alert,
+ gboolean escaped);
+gchar * e_alert_get_primary_text (EAlert *alert,
+ gboolean escaped);
+gchar * e_alert_get_secondary_text (EAlert *alert,
+ gboolean escaped);
+gboolean e_alert_get_scroll (EAlert *alert);
+struct _e_alert_button *
+ e_alert_peek_buttons (EAlert *alert);
G_END_DECLS
-#endif /* _E_ALERT_H */
+#endif /* E_ALERT_H */