Merge lp:~gue5t/midori/docs-and-gir-1 into lp:midori

Proposed by gue5t gue5t
Status: Merged
Approved by: Cris Dywan
Approved revision: 6583
Merged at revision: 6585
Proposed branch: lp:~gue5t/midori/docs-and-gir-1
Merge into: lp:midori
Diff against target: 449 lines (+145/-36)
6 files modified
CMakeLists.txt (+4/-0)
cmake/GIR.cmake (+31/-0)
gir/CMakeLists.txt (+15/-0)
katze/katze-array.c (+26/-17)
katze/katze-item.c (+8/-8)
midori/midori-websettings.c (+61/-11)
To merge this branch: bzr merge lp:~gue5t/midori/docs-and-gir-1
Reviewer Review Type Date Requested Status
Cris Dywan Approve
Review via email: mp+208977@code.launchpad.net

Commit message

Improve docs and GIR annotations for KatzeItem, KatzeArray, and MidoriWebSettings

Description of the change

We'll need a lot more attention to documentation before GIR/libpeas is feasible, but I figured I'd start with infrastructure stuff and work upward.

I've been running build with GtkDoc enabled and also using commands along the lines of "g-ir-scanner -Imidori -I../ -I../midori -I../katze -I../toolbars -I. --header-only -n Midori --identifier-prefix Midori -L./midori/ ../midori/midori-websettings.c ../midori/midori-websettings.h --pkg gtk+-2.0 --pkg webkit-1.0 --pkg gio-2.0 --pkg gobject-2.0 --warn-all -iGObject-2.0 -iGLib-2.0 -iGtk-2.0 -o gir-1.0/MidoriSettings-1.0.gir" to get tooling feedback so far.

To post a comment you must log in.
Revision history for this message
Cris Dywan (kalikiana) wrote :

Can we run the g-ir-scanner as part of the build? Or, if for whatever reason that's not feasible right now as an optional target or command. Otherwise it's somewhat tricky to verify that the annotations work/ continue to work.

That said, look very very nice. I second getting these things solved progressively.

review: Needs Information
lp:~gue5t/midori/docs-and-gir-1 updated
6582. By gue5t <email address hidden>

Implement GIR build support

Revision history for this message
gue5t gue5t (gue5t) wrote :

Ah, this isn't quite right--g-ir-scanner needs to run after midori-core.h has been generated, and probably should be off by default to avoid deps on GIR for packagers.

lp:~gue5t/midori/docs-and-gir-1 updated
6583. By gue5t <email address hidden>

Turn off GIR xml generation by default, and make it run after compile when enabled

Revision history for this message
Cris Dywan (kalikiana) wrote :

Sweet! Thanks a lot!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-03-01 12:00:40 +0000
3+++ CMakeLists.txt 2014-03-04 14:42:35 +0000
4@@ -159,6 +159,7 @@
5 option(USE_ZEITGEIST "Zeitgeist history integration" ON)
6 option(USE_GRANITE "Fancy notebook and pop-overs" OFF)
7 option(USE_APIDOCS "API documentation" OFF)
8+option(USE_GIR "Generate GObject Introspection bindings" OFF)
9 option(EXTRA_WARNINGS "Additional compiler warnings" OFF)
10
11 # GTK+3 is implied here, whether set or not
12@@ -288,3 +289,6 @@
13 if (USE_APIDOCS)
14 add_subdirectory (docs/api)
15 endif ()
16+if (USE_GIR)
17+ add_subdirectory (gir)
18+endif ()
19
20=== added file 'cmake/GIR.cmake'
21--- cmake/GIR.cmake 1970-01-01 00:00:00 +0000
22+++ cmake/GIR.cmake 2014-03-04 14:42:35 +0000
23@@ -0,0 +1,31 @@
24+# GIR.cmake
25+#
26+# Macros for building Gobject Introspection bindings for Midori API
27+find_program (GIR_SCANNER_BIN g-ir-scanner)
28+find_program (GIR_COMPILER_BIN g-ir-compiler)
29+
30+if (GIR_SCANNER_BIN AND GIR_COMPILER_BIN)
31+
32+ set (GIR_FOUND TRUE)
33+ set (GIR_VERSION "${MIDORI_MAJOR_VERSION}.${MIDORI_MINOR_VERSION}")
34+ macro (gir_build module namespace)
35+ add_custom_target ("g-ir-scanner_${module}" ALL
36+ ${GIR_SCANNER_BIN} -Imidori -I${CMAKE_SOURCE_DIR}/ -I${CMAKE_BINARY_DIR}/midori -I${CMAKE_SOURCE_DIR}/${module} -I${CMAKE_SOURCE_DIR}/toolbars -I.
37+ --header-only -n ${namespace} --identifier-prefix ${namespace}
38+ ${CMAKE_SOURCE_DIR}/${module}/${module}-*.c ${CMAKE_SOURCE_DIR}/${module}/${module}-*.h
39+ --pkg gtk+-2.0 --pkg webkit-1.0 --pkg gio-2.0 --pkg gobject-2.0
40+ --warn-all -iGObject-2.0 -iGLib-2.0 -iGtk-2.0
41+ --nsversion ${GIR_VERSION}
42+ -o ${CMAKE_CURRENT_BINARY_DIR}/${namespace}-${GIR_VERSION}.gir
43+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
44+ DEPENDS ${CMAKE_PROJECT_NAME})
45+
46+ endmacro (gir_build module namespace)
47+
48+ macro (gir module namespace)
49+ gir_build (${module} ${namespace})
50+
51+ install (FILES "${CMAKE_CURRENT_BINARY_DIR}/${namespace}-${GIR_VERSION}.gir"
52+ DESTINATION "${CMAKE_INSTALL_DATADIR}/gir-1.0/")
53+ endmacro (gir module)
54+endif ()
55
56=== added directory 'gir'
57=== added file 'gir/CMakeLists.txt'
58--- gir/CMakeLists.txt 1970-01-01 00:00:00 +0000
59+++ gir/CMakeLists.txt 2014-03-04 14:42:35 +0000
60@@ -0,0 +1,15 @@
61+# Copyright (C) 2013 Olivier Duchateau
62+
63+include (GIR)
64+
65+if (GIR_FOUND)
66+ list (APPEND MODULES "Katze" "Midori")
67+ foreach (MOD ${MODULES})
68+ string(TOLOWER ${MOD} LOWER_MOD)
69+ if (EXISTS "${CMAKE_SOURCE_DIR}/${LOWER_MOD}")
70+ gir (${LOWER_MOD} ${MOD})
71+ endif ()
72+ endforeach ()
73+else ()
74+ message (FATAL_ERROR "g-ir-scanner not found")
75+endif ()
76
77=== modified file 'katze/katze-array.c'
78--- katze/katze-array.c 2013-11-04 20:57:37 +0000
79+++ katze/katze-array.c 2014-03-04 14:42:35 +0000
80@@ -229,7 +229,7 @@
81 * The array will keep a reference on each object until
82 * it is removed from the array.
83 *
84- * Return value: a new #KatzeArray
85+ * Return value: (transfer full): a new #KatzeArray
86 **/
87 KatzeArray*
88 katze_array_new (GType type)
89@@ -252,7 +252,7 @@
90 * Checks whether the array is compatible
91 * with items of the specified type.
92 *
93- * Retur value: %TRUE if @array is compatible with @is_a_type
94+ * Return value: %TRUE if @array is compatible with @is_a_type
95 **/
96 gboolean
97 katze_array_is_a (KatzeArray* array,
98@@ -266,7 +266,7 @@
99 /**
100 * katze_array_add_item:
101 * @array: a #KatzeArray
102- * @item: an item
103+ * @item: (type GObject) (transfer none): an item
104 *
105 * Adds an item to the array.
106 *
107@@ -284,7 +284,7 @@
108 /**
109 * katze_array_remove_item:
110 * @array: a #KatzeArray
111- * @item: an item
112+ * @item: (type GObject): an item
113 *
114 * Removes an item from the array.
115 *
116@@ -306,7 +306,7 @@
117 *
118 * Retrieves the item in @array at the position @n.
119 *
120- * Return value: an item, or %NULL
121+ * Return value: (type GObject) (transfer none): an item, or %NULL
122 **/
123 gpointer
124 katze_array_get_nth_item (KatzeArray* array,
125@@ -323,7 +323,7 @@
126 *
127 * Determines whether @array is empty.
128 *
129- * Return value: an item, or %NULL
130+ * Return value: %TRUE if the array is empty
131 **/
132 gboolean
133 katze_array_is_empty (KatzeArray* array)
134@@ -336,11 +336,12 @@
135 /**
136 * katze_array_get_item_index:
137 * @array: a #KatzeArray
138- * @item: an item in the array
139+ * @item: (type GObject): an item in the array
140 *
141 * Retrieves the index of the item in @array.
142 *
143- * Return value: an item, or -1
144+ * Return value: the index of the item, or -1 if the item is not
145+ * present in the array
146 **/
147 gint
148 katze_array_get_item_index (KatzeArray* array,
149@@ -358,14 +359,14 @@
150 *
151 * Looks up an item in the array which has the specified token.
152 *
153- * This function will fail if the type of the list
154- * is not based on #KatzeItem children.
155+ * This function will fail and return NULL if the #KatzeArray's
156+ * element type is not based on #KatzeItem.
157 *
158 * Note that @token is by definition unique to one item.
159 *
160 * Since 0.4.4 @token can be a "token keywords" string.
161 *
162- * Return value: an item, or %NULL
163+ * Return value: (type GObject) (transfer none): an item, or %NULL
164 **/
165 gpointer
166 katze_array_find_token (KatzeArray* array,
167@@ -403,10 +404,10 @@
168 *
169 * Looks up an item in the array which has the specified URI.
170 *
171- * This function will fail if the type of the list
172- * is not based on #KatzeItem children.
173+ * This function will fail and return NULL if the #KatzeArray's
174+ * element type is not based on #KatzeItem.
175 *
176- * Return value: an item, or %NULL
177+ * Return value: (type GObject) (transfer none): an item, or %NULL
178 *
179 * Since: 0.2.0
180 **/
181@@ -435,7 +436,7 @@
182 *
183 * Retrieves the number of items in @array.
184 *
185- * Return value: the length of the list
186+ * Return value: the length of the #KatzeArray
187 **/
188 guint
189 katze_array_get_length (KatzeArray* array)
190@@ -448,7 +449,7 @@
191 /**
192 * katze_array_move_item:
193 * @array: a #KatzeArray
194- * @item: the item being moved
195+ * @item: (type GObject): the item being moved
196 * @position: the new position of the item
197 *
198 * Moves @item to the position @position.
199@@ -471,7 +472,7 @@
200 *
201 * Retrieves the items as a list.
202 *
203- * Return value: a newly allocated #GList of items
204+ * Return value: (element-type GObject) (transfer container): a newly allocated #GList of items
205 *
206 * Since: 0.2.5
207 **/
208@@ -483,6 +484,14 @@
209 return g_list_copy (array->priv->items);
210 }
211
212+/**
213+ * katze_array_peek_items:
214+ * @array: a #KatzeArray
215+ *
216+ * Peeks at the KatzeArray's internal list of items.
217+ *
218+ * Return value: (element-type GObject) (transfer none): the #KatzeArray's internal #GList of items
219+ **/
220 GList*
221 katze_array_peek_items (KatzeArray* array)
222 {
223
224=== modified file 'katze/katze-item.c'
225--- katze/katze-item.c 2013-08-05 19:52:52 +0000
226+++ katze/katze-item.c 2014-03-04 14:42:35 +0000
227@@ -342,7 +342,7 @@
228 /**
229 * katze_item_set_text:
230 * @item: a #KatzeItem
231- * @description: a string
232+ * @text: a string
233 *
234 * Sets the descriptive text of @item.
235 **/
236@@ -435,9 +435,9 @@
237 * @item: a #KatzeItem
238 * @widget: a #GtkWidget, or %NULL
239 *
240- * Retrieves a #GdkPixbuf fit to display @item.
241+ * Creates a #GdkPixbuf fit to display @item.
242 *
243- * Return value: the icon of the item
244+ * Return value: (transfer full): the icon of the item, or %NULL
245 *
246 * Since: 0.4.6
247 **/
248@@ -495,12 +495,12 @@
249 * @item: a #KatzeItem
250 * @widget: a #GtkWidget, or %NULL
251 *
252- * Retrieves a #GtkImage fit to display @item.
253+ * Creates a #GtkImage fit to display @item.
254 *
255- * Return value: the icon of the item
256+ * Return value: (transfer floating): the icon of the item
257 *
258 * Since: 0.4.4
259- * Since 0.4.8 a @widget was added and the image is visible.
260+ * Since 0.4.8 a @widget was added and the image is set visible.
261 **/
262 GtkWidget*
263 katze_item_get_image (KatzeItem* item,
264@@ -600,7 +600,7 @@
265 *
266 * Retrieves a list of all meta keys.
267 *
268- * Return value: a newly allocated #GList of constant strings
269+ * Return value: (element-type utf8) (transfer container): a newly allocated #GList of constant strings
270 *
271 * Since: 0.1.8
272 **/
273@@ -778,7 +778,7 @@
274 *
275 * Since 0.1.2 you can monitor the "parent" property.
276 *
277- * Return value: the parent of the item
278+ * Return value: (type GObject) (transfer none): the parent of the item
279 **/
280 gpointer
281 katze_item_get_parent (KatzeItem* item)
282
283=== modified file 'midori/midori-websettings.c'
284--- midori/midori-websettings.c 2014-02-24 11:33:50 +0000
285+++ midori/midori-websettings.c 2014-03-04 14:42:35 +0000
286@@ -257,6 +257,13 @@
287 GValue* value,
288 GParamSpec* pspec);
289
290+/**
291+ * midori_web_settings_low_memory_profile:
292+ *
293+ * Determines if the system has a relatively small amount of memory.
294+ *
295+ * Returns: %TRUE if there is relatively little memory available
296+ **/
297 static gboolean
298 midori_web_settings_low_memory_profile ()
299 {
300@@ -482,7 +489,7 @@
301 flags));
302
303 /**
304- * MidoriWebSettings:enforc-font-family:
305+ * MidoriWebSettings:enforce-font-family:
306 *
307 * Whether to enforce user font preferences with an internal stylesheet.
308 *
309@@ -611,8 +618,11 @@
310
311 /**
312 * midori_web_settings_skip_plugin:
313+ * @path: the path to the plugin file
314 *
315- * Tests if a plugin is redundant
316+ * Tests if a plugin is redundant. WebKit sometimes provides
317+ * duplicate listings of plugins due to library deployment
318+ * miscellanea.
319 *
320 * Returns: %TRUE if the passed plugin shouldn't be shown in UI listings.
321 *
322@@ -655,6 +665,8 @@
323
324 /**
325 * midori_web_settings_get_site_data_policy:
326+ * @settings: the MidoriWebSettings instance
327+ * @uri: the URI for which to make the policy decision
328 *
329 * Tests if @uri may store site data.
330 *
331@@ -734,11 +746,11 @@
332
333 /**
334 * midori_web_settings_get_system_name:
335- * @architecture: location of a string, or %NULL
336- * @platform: location of a string, or %NULL
337+ * @architecture: (out) (allow-none): location of a string, or %NULL
338+ * @platform: (out) (allow-none): location of a string, or %NULL
339 *
340 * Determines the system name, architecture and platform.
341- * @architecturce can have a %NULL value.
342+ * This function may write a %NULL value to @architecture.
343 *
344 * Returns: a string
345 *
346@@ -948,6 +960,13 @@
347 katze_assign (settings->accept, g_strdup (languages));
348 }
349
350+/**
351+ * midori_web_settings_get_accept_language:
352+ *
353+ * Returns the value of the accept-language header to send to web servers
354+ *
355+ * Returns: the accept-language string
356+ **/
357 const gchar*
358 midori_web_settings_get_accept_language (MidoriWebSettings* settings)
359 {
360@@ -1080,9 +1099,9 @@
361 "default-font-family");
362 gchar* monospace = katze_object_get_string (web_settings,
363 "monospace-font-family");
364- gchar* css = g_strdup_printf ("body * { font-family: %s !important; } \
365- code, code *, pre, pre *, blockquote, blockquote *, \
366- input, textarea { font-family: %s !important; }",
367+ gchar* css = g_strdup_printf ("body * { font-family: %s !important; } "
368+ "code, code *, pre, pre *, blockquote, blockquote *, "
369+ "input, textarea { font-family: %s !important; }",
370 font_family, monospace);
371 midori_web_settings_add_style (web_settings, "enforce-font-family", css);
372 g_free (font_family);
373@@ -1250,9 +1269,10 @@
374 *
375 * Creates a new #MidoriWebSettings instance with default values.
376 *
377- * You will typically want to assign this to a #MidoriWebView or #MidoriBrowser.
378+ * You will typically want to assign this to a #MidoriWebView
379+ * or #MidoriBrowser.
380 *
381- * Return value: a new #MidoriWebSettings
382+ * Return value: (transfer full): a new #MidoriWebSettings
383 **/
384 MidoriWebSettings*
385 midori_web_settings_new (void)
386@@ -1318,6 +1338,7 @@
387
388 /**
389 * midori_web_settings_add_style:
390+ * @settings: the MidoriWebSettings instance to modify
391 * @rule_id: a static string identifier
392 * @style: a CSS stylesheet
393 *
394@@ -1352,6 +1373,7 @@
395
396 /**
397 * midori_web_settings_remove_style:
398+ * @settings: the MidoriWebSettings instance to modify
399 * @rule_id: the string identifier used previously
400 *
401 * Removes a stylesheet from midori settings.
402@@ -1378,6 +1400,21 @@
403 }
404 }
405
406+/**
407+ * midori_settings_new_full:
408+ * @extensions: (out) (allow-none): a pointer into which
409+ * to write an array of names of extensions which preferences
410+ * indicate should be activated, or %NULL.
411+ *
412+ * Creates a new #MidoriWebSettings instance, loading
413+ * configuration from disk according to preferences and
414+ * invocation mode.
415+ *
416+ * You will typically want to assign this to a #MidoriWebView
417+ * or #MidoriBrowser.
418+ *
419+ * Return value: (transfer full): a new #MidoriWebSettings
420+ **/
421 MidoriWebSettings*
422 midori_settings_new_full (gchar*** extensions)
423 {
424@@ -1485,6 +1522,20 @@
425 return settings;
426 }
427
428+/**
429+ * midori_settings_save_to_file:
430+ * @settings: a MidoriWebSettings instance to save
431+ * @app: (type Midori.Application) (allow-none): a MidoriApplication instance
432+ * @filename: the filename into which to save settings
433+ * @error: (out) (allow-none): return location for a GError, or %NULL
434+ *
435+ * Saves a #MidoriWebSettings instance to disk at the path given by @filename.
436+ *
437+ * Also saves the list of activated extensions from @app.
438+ *
439+ * Return value: %TRUE if no error occurred; %FALSE if an error
440+ * occurred, in which case @error will contain detailed information
441+ **/
442 gboolean
443 midori_settings_save_to_file (MidoriWebSettings* settings,
444 GObject* app,
445@@ -1621,4 +1672,3 @@
446 g_key_file_free (key_file);
447 return saved;
448 }
449-

Subscribers

People subscribed via source and target branches

to all changes: