From 8d85229f8fc9ff0e27b1f7790f61605c04337d7b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 28 Jan 2010 17:36:03 -0500 Subject: Sidebar cleanups for Memos and Tasks. Kill the EMemoTable::user-created signal and connect directly to ECalModel::row-appended in e_memo_shell_view_private.c. Same goes for tasks. --- modules/calendar/e-memo-shell-view-private.c | 36 ++++++++++---------- modules/calendar/e-task-shell-view-private.c | 50 +++++++++++++--------------- 2 files changed, 41 insertions(+), 45 deletions(-) (limited to 'modules') diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c index 9e2be0fe7d..2caa6ec2ed 100644 --- a/modules/calendar/e-memo-shell-view-private.c +++ b/modules/calendar/e-memo-shell-view-private.c @@ -24,27 +24,15 @@ #include "widgets/menus/gal-view-factory-etable.h" static void -memo_shell_view_table_popup_event_cb (EShellView *shell_view, - GdkEventButton *event) -{ - const gchar *widget_path; - - widget_path = "/memo-popup"; - e_shell_view_show_popup_menu (shell_view, widget_path, event); -} - -static void -memo_shell_view_table_user_created_cb (EMemoShellView *memo_shell_view, - EMemoTable *memo_table) +memo_shell_view_model_row_appended_cb (EMemoShellView *memo_shell_view, + ECalModel *model) { EMemoShellSidebar *memo_shell_sidebar; - ECalModel *model; ECal *client; ESource *source; /* This is the "Click to Add" handler. */ - model = e_memo_table_get_model (memo_table); client = e_cal_model_get_default_client (model); source = e_cal_get_source (client); @@ -54,6 +42,16 @@ memo_shell_view_table_user_created_cb (EMemoShellView *memo_shell_view, e_cal_model_add_client (model, client); } +static void +memo_shell_view_table_popup_event_cb (EShellView *shell_view, + GdkEventButton *event) +{ + const gchar *widget_path; + + widget_path = "/memo-popup"; + e_shell_view_show_popup_menu (shell_view, widget_path, event); +} + static void memo_shell_view_selector_client_added_cb (EMemoShellView *memo_shell_view, ECal *client) @@ -201,6 +199,11 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view) G_CALLBACK (e_memo_shell_view_update_timezone), memo_shell_view); + g_signal_connect_swapped ( + model, "row-appended", + G_CALLBACK (memo_shell_view_model_row_appended_cb), + memo_shell_view); + g_signal_connect_swapped ( memo_table, "open-component", G_CALLBACK (e_memo_shell_view_open_memo), @@ -226,11 +229,6 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view) G_CALLBACK (e_memo_shell_view_set_status_message), memo_shell_view); - g_signal_connect_swapped ( - memo_table, "user-created", - G_CALLBACK (memo_shell_view_table_user_created_cb), - memo_shell_view); - g_signal_connect_swapped ( model, "model-changed", G_CALLBACK (e_memo_shell_view_update_sidebar), diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c index 4b04185d0d..1cdf6697ff 100644 --- a/modules/calendar/e-task-shell-view-private.c +++ b/modules/calendar/e-task-shell-view-private.c @@ -23,6 +23,25 @@ #include "widgets/menus/gal-view-factory-etable.h" +static void +task_shell_view_model_row_appended_cb (ETaskShellView *task_shell_view, + ECalModel *model) +{ + ETaskShellSidebar *task_shell_sidebar; + ECal *client; + ESource *source; + + /* This is the "Click to Add" handler. */ + + client = e_cal_model_get_default_client (model); + source = e_cal_get_source (client); + + task_shell_sidebar = task_shell_view->priv->task_shell_sidebar; + e_task_shell_sidebar_add_source (task_shell_sidebar, source); + + e_cal_model_add_client (model, client); +} + static void task_shell_view_process_completed_tasks (ETaskShellView *task_shell_view) { @@ -56,27 +75,6 @@ task_shell_view_table_popup_event_cb (EShellView *shell_view, e_shell_view_show_popup_menu (shell_view, widget_path, event); } -static void -task_shell_view_table_user_created_cb (ETaskShellView *task_shell_view, - ETaskTable *task_table) -{ - ETaskShellSidebar *task_shell_sidebar; - ECalModel *model; - ECal *client; - ESource *source; - - /* This is the "Click to Add" handler. */ - - model = e_task_table_get_model (task_table); - client = e_cal_model_get_default_client (model); - source = e_cal_get_source (client); - - task_shell_sidebar = task_shell_view->priv->task_shell_sidebar; - e_task_shell_sidebar_add_source (task_shell_sidebar, source); - - e_cal_model_add_client (model, client); -} - static void task_shell_view_selector_client_added_cb (ETaskShellView *task_shell_view, ECal *client) @@ -253,6 +251,11 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view) G_CALLBACK (e_task_shell_view_update_timezone), task_shell_view); + g_signal_connect_swapped ( + model, "row-appended", + G_CALLBACK (task_shell_view_model_row_appended_cb), + task_shell_view); + g_signal_connect_swapped ( task_table, "open-component", G_CALLBACK (e_task_shell_view_open_task), @@ -278,11 +281,6 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view) G_CALLBACK (e_task_shell_view_set_status_message), task_shell_view); - g_signal_connect_swapped ( - task_table, "user-created", - G_CALLBACK (task_shell_view_table_user_created_cb), - task_shell_view); - g_signal_connect_swapped ( model, "model-changed", G_CALLBACK (e_task_shell_view_update_sidebar), -- cgit