1 module soup.SessionSync; 2 3 private import glib.ConstructionException; 4 private import glib.Str; 5 private import gobject.ObjectG; 6 private import soup.Session; 7 private import soup.c.functions; 8 public import soup.c.types; 9 10 11 /** 12 * #SoupSessionSync is an implementation of #SoupSession that uses 13 * synchronous I/O, intended for use in multi-threaded programs. 14 * 15 * Deprecated: Use the #SoupSession class (which uses both asynchronous 16 * and synchronous I/O, depending on the API used). See the 17 * <link linkend="libsoup-session-porting">porting guide</link>. 18 */ 19 public class SessionSync : Session 20 { 21 /** the main Gtk struct */ 22 protected SoupSessionSync* soupSessionSync; 23 24 /** Get the main Gtk struct */ 25 public SoupSessionSync* getSessionSyncStruct(bool transferOwnership = false) 26 { 27 if (transferOwnership) 28 ownedRef = false; 29 return soupSessionSync; 30 } 31 32 /** the main Gtk struct as a void* */ 33 protected override void* getStruct() 34 { 35 return cast(void*)soupSessionSync; 36 } 37 38 /** 39 * Sets our main struct and passes it to the parent class. 40 */ 41 public this (SoupSessionSync* soupSessionSync, bool ownedRef = false) 42 { 43 this.soupSessionSync = soupSessionSync; 44 super(cast(SoupSession*)soupSessionSync, ownedRef); 45 } 46 47 48 /** */ 49 public static GType getType() 50 { 51 return soup_session_sync_get_type(); 52 } 53 54 /** 55 * Creates an synchronous #SoupSession with the default options. 56 * 57 * Deprecated: #SoupSessionSync is deprecated; use a plain 58 * #SoupSession, created with soup_session_new(). See the <link 59 * linkend="libsoup-session-porting">porting guide</link>. 60 * 61 * Returns: the new session. 62 * 63 * Throws: ConstructionException GTK+ fails to create the object. 64 */ 65 public this() 66 { 67 auto __p = soup_session_sync_new(); 68 69 if(__p is null) 70 { 71 throw new ConstructionException("null returned by new"); 72 } 73 74 this(cast(SoupSessionSync*) __p, true); 75 } 76 }