1 module soup.CookieJarDB; 2 3 private import glib.ConstructionException; 4 private import glib.Str; 5 private import gobject.ObjectG; 6 private import soup.CookieJar; 7 private import soup.c.functions; 8 public import soup.c.types; 9 10 11 /** 12 * #SoupCookieJarDB is a #SoupCookieJar that reads cookies from and 13 * writes them to a sqlite database in the new Mozilla format. 14 * 15 * (This is identical to <literal>SoupCookieJarSqlite</literal> in 16 * libsoup-gnome; it has just been moved into libsoup proper, and 17 * renamed to avoid conflicting.) 18 */ 19 public class CookieJarDB : CookieJar 20 { 21 /** the main Gtk struct */ 22 protected SoupCookieJarDB* soupCookieJarDB; 23 24 /** Get the main Gtk struct */ 25 public SoupCookieJarDB* getCookieJarDBStruct(bool transferOwnership = false) 26 { 27 if (transferOwnership) 28 ownedRef = false; 29 return soupCookieJarDB; 30 } 31 32 /** the main Gtk struct as a void* */ 33 protected override void* getStruct() 34 { 35 return cast(void*)soupCookieJarDB; 36 } 37 38 /** 39 * Sets our main struct and passes it to the parent class. 40 */ 41 public this (SoupCookieJarDB* soupCookieJarDB, bool ownedRef = false) 42 { 43 this.soupCookieJarDB = soupCookieJarDB; 44 super(cast(SoupCookieJar*)soupCookieJarDB, ownedRef); 45 } 46 47 48 /** */ 49 public static GType getType() 50 { 51 return soup_cookie_jar_db_get_type(); 52 } 53 54 /** 55 * Creates a #SoupCookieJarDB. 56 * 57 * @filename will be read in at startup to create an initial set of 58 * cookies. If @read_only is %FALSE, then the non-session cookies will 59 * be written to @filename when the 'changed' signal is emitted from 60 * the jar. (If @read_only is %TRUE, then the cookie jar will only be 61 * used for this session, and changes made to it will be lost when the 62 * jar is destroyed.) 63 * 64 * Params: 65 * filename = the filename to read to/write from, or %NULL 66 * readOnly = %TRUE if @filename is read-only 67 * 68 * Returns: the new #SoupCookieJar 69 * 70 * Since: 2.42 71 * 72 * Throws: ConstructionException GTK+ fails to create the object. 73 */ 74 public this(string filename, bool readOnly) 75 { 76 auto __p = soup_cookie_jar_db_new(Str.toStringz(filename), readOnly); 77 78 if(__p is null) 79 { 80 throw new ConstructionException("null returned by new"); 81 } 82 83 this(cast(SoupCookieJarDB*) __p, true); 84 } 85 }