Add a function to obtain the session from a net

This commit is contained in:
Christian Dywan 2009-01-15 03:26:15 +01:00
parent 0939bab342
commit b7a9d724b0
3 changed files with 29 additions and 1 deletions

View file

@ -101,13 +101,38 @@ katze_net_new (void)
static KatzeNet* net = NULL;
if (!net)
{
net = g_object_new (KATZE_TYPE_NET, NULL);
/* Since this is a "singleton", keep an extra reference */
g_object_ref (net);
}
else
g_object_ref (net);
return net;
}
/**
* katze_net_get_session:
*
* Retrieves the session of the net.
*
* Return value: a session, or %NULL
*
* Since: 0.1.3
**/
gpointer
katze_net_get_session (KatzeNet* net)
{
g_return_val_if_fail (KATZE_IS_NET (net), NULL);
#if HAVE_LIBSOUP
return net->session;
#else
return NULL;
#endif
}
typedef struct
{
KatzeNet* net;

View file

@ -40,6 +40,9 @@ katze_net_get_type (void);
KatzeNet*
katze_net_new (void);
gpointer
katze_net_get_session (KatzeNet* net);
typedef enum
{
KATZE_NET_VERIFIED,

View file

@ -35,7 +35,7 @@ struct _KatzeThrobber
gint height;
};
G_DEFINE_TYPE (KatzeThrobber, katze_throbber, GTK_TYPE_MISC)
G_DEFINE_TYPE (KatzeThrobber, katze_throbber, GTK_TYPE_MISC);
enum
{