1 module webkit2webextension.DOMMediaList;
2 
3 private import glib.ErrorG;
4 private import glib.GException;
5 private import glib.Str;
6 private import webkit2webextension.DOMObject;
7 private import webkit2webextension.c.functions;
8 public  import webkit2webextension.c.types;
9 
10 
11 /** */
12 public class DOMMediaList : DOMObject
13 {
14 	/** the main Gtk struct */
15 	protected WebKitDOMMediaList* webKitDOMMediaList;
16 
17 	/** Get the main Gtk struct */
18 	public WebKitDOMMediaList* getDOMMediaListStruct(bool transferOwnership = false)
19 	{
20 		if (transferOwnership)
21 			ownedRef = false;
22 		return webKitDOMMediaList;
23 	}
24 
25 	/** the main Gtk struct as a void* */
26 	protected override void* getStruct()
27 	{
28 		return cast(void*)webKitDOMMediaList;
29 	}
30 
31 	/**
32 	 * Sets our main struct and passes it to the parent class.
33 	 */
34 	public this (WebKitDOMMediaList* webKitDOMMediaList, bool ownedRef = false)
35 	{
36 		this.webKitDOMMediaList = webKitDOMMediaList;
37 		super(cast(WebKitDOMObject*)webKitDOMMediaList, ownedRef);
38 	}
39 
40 
41 	/** */
42 	public static GType getType()
43 	{
44 		return webkit_dom_media_list_get_type();
45 	}
46 
47 	/**
48 	 *
49 	 *
50 	 * Deprecated: Use JavaScriptCore API instead
51 	 *
52 	 * Params:
53 	 *     newMedium = A #gchar
54 	 *
55 	 * Throws: GException on failure.
56 	 */
57 	public void appendMedium(string newMedium)
58 	{
59 		GError* err = null;
60 
61 		webkit_dom_media_list_append_medium(webKitDOMMediaList, Str.toStringz(newMedium), &err);
62 
63 		if (err !is null)
64 		{
65 			throw new GException( new ErrorG(err) );
66 		}
67 	}
68 
69 	/**
70 	 *
71 	 *
72 	 * Deprecated: Use JavaScriptCore API instead
73 	 *
74 	 * Params:
75 	 *     oldMedium = A #gchar
76 	 *
77 	 * Throws: GException on failure.
78 	 */
79 	public void deleteMedium(string oldMedium)
80 	{
81 		GError* err = null;
82 
83 		webkit_dom_media_list_delete_medium(webKitDOMMediaList, Str.toStringz(oldMedium), &err);
84 
85 		if (err !is null)
86 		{
87 			throw new GException( new ErrorG(err) );
88 		}
89 	}
90 
91 	/**
92 	 *
93 	 *
94 	 * Deprecated: Use JavaScriptCore API instead
95 	 *
96 	 * Returns: A #gulong
97 	 */
98 	public gulong getLength()
99 	{
100 		return webkit_dom_media_list_get_length(webKitDOMMediaList);
101 	}
102 
103 	/**
104 	 *
105 	 *
106 	 * Deprecated: Use JavaScriptCore API instead
107 	 *
108 	 * Returns: A #gchar
109 	 */
110 	public string getMediaText()
111 	{
112 		auto retStr = webkit_dom_media_list_get_media_text(webKitDOMMediaList);
113 
114 		scope(exit) Str.freeString(retStr);
115 		return Str.toString(retStr);
116 	}
117 
118 	/**
119 	 *
120 	 *
121 	 * Deprecated: Use JavaScriptCore API instead
122 	 *
123 	 * Params:
124 	 *     index = A #gulong
125 	 *
126 	 * Returns: A #gchar
127 	 */
128 	public string item(gulong index)
129 	{
130 		auto retStr = webkit_dom_media_list_item(webKitDOMMediaList, index);
131 
132 		scope(exit) Str.freeString(retStr);
133 		return Str.toString(retStr);
134 	}
135 
136 	/**
137 	 *
138 	 *
139 	 * Deprecated: Use JavaScriptCore API instead
140 	 *
141 	 * Params:
142 	 *     value = A #gchar
143 	 *
144 	 * Throws: GException on failure.
145 	 */
146 	public void setMediaText(string value)
147 	{
148 		GError* err = null;
149 
150 		webkit_dom_media_list_set_media_text(webKitDOMMediaList, Str.toStringz(value), &err);
151 
152 		if (err !is null)
153 		{
154 			throw new GException( new ErrorG(err) );
155 		}
156 	}
157 }