1 module webkit2.WebViewSessionState; 2 3 private import glib.Bytes; 4 private import glib.ConstructionException; 5 private import gobject.ObjectG; 6 private import webkit2.c.functions; 7 public import webkit2.c.types; 8 9 10 /** */ 11 public class WebViewSessionState 12 { 13 /** the main Gtk struct */ 14 protected WebKitWebViewSessionState* webKitWebViewSessionState; 15 protected bool ownedRef; 16 17 /** Get the main Gtk struct */ 18 public WebKitWebViewSessionState* getWebViewSessionStateStruct(bool transferOwnership = false) 19 { 20 if (transferOwnership) 21 ownedRef = false; 22 return webKitWebViewSessionState; 23 } 24 25 /** the main Gtk struct as a void* */ 26 protected void* getStruct() 27 { 28 return cast(void*)webKitWebViewSessionState; 29 } 30 31 /** 32 * Sets our main struct and passes it to the parent class. 33 */ 34 public this (WebKitWebViewSessionState* webKitWebViewSessionState, bool ownedRef = false) 35 { 36 this.webKitWebViewSessionState = webKitWebViewSessionState; 37 this.ownedRef = ownedRef; 38 } 39 40 ~this () 41 { 42 if ( ownedRef ) 43 webkit_web_view_session_state_unref(webKitWebViewSessionState); 44 } 45 46 47 /** */ 48 public static GType getType() 49 { 50 return webkit_web_view_session_state_get_type(); 51 } 52 53 /** 54 * Creates a new #WebKitWebViewSessionState from serialized data. 55 * 56 * Params: 57 * data = a #GBytes 58 * 59 * Returns: a new #WebKitWebViewSessionState, or %NULL if @data doesn't contain a 60 * valid serialized #WebKitWebViewSessionState. 61 * 62 * Since: 2.12 63 * 64 * Throws: ConstructionException GTK+ fails to create the object. 65 */ 66 public this(Bytes data) 67 { 68 auto __p = webkit_web_view_session_state_new((data is null) ? null : data.getBytesStruct()); 69 70 if(__p is null) 71 { 72 throw new ConstructionException("null returned by new"); 73 } 74 75 this(cast(WebKitWebViewSessionState*) __p); 76 } 77 78 alias doref = ref_; 79 /** 80 * Atomically increments the reference count of @state by one. This 81 * function is MT-safe and may be called from any thread. 82 * 83 * Returns: The passed in #WebKitWebViewSessionState 84 * 85 * Since: 2.12 86 */ 87 public WebViewSessionState ref_() 88 { 89 auto __p = webkit_web_view_session_state_ref(webKitWebViewSessionState); 90 91 if(__p is null) 92 { 93 return null; 94 } 95 96 return ObjectG.getDObject!(WebViewSessionState)(cast(WebKitWebViewSessionState*) __p, true); 97 } 98 99 /** 100 * Serializes a #WebKitWebViewSessionState. 101 * 102 * Returns: a #GBytes containing the @state serialized. 103 * 104 * Since: 2.12 105 */ 106 public Bytes serialize() 107 { 108 auto __p = webkit_web_view_session_state_serialize(webKitWebViewSessionState); 109 110 if(__p is null) 111 { 112 return null; 113 } 114 115 return new Bytes(cast(GBytes*) __p, true); 116 } 117 118 /** 119 * Atomically decrements the reference count of @state by one. If the 120 * reference count drops to 0, all memory allocated by the #WebKitWebViewSessionState is 121 * released. This function is MT-safe and may be called from any thread. 122 * 123 * Since: 2.12 124 */ 125 public void unref() 126 { 127 webkit_web_view_session_state_unref(webKitWebViewSessionState); 128 } 129 }