gucharmap r1803 - trunk/gucharmap
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: gucharmap r1803 - trunk/gucharmap
- Date: Sun, 15 Jun 2008 21:34:34 +0000 (UTC)
Author: chpe
Date: Sun Jun 15 21:34:34 2008
New Revision: 1803
URL: http://svn.gnome.org/viewvc/gucharmap?rev=1803&view=rev
Log:
Return a reference to the book codepoint list, not const.
Modified:
trunk/gucharmap/gucharmap-block-chapters-model.c
trunk/gucharmap/gucharmap-chapters-model.c
trunk/gucharmap/gucharmap-chapters-model.h
trunk/gucharmap/gucharmap-chapters-view.c
trunk/gucharmap/gucharmap-chapters-view.h
trunk/gucharmap/gucharmap-charmap.c
trunk/gucharmap/gucharmap-script-chapters-model.c
trunk/gucharmap/gucharmap-search-dialog.c
Modified: trunk/gucharmap/gucharmap-block-chapters-model.c
==============================================================================
--- trunk/gucharmap/gucharmap-block-chapters-model.c (original)
+++ trunk/gucharmap/gucharmap-block-chapters-model.c Sun Jun 15 21:34:34 2008
@@ -85,7 +85,7 @@
return gucharmap_block_codepoint_list_new (unicode_block->start, unicode_block->end);
}
-static G_CONST_RETURN GucharmapCodepointList *
+static GucharmapCodepointList *
get_book_codepoint_list (GucharmapChaptersModel *model)
{
GucharmapChaptersModelPrivate *model_priv = model->priv;
@@ -94,7 +94,7 @@
model_priv->book_list = gucharmap_block_codepoint_list_new (0, UNICHAR_MAX);
}
- return model_priv->book_list;
+ return g_object_ref (model_priv->book_list);
}
/* XXX linear search */
Modified: trunk/gucharmap/gucharmap-chapters-model.c
==============================================================================
--- trunk/gucharmap/gucharmap-chapters-model.c (original)
+++ trunk/gucharmap/gucharmap-chapters-model.c Sun Jun 15 21:34:34 2008
@@ -89,10 +89,10 @@
* gucharmap_chapters_model_get_codepoint_list:
* @chapters: a #GucharmapChaptersModel
*
- * Return value: a #GucharmapCodepointList representing all the characters
- * in all the chapters. It should not be modified or freed.
+ * Return value: a reference to a #GucharmapCodepointList representing all the characters
+ * in all the chapters. It should not be modified, but must be g_object_unref()'d after use.
**/
-G_CONST_RETURN GucharmapCodepointList *
+GucharmapCodepointList *
gucharmap_chapters_model_get_book_codepoint_list (GucharmapChaptersModel *chapters)
{
g_return_val_if_fail (GUCHARMAP_IS_CHAPTERS_MODEL (chapters), NULL);
Modified: trunk/gucharmap/gucharmap-chapters-model.h
==============================================================================
--- trunk/gucharmap/gucharmap-chapters-model.h (original)
+++ trunk/gucharmap/gucharmap-chapters-model.h Sun Jun 15 21:34:34 2008
@@ -61,7 +61,7 @@
GtkTreeIter *iter);
GucharmapCodepointList * (* get_codepoint_list) (GucharmapChaptersModel *chapters,
GtkTreeIter *iter);
- G_CONST_RETURN GucharmapCodepointList * (* get_book_codepoint_list) (GucharmapChaptersModel *chapters);
+ GucharmapCodepointList * (* get_book_codepoint_list) (GucharmapChaptersModel *chapters);
};
@@ -70,17 +70,17 @@
CHAPTERS_LABEL_COL = 1
};
-GType gucharmap_chapters_model_get_type (void);
-GucharmapCodepointList * gucharmap_chapters_model_get_codepoint_list (GucharmapChaptersModel *chapters,
- GtkTreeIter *iter);
-const char * gucharmap_chapters_model_get_title (GucharmapChaptersModel *chapters);
-G_CONST_RETURN GucharmapCodepointList * gucharmap_chapters_model_get_book_codepoint_list (GucharmapChaptersModel *chapters);
-gboolean gucharmap_chapters_model_character_to_iter (GucharmapChaptersModel *chapters,
- gunichar wc,
- GtkTreeIter *iter);
-gboolean gucharmap_chapters_model_id_to_iter (GucharmapChaptersModel *model,
- const char *id,
+GType gucharmap_chapters_model_get_type (void);
+GucharmapCodepointList * gucharmap_chapters_model_get_codepoint_list (GucharmapChaptersModel *chapters,
GtkTreeIter *iter);
+const char * gucharmap_chapters_model_get_title (GucharmapChaptersModel *chapters);
+GucharmapCodepointList * gucharmap_chapters_model_get_book_codepoint_list (GucharmapChaptersModel *chapters);
+gboolean gucharmap_chapters_model_character_to_iter (GucharmapChaptersModel *chapters,
+ gunichar wc,
+ GtkTreeIter *iter);
+gboolean gucharmap_chapters_model_id_to_iter (GucharmapChaptersModel *model,
+ const char *id,
+ GtkTreeIter *iter);
G_END_DECLS
Modified: trunk/gucharmap/gucharmap-chapters-view.c
==============================================================================
--- trunk/gucharmap/gucharmap-chapters-view.c (original)
+++ trunk/gucharmap/gucharmap-chapters-view.c Sun Jun 15 21:34:34 2008
@@ -256,10 +256,10 @@
* gucharmap_chapters_view_get_codepoint_list:
* @view: a #GucharmapChaptersView
*
- * Return value: a #GucharmapCodepointList representing all the characters
- * in all the chapters. It should not be modified or freed.
+ * Return value: a reference to a #GucharmapCodepointList representing all the characters
+ * in all the chapters. It should not be modified, but must be g_object_unref()'d after use.
**/
-G_CONST_RETURN GucharmapCodepointList *
+GucharmapCodepointList *
gucharmap_chapters_view_get_book_codepoint_list (GucharmapChaptersView *view)
{
GucharmapChaptersViewPrivate *priv = view->priv;
Modified: trunk/gucharmap/gucharmap-chapters-view.h
==============================================================================
--- trunk/gucharmap/gucharmap-chapters-view.h (original)
+++ trunk/gucharmap/gucharmap-chapters-view.h Sun Jun 15 21:34:34 2008
@@ -65,8 +65,8 @@
gboolean gucharmap_chapters_view_select_character (GucharmapChaptersView *view,
gunichar wc);
-GucharmapCodepointList * gucharmap_chapters_view_get_codepoint_list (GucharmapChaptersView *view);
-G_CONST_RETURN GucharmapCodepointList * gucharmap_chapters_view_get_book_codepoint_list (GucharmapChaptersView *view);
+GucharmapCodepointList * gucharmap_chapters_view_get_codepoint_list (GucharmapChaptersView *view);
+GucharmapCodepointList * gucharmap_chapters_view_get_book_codepoint_list (GucharmapChaptersView *view);
void gucharmap_chapters_view_next (GucharmapChaptersView *view);
void gucharmap_chapters_view_previous (GucharmapChaptersView *view);
Modified: trunk/gucharmap/gucharmap-charmap.c
==============================================================================
--- trunk/gucharmap/gucharmap-charmap.c (original)
+++ trunk/gucharmap/gucharmap-charmap.c Sun Jun 15 21:34:34 2008
@@ -1238,7 +1238,5 @@
{
GucharmapCharmapPrivate *priv = charmap->priv;
- GucharmapCodepointList *codepoint_list;
- codepoint_list = (GucharmapCodepointList *) gucharmap_chapters_view_get_book_codepoint_list (priv->chapters_view);
- return g_object_ref (codepoint_list);
+ return gucharmap_chapters_view_get_book_codepoint_list (priv->chapters_view);
}
Modified: trunk/gucharmap/gucharmap-script-chapters-model.c
==============================================================================
--- trunk/gucharmap/gucharmap-script-chapters-model.c (original)
+++ trunk/gucharmap/gucharmap-script-chapters-model.c Sun Jun 15 21:34:34 2008
@@ -93,7 +93,7 @@
return FALSE;
}
-static G_CONST_RETURN GucharmapCodepointList *
+static GucharmapCodepointList *
get_book_codepoint_list (GucharmapChaptersModel *chapters)
{
GucharmapChaptersModelPrivate *priv = chapters->priv;
@@ -106,7 +106,7 @@
gtk_tree_model_foreach (model, (GtkTreeModelForeachFunc) append_script, priv->book_list);
}
- return priv->book_list;
+ return g_object_ref (priv->book_list);
}
static gboolean
@@ -134,7 +134,6 @@
chapters_class->character_to_iter = character_to_iter;
chapters_class->get_codepoint_list = get_codepoint_list;
chapters_class->get_book_codepoint_list = get_book_codepoint_list;
-
}
G_DEFINE_TYPE (GucharmapScriptChaptersModel, gucharmap_script_chapters_model, GUCHARMAP_TYPE_CHAPTERS_MODEL)
Modified: trunk/gucharmap/gucharmap-search-dialog.c
==============================================================================
--- trunk/gucharmap/gucharmap-search-dialog.c (original)
+++ trunk/gucharmap/gucharmap-search-dialog.c Sun Jun 15 21:34:34 2008
@@ -455,9 +455,10 @@
static void
gucharmap_search_state_free (GucharmapSearchState *search_state)
{
+ g_object_unref (search_state->list);
g_free (search_state->search_string_nfd_temp);
g_free (search_state->search_string_nfc);
- g_free (search_state);
+ g_slice_free (GucharmapSearchState, search_state);
}
/**
@@ -475,7 +476,7 @@
* Return value: the new #GucharmapSearchState.
**/
static GucharmapSearchState *
-gucharmap_search_state_new (const GucharmapCodepointList *list,
+gucharmap_search_state_new (GucharmapCodepointList *list,
const gchar *search_string,
gint start_index,
GucharmapDirection direction,
@@ -487,9 +488,9 @@
g_assert (direction == GUCHARMAP_DIRECTION_BACKWARD || direction == GUCHARMAP_DIRECTION_FORWARD);
- search_state = g_new (GucharmapSearchState, 1);
+ search_state = g_slice_new (GucharmapSearchState);
- search_state->list = (GucharmapCodepointList *) list;
+ search_state->list = g_object_ref (list);
search_state->list_num_chars = gucharmap_codepoint_list_get_last_index (search_state->list) + 1;
search_state->search_string = g_strdup (search_string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]