grim/guifications3
Clone
Summary
Browse
Changes
Graph
moved guificatoins-daemon-mpris to cmake, this sucker is way behind api wise and doesn't build, but it looks like I got everything for cmake
cmake
2010-12-13, Gary Kramlich
422e30c70e86
moved guificatoins-daemon-mpris to cmake, this sucker is way behind api wise and doesn't build, but it looks like I got everything for cmake
/*
* Guifications - The end-all, be-all notification framework
* Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
#
include
<config.h>
#endif
/* HAVE_CONFIG_H */
#include
<gflib/gf_intl.h>
#include
<gflib/gf_log.h>
#include
<gflib/gf_native_plugin.h>
#include
<gflib-xmlrpc/gf_xmlrpc_client_connection.h>
#define GF_XMLRPC_CLIENT_CONNECTION_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GF_TYPE_XMLRPC_CLIENT_CONNECTION, GfXMLRPCClientConnectionPrivate))
/******************************************************************************
* Structs
*****************************************************************************/
typedef
struct
{
xmlrpc_env
env
;
xmlrpc_client
*
client
;
}
GfXMLRPCClientConnectionPrivate
;
/******************************************************************************
* Enums
*****************************************************************************/
enum
{
PROP_ZERO
=
0
,
PROP_XMLRPC_CLIENT
,
PROP_LAST
};
/******************************************************************************
* Globals
*****************************************************************************/
static
GType
type
=
0
;
static
GfClientConnectionClass
*
parent_class
=
NULL
;
/******************************************************************************
* Client Connection Stuff
*****************************************************************************/
static
gboolean
gf_xmlrpc_client_connection_connect
(
GfClientConnection
*
connection
,
GError
**
error
)
{
GfXMLRPCClientConnectionPrivate
*
priv
=
NULL
;
priv
=
GF_XMLRPC_CLIENT_CONNECTION_GET_PRIVATE
(
connection
);
xmlrpc_client_create
(
&
priv
->
env
,
XMLRPC_CLIENT_NO_FLAGS
,
PACKAGE
,
PACKAGE_VERSION
,
NULL
,
0
,
&
priv
->
client
);
return
FALSE
;
}
/******************************************************************************
* Connection Stuff
*****************************************************************************/
static
gboolean
gf_xmlrpc_client_connection_disconnect
(
GfConnection
*
connection
,
GError
**
error
)
{
return
FALSE
;
}
/******************************************************************************
* Object Stuff
*****************************************************************************/
static
void
gf_xmlrpc_client_connection_get_property
(
GObject
*
obj
,
guint
param_id
,
GValue
*
value
,
GParamSpec
*
pspec
)
{
GfXMLRPCClientConnection
*
conn
=
GF_XMLRPC_CLIENT_CONNECTION
(
obj
);
switch
(
param_id
)
{
case
PROP_XMLRPC_CLIENT
:
g_value_set_pointer
(
value
,
gf_xmlrpc_client_connection_get_client
(
conn
));
break
;
default
:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
obj
,
param_id
,
pspec
);
break
;
}
}
static
void
gf_xmlrpc_client_connection_finalize
(
GObject
*
obj
)
{
G_OBJECT_CLASS
(
parent_class
)
->
finalize
(
obj
);
}
static
void
gf_xmlrpc_client_connection_class_init
(
GfXMLRPCClientConnectionClass
*
klass
)
{
GObjectClass
*
obj_class
=
G_OBJECT_CLASS
(
klass
);
GfNamedObjectClass
*
gfno_class
=
GF_NAMED_OBJECT_CLASS
(
klass
);
GfConnectionClass
*
connection_class
=
GF_CONNECTION_CLASS
(
klass
);
GfClientConnectionClass
*
client_class
=
GF_CLIENT_CONNECTION_CLASS
(
klass
);
GParamSpec
*
pspec
;
parent_class
=
g_type_class_peek_parent
(
klass
);
obj_class
->
finalize
=
gf_xmlrpc_client_connection_finalize
;
obj_class
->
get_property
=
gf_xmlrpc_client_connection_get_property
;
gfno_class
->
name
=
_
(
"XMLRPC Client"
);
connection_class
->
disconnect
=
gf_xmlrpc_client_connection_disconnect
;
client_class
->
connect
=
gf_xmlrpc_client_connection_connect
;
g_type_class_add_private
(
klass
,
sizeof
(
GfXMLRPCClientConnectionPrivate
));
pspec
=
g_param_spec_pointer
(
"client"
,
"client"
,
"the xmlrpc client"
,
G_PARAM_READABLE
);
g_object_class_install_property
(
obj_class
,
PROP_XMLRPC_CLIENT
,
pspec
);
}
/******************************************************************************
* GfXMLRPCClientConnection API
*****************************************************************************/
void
gf_xmlrpc_client_connection_register
(
GfNativePlugin
*
plugin
)
{
static
GType
type
=
0
;
if
(
type
==
0
)
{
static
const
GTypeInfo
info
=
{
sizeof
(
GfXMLRPCClientConnectionClass
),
NULL
,
NULL
,
(
GClassInitFunc
)
gf_xmlrpc_client_connection_class_init
,
NULL
,
NULL
,
sizeof
(
GfXMLRPCClientConnection
),
0
,
NULL
,
NULL
};
type
=
gf_native_plugin_register_type
(
plugin
,
GF_TYPE_CLIENT_CONNECTION
,
"GfXMLRPCClientConnection"
,
&
info
,
0
);
}
}
GType
gf_xmlrpc_client_connection_get_gtype
(
void
)
{
if
(
type
==
0
)
{
gf_log_warning
(
"GfXMLRPCClientConnection"
,
"gf_xmlrpc_client_connection_get_gtype called before "
"the type was registered!
\n
"
);
}
return
type
;
}
xmlrpc_client
*
gf_xmlrpc_client_connection_get_client
(
const
GfXMLRPCClientConnection
*
client
)
{
GfXMLRPCClientConnectionPrivate
*
priv
=
NULL
;
g_return_val_if_fail
(
GF_IS_XMLRPC_CLIENT_CONNECTION
(
client
),
NULL
);
priv
=
GF_XMLRPC_CLIENT_CONNECTION_GET_PRIVATE
(
client
);
return
priv
->
client
;
}