use one of the stock g_cclosure marshallers instead of rolling our own for emitting error events

This commit is contained in:
Charles Kerr 2009-04-07 23:44:38 +00:00
parent 640c9a25dd
commit a094c562ad
2 changed files with 4 additions and 40 deletions

View File

@ -139,10 +139,7 @@ static void gotdrag( GtkWidget * widget,
guint time,
gpointer gdata );
static void coreerr( TrCore * core,
enum tr_core_err code,
const char * msg,
gpointer gdata );
static void coreerr( TrCore *, guint, const char *, struct cbdata * );
static void onAddTorrent( TrCore *,
tr_ctor *,
@ -861,13 +858,8 @@ showTorrentErrors( struct cbdata * cbdata )
}
static void
coreerr( TrCore * core UNUSED,
enum tr_core_err code,
const char * msg,
gpointer gdata )
coreerr( TrCore * core UNUSED, guint code, const char * msg, struct cbdata * c )
{
struct cbdata * c = gdata;
switch( code )
{
case TR_EINVALID:

View File

@ -71,34 +71,6 @@ struct TrCorePrivate
tr_session * session;
};
static void
tr_core_marshal_err( GClosure * closure,
GValue * ret UNUSED,
guint count,
const GValue * vals,
gpointer hint UNUSED,
gpointer marshal )
{
typedef void ( *TRMarshalErr )
( gpointer, enum tr_core_err, const char *,
gpointer );
TRMarshalErr callback;
GCClosure * cclosure = (GCClosure*) closure;
enum tr_core_err errcode;
const char * errstr;
gpointer inst, gdata;
g_return_if_fail( count == 3 );
inst = g_value_peek_pointer( vals );
errcode = g_value_get_int( vals + 1 );
errstr = g_value_get_string( vals + 2 );
gdata = closure->data;
callback = (TRMarshalErr)( marshal ? marshal : cclosure->callback );
callback( inst, errcode, errstr, gdata );
}
static int
isDisposed( const TrCore * core )
{
@ -155,9 +127,9 @@ tr_core_class_init( gpointer g_class,
G_TYPE_FROM_CLASS( g_class ),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
tr_core_marshal_err,
g_cclosure_marshal_VOID__UINT_POINTER,
G_TYPE_NONE,
2, G_TYPE_INT, G_TYPE_STRING );
2, G_TYPE_UINT, G_TYPE_POINTER );
cc->promptsig = g_signal_new( "add-torrent-prompt",
G_TYPE_FROM_CLASS( g_class ),