Add shell_global_report_error()

Move the "system notification error" handling out of
util.js, and add it to ShellGlobal so we can start
calling it from across the codebase better (including
C).

https://bugzilla.gnome.org/show_bug.cgi?id=644402
This commit is contained in:
Colin Walters
2011-03-15 18:31:16 -04:00
parent 61282737c5
commit b4f16c4df8
4 changed files with 62 additions and 7 deletions

View File

@ -21,6 +21,7 @@
#include <gdk/gdkx.h>
#include <gio/gio.h>
#include <gjs/gjs-module.h>
#include <girepository.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xmlmemory.h>
@ -102,6 +103,7 @@ enum
XDND_POSITION_CHANGED,
XDND_LEAVE,
XDND_ENTER,
NOTIFY_ERROR,
LAST_SIGNAL
};
@ -293,6 +295,17 @@ shell_global_class_init (ShellGlobalClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
shell_global_signals[NOTIFY_ERROR] =
g_signal_new ("notify-error",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
gi_cclosure_marshal_generic,
G_TYPE_NONE, 2,
G_TYPE_STRING,
G_TYPE_STRING);
g_object_class_install_property (gobject_class,
PROP_OVERLAY_GROUP,
g_param_spec_object ("overlay-group",
@ -1238,6 +1251,25 @@ shell_global_maybe_gc (ShellGlobal *global)
gjs_context_maybe_gc (global->js_context);
}
/**
* shell_global_notify_error:
* @global: a #ShellGlobal
* @msg: Error message
* @details: Error details
*
* Show a system error notification. Use this function
* when a user-initiated action results in a non-fatal problem
* from causes that may not be under system control. For
* example, an application crash.
*/
void
shell_global_notify_error (ShellGlobal *global,
const char *msg,
const char *details)
{
g_signal_emit_by_name (global, "notify-error", msg, details);
}
static void
grab_notify (GtkWidget *widget, gboolean was_grabbed, gpointer user_data)
{

View File

@ -143,6 +143,11 @@ void shell_global_play_theme_sound (ShellGlobal *global,
void shell_global_cancel_theme_sound (ShellGlobal *global,
guint id);
void shell_global_notify_error (ShellGlobal *global,
const char *msg,
const char *details);
void shell_global_init_xdnd (ShellGlobal *global);
typedef void (*ShellGetTpContactCb) (TpConnection *connection,