1 module soup.CookieJarText; 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 * #SoupCookieJarText is a #SoupCookieJar that reads cookies from and 13 * writes them to a text file in the Mozilla "cookies.txt" format. 14 */ 15 public class CookieJarText : CookieJar 16 { 17 /** the main Gtk struct */ 18 protected SoupCookieJarText* soupCookieJarText; 19 20 /** Get the main Gtk struct */ 21 public SoupCookieJarText* getCookieJarTextStruct(bool transferOwnership = false) 22 { 23 if (transferOwnership) 24 ownedRef = false; 25 return soupCookieJarText; 26 } 27 28 /** the main Gtk struct as a void* */ 29 protected override void* getStruct() 30 { 31 return cast(void*)soupCookieJarText; 32 } 33 34 /** 35 * Sets our main struct and passes it to the parent class. 36 */ 37 public this (SoupCookieJarText* soupCookieJarText, bool ownedRef = false) 38 { 39 this.soupCookieJarText = soupCookieJarText; 40 super(cast(SoupCookieJar*)soupCookieJarText, ownedRef); 41 } 42 43 44 /** */ 45 public static GType getType() 46 { 47 return soup_cookie_jar_text_get_type(); 48 } 49 50 /** 51 * Creates a #SoupCookieJarText. 52 * 53 * @filename will be read in at startup to create an initial set of 54 * cookies. If @read_only is %FALSE, then the non-session cookies will 55 * be written to @filename when the 'changed' signal is emitted from 56 * the jar. (If @read_only is %TRUE, then the cookie jar will only be 57 * used for this session, and changes made to it will be lost when the 58 * jar is destroyed.) 59 * 60 * Params: 61 * filename = the filename to read to/write from 62 * readOnly = %TRUE if @filename is read-only 63 * 64 * Returns: the new #SoupCookieJar 65 * 66 * Since: 2.26 67 * 68 * Throws: ConstructionException GTK+ fails to create the object. 69 */ 70 public this(string filename, bool readOnly) 71 { 72 auto __p = soup_cookie_jar_text_new(Str.toStringz(filename), readOnly); 73 74 if(__p is null) 75 { 76 throw new ConstructionException("null returned by new"); 77 } 78 79 this(cast(SoupCookieJarText*) __p, true); 80 } 81 }