Overall cleanup.
* Add missing asserts to exported functions. * Unify formatting. * Fix the gtk-doc comment for ld_symbol_category_set_human_name(). * Make ld_library_load() reflect it's declaration. * Remove an unused variable in ld_library_load_cb(). * Change all char's to gchar's.
This commit is contained in:
		@@ -384,6 +384,9 @@ ld_canvas_new (void)
 | 
			
		||||
void
 | 
			
		||||
ld_canvas_set_document (LdCanvas *self, LdDocument *document)
 | 
			
		||||
{
 | 
			
		||||
	g_return_if_fail (LD_IS_CANVAS (self));
 | 
			
		||||
	g_return_if_fail (LD_IS_DOCUMENT (document));
 | 
			
		||||
 | 
			
		||||
	if (self->priv->document)
 | 
			
		||||
		g_object_unref (self->priv->document);
 | 
			
		||||
 | 
			
		||||
@@ -403,6 +406,7 @@ ld_canvas_set_document (LdCanvas *self, LdDocument *document)
 | 
			
		||||
LdDocument *
 | 
			
		||||
ld_canvas_get_document (LdCanvas *self)
 | 
			
		||||
{
 | 
			
		||||
	g_return_val_if_fail (LD_IS_CANVAS (self), NULL);
 | 
			
		||||
	return self->priv->document;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -416,6 +420,9 @@ ld_canvas_get_document (LdCanvas *self)
 | 
			
		||||
void
 | 
			
		||||
ld_canvas_set_library (LdCanvas *self, LdLibrary *library)
 | 
			
		||||
{
 | 
			
		||||
	g_return_if_fail (LD_IS_CANVAS (self));
 | 
			
		||||
	g_return_if_fail (LD_IS_LIBRARY (library));
 | 
			
		||||
 | 
			
		||||
	if (self->priv->library)
 | 
			
		||||
		g_object_unref (self->priv->library);
 | 
			
		||||
 | 
			
		||||
@@ -435,6 +442,7 @@ ld_canvas_set_library (LdCanvas *self, LdLibrary *library)
 | 
			
		||||
LdLibrary *
 | 
			
		||||
ld_canvas_get_library (LdCanvas *self)
 | 
			
		||||
{
 | 
			
		||||
	g_return_val_if_fail (LD_IS_CANVAS (self), NULL);
 | 
			
		||||
	return self->priv->library;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -43,11 +43,10 @@ struct _LdLibraryPrivate
 | 
			
		||||
 | 
			
		||||
G_DEFINE_TYPE (LdLibrary, ld_library, G_TYPE_OBJECT);
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
ld_library_finalize (GObject *gobject);
 | 
			
		||||
static void ld_library_finalize (GObject *gobject);
 | 
			
		||||
 | 
			
		||||
static LdSymbolCategory *load_category
 | 
			
		||||
	(LdLibrary *self, const char *path, const char *name);
 | 
			
		||||
static LdSymbolCategory *load_category (LdLibrary *self,
 | 
			
		||||
	const gchar *path, const gchar *name);
 | 
			
		||||
static gboolean load_category_cb (const gchar *base,
 | 
			
		||||
	const gchar *filename, gpointer userdata);
 | 
			
		||||
static void load_category_symbol_cb (LdSymbol *symbol, gpointer user_data);
 | 
			
		||||
@@ -175,7 +174,7 @@ LoadCategoryData;
 | 
			
		||||
 * Loads a category into the library.
 | 
			
		||||
 */
 | 
			
		||||
static LdSymbolCategory *
 | 
			
		||||
load_category (LdLibrary *self, const char *path, const char *name)
 | 
			
		||||
load_category (LdLibrary *self, const gchar *path, const gchar *name)
 | 
			
		||||
{
 | 
			
		||||
	LdSymbolCategory *cat;
 | 
			
		||||
	gchar *icon_file, *category_file;
 | 
			
		||||
@@ -353,16 +352,16 @@ LibraryLoadData;
 | 
			
		||||
 * Load the contents of a directory into the library.
 | 
			
		||||
 */
 | 
			
		||||
gboolean
 | 
			
		||||
ld_library_load (LdLibrary *self, const char *path)
 | 
			
		||||
ld_library_load (LdLibrary *self, const gchar *directory)
 | 
			
		||||
{
 | 
			
		||||
	LibraryLoadData data;
 | 
			
		||||
 | 
			
		||||
	g_return_val_if_fail (LD_IS_LIBRARY (self), FALSE);
 | 
			
		||||
	g_return_val_if_fail (path != NULL, FALSE);
 | 
			
		||||
	g_return_val_if_fail (directory != NULL, FALSE);
 | 
			
		||||
 | 
			
		||||
	data.self = self;
 | 
			
		||||
	data.changed = FALSE;
 | 
			
		||||
	foreach_dir (path, ld_library_load_cb, &data, NULL);
 | 
			
		||||
	foreach_dir (directory, ld_library_load_cb, &data, NULL);
 | 
			
		||||
 | 
			
		||||
	if (data.changed)
 | 
			
		||||
		g_signal_emit (self, LD_LIBRARY_GET_CLASS (self)->changed_signal, 0);
 | 
			
		||||
@@ -379,7 +378,6 @@ static gboolean
 | 
			
		||||
ld_library_load_cb (const gchar *base, const gchar *filename, gpointer userdata)
 | 
			
		||||
{
 | 
			
		||||
	LdSymbolCategory *cat;
 | 
			
		||||
	gchar *categ_path;
 | 
			
		||||
	LibraryLoadData *data;
 | 
			
		||||
 | 
			
		||||
	g_return_val_if_fail (base != NULL, FALSE);
 | 
			
		||||
 
 | 
			
		||||
@@ -223,6 +223,8 @@ gboolean
 | 
			
		||||
ld_lua_check_file (LdLua *self, const gchar *filename)
 | 
			
		||||
{
 | 
			
		||||
	g_return_val_if_fail (LD_IS_LUA (self), FALSE);
 | 
			
		||||
	g_return_val_if_fail (filename != NULL, FALSE);
 | 
			
		||||
 | 
			
		||||
	return g_str_has_suffix (filename, ".lua")
 | 
			
		||||
		&& g_file_test (filename, G_FILE_TEST_IS_REGULAR);
 | 
			
		||||
}
 | 
			
		||||
@@ -297,6 +299,7 @@ ld_lua_private_draw (LdLua *self, LdLuaSymbol *symbol, cairo_t *cr)
 | 
			
		||||
 | 
			
		||||
	g_return_if_fail (LD_IS_LUA (self));
 | 
			
		||||
	g_return_if_fail (LD_IS_LUA_SYMBOL (symbol));
 | 
			
		||||
	g_return_if_fail (cr != NULL);
 | 
			
		||||
 | 
			
		||||
	data.symbol = symbol;
 | 
			
		||||
	data.cr = cr;
 | 
			
		||||
 
 | 
			
		||||
@@ -49,16 +49,11 @@ enum
 | 
			
		||||
	PROP_IMAGE_PATH
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
ld_symbol_category_get_property (GObject *object, guint property_id,
 | 
			
		||||
static void ld_symbol_category_get_property (GObject *object, guint property_id,
 | 
			
		||||
	GValue *value, GParamSpec *pspec);
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
ld_symbol_category_set_property (GObject *object, guint property_id,
 | 
			
		||||
static void ld_symbol_category_set_property (GObject *object, guint property_id,
 | 
			
		||||
	const GValue *value, GParamSpec *pspec);
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
ld_symbol_category_finalize (GObject *gobject);
 | 
			
		||||
static void ld_symbol_category_finalize (GObject *gobject);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@@ -179,6 +174,7 @@ ld_symbol_category_finalize (GObject *gobject)
 | 
			
		||||
	G_OBJECT_CLASS (ld_symbol_category_parent_class)->finalize (gobject);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ld_symbol_category_new:
 | 
			
		||||
 * @name: The name of the new category.
 | 
			
		||||
@@ -235,7 +231,7 @@ ld_symbol_category_get_name (LdSymbolCategory *self)
 | 
			
		||||
/**
 | 
			
		||||
 * ld_symbol_category_set_human_name:
 | 
			
		||||
 * @self: An #LdSymbolCategory object.
 | 
			
		||||
 * @name: The new localized human name for this category.
 | 
			
		||||
 * @human_name: The new localized human name for this category.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
ld_symbol_category_set_human_name (LdSymbolCategory *self,
 | 
			
		||||
 
 | 
			
		||||
@@ -90,7 +90,6 @@ enum
 | 
			
		||||
 | 
			
		||||
static void ld_symbol_get_property (GObject *object, guint property_id,
 | 
			
		||||
	GValue *value, GParamSpec *pspec);
 | 
			
		||||
 | 
			
		||||
static void ld_symbol_set_property (GObject *object, guint property_id,
 | 
			
		||||
	const GValue *value, GParamSpec *pspec);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,8 @@
 | 
			
		||||
#include "ld-window-main.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int main (int argc, char *argv[])
 | 
			
		||||
int
 | 
			
		||||
main (int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
	GtkWidget *wnd;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user