Add a function to obtain the session from a net
This commit is contained in:
parent
0939bab342
commit
b7a9d724b0
3 changed files with 29 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue