From: Christian Dywan Date: Thu, 15 Jan 2009 02:26:15 +0000 (+0100) Subject: Add a function to obtain the session from a net X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7a9d724b092ac10b707c1fbbaa5098701e82c47;p=midori Add a function to obtain the session from a net --- diff --git a/katze/katze-net.c b/katze/katze-net.c index 363ad9d1..cf169c15 100644 --- a/katze/katze-net.c +++ b/katze/katze-net.c @@ -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; diff --git a/katze/katze-net.h b/katze/katze-net.h index 0da0c287..13f50266 100644 --- a/katze/katze-net.h +++ b/katze/katze-net.h @@ -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, diff --git a/katze/katze-throbber.c b/katze/katze-throbber.c index faaea53a..0698ccb0 100644 --- a/katze/katze-throbber.c +++ b/katze/katze-throbber.c @@ -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 {