[devhelp: 7/36] book-manager: different signals for book list and disabled book list changes
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp: 7/36] book-manager: different signals for book list and disabled book list changes
- Date: Mon, 20 Dec 2010 14:32:00 +0000 (UTC)
commit b9849175982aca8122efdf8768c871a374a871c4
Author: Aleksander Morgado <aleksander lanedo com>
Date: Thu Dec 2 17:50:19 2010 +0100
book-manager: different signals for book list and disabled book list changes
src/dh-book-manager.c | 20 +++++++++++++++-----
src/dh-book-manager.h | 5 +----
src/dh-book-tree.c | 10 +++++++---
src/dh-search.c | 10 +++++++---
4 files changed, 30 insertions(+), 15 deletions(-)
---
diff --git a/src/dh-book-manager.c b/src/dh-book-manager.c
index c12aae9..507e6f2 100644
--- a/src/dh-book-manager.c
+++ b/src/dh-book-manager.c
@@ -38,6 +38,7 @@ typedef struct {
} DhBookManagerPriv;
enum {
+ BOOK_LIST_UPDATED,
DISABLED_BOOK_LIST_UPDATED,
LAST_SIGNAL
};
@@ -91,11 +92,20 @@ dh_book_manager_class_init (DhBookManagerClass *klass)
object_class->finalize = book_manager_finalize;
+ signals[BOOK_LIST_UPDATED] =
+ g_signal_new ("book-list-updated",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _dh_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
signals[DISABLED_BOOK_LIST_UPDATED] =
g_signal_new ("disabled-book-list-updated",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (DhBookManagerClass, disabled_book_list_updated),
+ 0,
NULL, NULL,
_dh_marshal_VOID__VOID,
G_TYPE_NONE,
@@ -270,7 +280,7 @@ book_manager_booklist_monitor_event_cb (GFileMonitor *file_monitor,
/* Emit signal to notify others */
g_signal_emit (book_manager,
- signals[DISABLED_BOOK_LIST_UPDATED],
+ signals[BOOK_LIST_UPDATED],
0);
}
@@ -463,7 +473,7 @@ book_manager_book_deleted_cb (DhBook *book,
/* Emit signal to notify others */
g_signal_emit (book_manager,
- signals[DISABLED_BOOK_LIST_UPDATED],
+ signals[BOOK_LIST_UPDATED],
0);
}
}
@@ -479,7 +489,7 @@ book_manager_book_updated_cb (DhBook *book,
/* Emit signal to notify others */
g_signal_emit (book_manager,
- signals[DISABLED_BOOK_LIST_UPDATED],
+ signals[BOOK_LIST_UPDATED],
0);
}
@@ -573,7 +583,7 @@ dh_book_manager_get_book_by_path (DhBookManager *book_manager,
}
void
-dh_book_manager_update (DhBookManager *book_manager)
+dh_book_manager_update_disabled (DhBookManager *book_manager)
{
DhBookManagerPriv *priv;
GSList *books_disabled = NULL;
diff --git a/src/dh-book-manager.h b/src/dh-book-manager.h
index 13e40e6..0f6499e 100644
--- a/src/dh-book-manager.h
+++ b/src/dh-book-manager.h
@@ -43,9 +43,6 @@ struct _DhBookManager {
struct _DhBookManagerClass {
GObjectClass parent_class;
-
- /* Signals */
- void (* disabled_book_list_updated) (DhBookManager *book_manager);
};
GType dh_book_manager_get_type (void) G_GNUC_CONST;
@@ -56,7 +53,7 @@ DhBook *dh_book_manager_get_book_by_name (DhBookManager *book_manager
const gchar *name);
DhBook *dh_book_manager_get_book_by_path (DhBookManager *book_manager,
const gchar *path);
-void dh_book_manager_update (DhBookManager *book_manager);
+void dh_book_manager_update_disabled (DhBookManager *book_manager);
G_END_DECLS
diff --git a/src/dh-book-tree.c b/src/dh-book-tree.c
index d6be62e..732e395 100644
--- a/src/dh-book-tree.c
+++ b/src/dh-book-tree.c
@@ -183,8 +183,8 @@ book_tree_populate_tree (DhBookTree *tree)
}
static void
-book_manager_disabled_book_list_changed_cb (DhBookManager *book_manager,
- gpointer user_data)
+book_manager_book_list_changed_cb (DhBookManager *book_manager,
+ gpointer user_data)
{
DhBookTree *tree = user_data;
book_tree_populate_tree (tree);
@@ -261,7 +261,11 @@ dh_book_tree_new (DhBookManager *book_manager)
priv->book_manager = g_object_ref (book_manager);
g_signal_connect (priv->book_manager,
"disabled-book-list-updated",
- G_CALLBACK (book_manager_disabled_book_list_changed_cb),
+ G_CALLBACK (book_manager_book_list_changed_cb),
+ tree);
+ g_signal_connect (priv->book_manager,
+ "book-list-updated",
+ G_CALLBACK (book_manager_book_list_changed_cb),
tree);
book_tree_populate_tree (tree);
diff --git a/src/dh-search.c b/src/dh-search.c
index 0b58852..8bdb187 100644
--- a/src/dh-search.c
+++ b/src/dh-search.c
@@ -597,8 +597,8 @@ search_completion_populate (DhSearch *search)
}
static void
-book_manager_disabled_book_list_changed_cb (DhBookManager *book_manager,
- gpointer user_data)
+book_manager_book_list_changed_cb (DhBookManager *book_manager,
+ gpointer user_data)
{
DhSearch *search = user_data;
@@ -624,7 +624,11 @@ dh_search_new (DhBookManager *book_manager)
priv->book_manager = g_object_ref (book_manager);
g_signal_connect (priv->book_manager,
"disabled-book-list-updated",
- G_CALLBACK (book_manager_disabled_book_list_changed_cb),
+ G_CALLBACK (book_manager_book_list_changed_cb),
+ search);
+ g_signal_connect (priv->book_manager,
+ "book-list-updated",
+ G_CALLBACK (book_manager_book_list_changed_cb),
search);
gtk_container_set_border_width (GTK_CONTAINER (search), 2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]