[devhelp: 28/36] book-manager: notify languages enabled or disabled
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp: 28/36] book-manager: notify languages enabled or disabled
- Date: Mon, 20 Dec 2010 14:33:46 +0000 (UTC)
commit 14029c05f3bfa409b3894d9fcc671058b3c1d400
Author: Aleksander Morgado <aleksander lanedo com>
Date: Wed Dec 15 19:14:51 2010 +0100
book-manager: notify languages enabled or disabled
src/dh-book-manager.c | 38 ++++++++++++++++++++++++++++++++++++--
1 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/src/dh-book-manager.c b/src/dh-book-manager.c
index 018c362..c333cd2 100644
--- a/src/dh-book-manager.c
+++ b/src/dh-book-manager.c
@@ -60,6 +60,8 @@ enum {
BOOK_DELETED,
BOOK_ENABLED,
BOOK_DISABLED,
+ LANGUAGE_ENABLED,
+ LANGUAGE_DISABLED,
BOOKLIST_GROUP_BY_LANGUAGE,
LAST_SIGNAL
};
@@ -189,6 +191,27 @@ dh_book_manager_class_init (DhBookManagerClass *klass)
1,
G_TYPE_OBJECT);
+ signals[LANGUAGE_ENABLED] =
+ g_signal_new ("language-enabled",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _dh_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING);
+ signals[LANGUAGE_DISABLED] =
+ g_signal_new ("language-disabled",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _dh_marshal_VOID__STRING,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_STRING);
+
g_object_class_install_property (object_class,
PROP_GROUP_BY_LANGUAGE,
g_param_spec_boolean ("group-by-language",
@@ -828,9 +851,14 @@ book_manager_inc_language (DhBookManager *book_manager,
if (!li) {
lang_data = g_new (DhBookManagerLanguage, 1);
lang_data->name = g_strdup (language);
- lang_data->n_books_enabled = 0;
+ lang_data->n_books_enabled = 1;
priv->languages = g_list_prepend (priv->languages,
lang_data);
+ /* Emit signal to notify others */
+ g_signal_emit (book_manager,
+ signals[LANGUAGE_ENABLED],
+ 0,
+ language);
}
}
@@ -852,7 +880,7 @@ book_manager_dec_language (DhBookManager *book_manager,
}
}
- /* Language must always be found */
+ /* Language */
g_assert (li != NULL);
g_assert (lang_data->n_books_enabled >= 0);
@@ -861,6 +889,12 @@ book_manager_dec_language (DhBookManager *book_manager,
g_free (lang_data->name);
g_free (lang_data);
priv->languages = g_list_delete_link (priv->languages, li);
+
+ /* Emit signal to notify others */
+ g_signal_emit (book_manager,
+ signals[LANGUAGE_DISABLED],
+ 0,
+ language);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]