[evolution-data-server] Fix leaks around categories editing
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Fix leaks around categories editing
- Date: Wed, 14 Dec 2011 12:07:01 +0000 (UTC)
commit 768ca769392d1dd93a44d2c0ae7ea48211877142
Author: Milan Crha <mcrha redhat com>
Date: Wed Dec 14 13:06:22 2011 +0100
Fix leaks around categories editing
libedataserverui/e-categories-dialog.c | 7 ++++---
libedataserverui/e-categories-dialog.h | 2 +-
libedataserverui/e-categories-editor.c | 12 ++++++++----
libedataserverui/e-categories-editor.h | 2 +-
libedataserverui/e-categories-selector.c | 11 ++++++++---
libedataserverui/e-categories-selector.h | 4 ++--
6 files changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/libedataserverui/e-categories-dialog.c b/libedataserverui/e-categories-dialog.c
index 0be5698..d6b201d 100644
--- a/libedataserverui/e-categories-dialog.c
+++ b/libedataserverui/e-categories-dialog.c
@@ -116,12 +116,13 @@ e_categories_dialog_new (const gchar *categories)
* Gets a comma-separated list of the categories currently selected
* in the dialog.
*
- * Returns: a comma-separated list of categories
+ * Returns: a comma-separated list of categories. Free returned
+ * pointer with g_free().
**/
-const gchar *
+gchar *
e_categories_dialog_get_categories (ECategoriesDialog *dialog)
{
- const gchar *categories;
+ gchar *categories;
g_return_val_if_fail (E_IS_CATEGORIES_DIALOG (dialog), NULL);
diff --git a/libedataserverui/e-categories-dialog.h b/libedataserverui/e-categories-dialog.h
index 63e1e68..dd306b3 100644
--- a/libedataserverui/e-categories-dialog.h
+++ b/libedataserverui/e-categories-dialog.h
@@ -58,7 +58,7 @@ struct _ECategoriesDialogClass {
GType e_categories_dialog_get_type (void);
GtkWidget * e_categories_dialog_new (const gchar *categories);
-const gchar * e_categories_dialog_get_categories
+gchar * e_categories_dialog_get_categories
(ECategoriesDialog *dialog);
void e_categories_dialog_set_categories
(ECategoriesDialog *dialog,
diff --git a/libedataserverui/e-categories-editor.c b/libedataserverui/e-categories-editor.c
index 1af2634..50b68c2 100644
--- a/libedataserverui/e-categories-editor.c
+++ b/libedataserverui/e-categories-editor.c
@@ -91,12 +91,14 @@ category_checked_cb (ECategoriesSelector *selector,
ECategoriesEditor *editor)
{
GtkEntry *entry;
- const gchar *categories;
+ gchar *categories;
entry = GTK_ENTRY (editor->priv->categories_entry);
categories = e_categories_selector_get_checked (selector);
gtk_entry_set_text (entry, categories);
+
+ g_free (categories);
}
static void
@@ -115,7 +117,7 @@ edit_button_clicked_cb (GtkButton *button,
ECategoriesEditor *editor)
{
ECategoryEditor *cat_editor = e_category_editor_new ();
- const gchar *category;
+ gchar *category;
category = e_categories_selector_get_selected (
editor->priv->categories_list);
@@ -123,6 +125,7 @@ edit_button_clicked_cb (GtkButton *button,
e_category_editor_edit_category (cat_editor, category);
gtk_widget_destroy (GTK_WIDGET (cat_editor));
+ g_free (category);
}
static void
@@ -343,11 +346,12 @@ e_categories_editor_new (void)
* Gets a comma-separated list of the categories currently selected
* in the editor.
*
- * Returns: a comma-separated list of categories
+ * Returns: a comma-separated list of categories. Free returned
+ * pointer with g_free().
*
* Since: 3.2
**/
-const gchar *
+gchar *
e_categories_editor_get_categories (ECategoriesEditor *editor)
{
ECategoriesSelector *categories_list;
diff --git a/libedataserverui/e-categories-editor.h b/libedataserverui/e-categories-editor.h
index 04a2410..02a3951 100644
--- a/libedataserverui/e-categories-editor.h
+++ b/libedataserverui/e-categories-editor.h
@@ -68,7 +68,7 @@ struct _ECategoriesEditorClass {
GType e_categories_editor_get_type (void);
GtkWidget * e_categories_editor_new (void);
-const gchar * e_categories_editor_get_categories
+gchar * e_categories_editor_get_categories
(ECategoriesEditor *editor);
void e_categories_editor_set_categories
(ECategoriesEditor *editor,
diff --git a/libedataserverui/e-categories-selector.c b/libedataserverui/e-categories-selector.c
index 4b80e0c..6321f14 100644
--- a/libedataserverui/e-categories-selector.c
+++ b/libedataserverui/e-categories-selector.c
@@ -391,16 +391,19 @@ e_categories_selector_set_items_checkable (ECategoriesSelector *selector,
/**
* e_categories_selector_get_checked:
*
+ * Free returned pointer with g_free().
+ *
* Since: 3.2
**/
-const gchar *
+gchar *
e_categories_selector_get_checked (ECategoriesSelector *selector)
{
- GString *str = g_string_new ("");
+ GString *str;
GList *list, *category;
g_return_val_if_fail (E_IS_CATEGORIES_SELECTOR (selector), NULL);
+ str = g_string_new ("");
list = g_hash_table_get_values (selector->priv->selected_categories);
/* to get them always in the same order */
@@ -532,9 +535,11 @@ e_categories_selector_delete_selection (ECategoriesSelector *selector)
/**
* e_categories_selector_get_selected:
*
+ * Free returned pointer with g_free().
+ *
* Since: 3.2
**/
-const gchar *
+gchar *
e_categories_selector_get_selected (ECategoriesSelector *selector)
{
GtkTreeModel *model;
diff --git a/libedataserverui/e-categories-selector.h b/libedataserverui/e-categories-selector.h
index fa416bc..acb93c0 100644
--- a/libedataserverui/e-categories-selector.h
+++ b/libedataserverui/e-categories-selector.h
@@ -73,7 +73,7 @@ struct _ECategoriesSelectorClass {
GType e_categories_selector_get_type (void);
GtkWidget * e_categories_selector_new (void);
-const gchar * e_categories_selector_get_checked
+gchar * e_categories_selector_get_checked
(ECategoriesSelector *selector);
void e_categories_selector_set_checked
(ECategoriesSelector *selector,
@@ -85,7 +85,7 @@ void e_categories_selector_set_items_checkable
gboolean checkable);
void e_categories_selector_delete_selection
(ECategoriesSelector *selector);
-const gchar * e_categories_selector_get_selected
+gchar * e_categories_selector_get_selected
(ECategoriesSelector *selector);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]