diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2010-06-11 07:36:14 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2010-06-11 07:36:14 +0000 |
commit | cbbe2cb3b468a8bdf8225657fb7d522e133ee24c (patch) | |
tree | 0da0899ac491e1e60195b7a7213a97e115b5b467 /src | |
parent | d4fe7099d2fdfb3e1f06979f010c11da90e72501 (diff) |
added plug-in APIs for folder view.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2569 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/folderview.c | 10 | ||||
-rw-r--r-- | src/folderview.h | 3 | ||||
-rw-r--r-- | src/main.c | 125 | ||||
-rw-r--r-- | src/plugin.c | 67 | ||||
-rw-r--r-- | src/plugin.h | 7 |
5 files changed, 141 insertions, 71 deletions
diff --git a/src/folderview.c b/src/folderview.c index f311bd4f..7585a45b 100644 --- a/src/folderview.c +++ b/src/folderview.c @@ -340,7 +340,7 @@ FolderView *folderview_create(void) debug_print(_("Creating folder view...\n")); folderview = g_new0(FolderView, 1); - vbox = gtk_vbox_new(FALSE, 0); + vbox = gtk_vbox_new(FALSE, 1); scrolledwin = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy @@ -575,6 +575,14 @@ void folderview_reflect_prefs(FolderView *folderview) } } +void folderview_add_sub_widget(FolderView *folderview, GtkWidget *widget) +{ + g_return_if_fail(folderview != NULL); + g_return_if_fail(widget != NULL); + + gtk_box_pack_start(GTK_BOX(folderview->vbox), widget, FALSE, FALSE, 0); +} + FolderView *folderview_get(void) { return (FolderView *)folderview_list->data; diff --git a/src/folderview.h b/src/folderview.h index eb9b8bfd..3d9aaa9a 100644 --- a/src/folderview.h +++ b/src/folderview.h @@ -75,6 +75,9 @@ FolderView *folderview_create (void); void folderview_init (FolderView *folderview); void folderview_reflect_prefs (FolderView *folderview); +void folderview_add_sub_widget (FolderView *folderview, + GtkWidget *widget); + FolderView *folderview_get (void); void folderview_set (FolderView *folderview); @@ -1103,6 +1103,8 @@ static void register_system_events(void) } #endif +#define ADD_SYM(sym) syl_plugin_add_symbol(#sym, sym) + static void plugin_init(void) { MainWindow *mainwin; @@ -1117,29 +1119,31 @@ static void plugin_init(void) return; } - syl_plugin_add_symbol("prog_version", prog_version); - syl_plugin_add_symbol("main_window_lock", main_window_lock); - syl_plugin_add_symbol("main_window_unlock", main_window_unlock); - syl_plugin_add_symbol("main_window_get", main_window_get); - syl_plugin_add_symbol("main_window_popup", main_window_popup); - syl_plugin_add_symbol("app_will_exit", app_will_exit); + ADD_SYM(prog_version); + ADD_SYM(app_will_exit); + + ADD_SYM(main_window_lock); + ADD_SYM(main_window_unlock); + ADD_SYM(main_window_get); + ADD_SYM(main_window_popup); + syl_plugin_add_symbol("main_window_menu_factory", mainwin->menu_factory); syl_plugin_add_symbol("main_window_statusbar", mainwin->statusbar); - syl_plugin_add_symbol("folderview", mainwin->folderview); - syl_plugin_add_symbol("folderview_get_selected_item", - folderview_get_selected_item); - syl_plugin_add_symbol("folderview_check_new", folderview_check_new); - syl_plugin_add_symbol("folderview_check_new_item", - folderview_check_new_item); - syl_plugin_add_symbol("folderview_check_new_all", - folderview_check_new_all); - syl_plugin_add_symbol("folderview_update_item", folderview_update_item); - syl_plugin_add_symbol("folderview_update_item_foreach", - folderview_update_item_foreach); - syl_plugin_add_symbol("folderview_update_all_updated", - folderview_update_all_updated); + ADD_SYM(folderview_get); + ADD_SYM(folderview_add_sub_widget); + ADD_SYM(folderview_select); + ADD_SYM(folderview_unselect); + ADD_SYM(folderview_select_next_unread); + ADD_SYM(folderview_get_selected_item); + ADD_SYM(folderview_check_new); + ADD_SYM(folderview_check_new_item); + ADD_SYM(folderview_check_new_all); + ADD_SYM(folderview_update_item); + ADD_SYM(folderview_update_item_foreach); + ADD_SYM(folderview_update_all_updated); + ADD_SYM(folderview_check_new_selected); syl_plugin_add_symbol("folderview_mail_popup_factory", mainwin->folderview->mail_factory); @@ -1149,55 +1153,44 @@ static void plugin_init(void) mainwin->folderview->news_factory); syl_plugin_add_symbol("summaryview", mainwin->summaryview); - syl_plugin_add_symbol("summary_select_by_msgnum", - summary_select_by_msgnum); - syl_plugin_add_symbol("summary_select_by_msginfo", - summary_select_by_msginfo); - syl_plugin_add_symbol("summary_lock", summary_lock); - syl_plugin_add_symbol("summary_unlock", summary_unlock); - syl_plugin_add_symbol("summary_is_locked", summary_is_locked); - - syl_plugin_add_symbol("messageview_create_with_new_window", - messageview_create_with_new_window); - syl_plugin_add_symbol("messageview_show", messageview_show); - - syl_plugin_add_symbol("compose_new", compose_new); - syl_plugin_add_symbol("compose_entry_set", compose_entry_set); - syl_plugin_add_symbol("compose_entry_append", compose_entry_append); - syl_plugin_add_symbol("compose_entry_get_text", compose_entry_get_text); - syl_plugin_add_symbol("compose_lock", compose_lock); - syl_plugin_add_symbol("compose_unlock", compose_unlock); - - syl_plugin_add_symbol("foldersel_folder_sel", - foldersel_folder_sel); - syl_plugin_add_symbol("foldersel_folder_sel_full", - foldersel_folder_sel_full); - syl_plugin_add_symbol("input_dialog", input_dialog); - syl_plugin_add_symbol("input_dialog_with_invisible", - input_dialog_with_invisible); - - syl_plugin_add_symbol("manage_window_set_transient", - manage_window_set_transient); - syl_plugin_add_symbol("manage_window_signals_connect", - manage_window_signals_connect); - syl_plugin_add_symbol("manage_window_get_focus_window", - manage_window_get_focus_window); - - syl_plugin_add_symbol("inc_mail", inc_mail); - syl_plugin_add_symbol("inc_is_active", inc_is_active); - syl_plugin_add_symbol("inc_lock", inc_lock); - syl_plugin_add_symbol("inc_unlock", inc_unlock); + + ADD_SYM(summary_select_by_msgnum); + ADD_SYM(summary_select_by_msginfo); + ADD_SYM(summary_lock); + ADD_SYM(summary_unlock); + ADD_SYM(summary_is_locked); + + ADD_SYM(messageview_create_with_new_window); + ADD_SYM(messageview_show); + + ADD_SYM(compose_new); + ADD_SYM(compose_entry_set); + ADD_SYM(compose_entry_append); + ADD_SYM(compose_entry_get_text); + ADD_SYM(compose_lock); + ADD_SYM(compose_unlock); + + ADD_SYM(foldersel_folder_sel); + ADD_SYM(foldersel_folder_sel_full); + + ADD_SYM(input_dialog); + ADD_SYM(input_dialog_with_invisible); + + ADD_SYM(manage_window_set_transient); + ADD_SYM(manage_window_signals_connect); + ADD_SYM(manage_window_get_focus_window); + + ADD_SYM(inc_mail); + ADD_SYM(inc_is_active); + ADD_SYM(inc_lock); + ADD_SYM(inc_unlock); #if USE_UPDATE_CHECK - syl_plugin_add_symbol("update_check", update_check); - syl_plugin_add_symbol("update_check_set_check_url", - update_check_set_check_url); - syl_plugin_add_symbol("update_check_get_check_url", - update_check_get_check_url); - syl_plugin_add_symbol("update_check_set_jump_url", - update_check_set_jump_url); - syl_plugin_add_symbol("update_check_get_jump_url", - update_check_get_jump_url); + ADD_SYM(update_check); + ADD_SYM(update_check_set_check_url); + ADD_SYM(update_check_get_check_url); + ADD_SYM(update_check_set_jump_url); + ADD_SYM(update_check_get_jump_url); #endif syl_plugin_signal_connect("plugin-load", G_CALLBACK(load_cb), NULL); diff --git a/src/plugin.c b/src/plugin.c index 2193f405..d7af9810 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -544,10 +544,57 @@ void syl_plugin_menu_set_active(const gchar *path, gboolean is_active) gpointer syl_plugin_folderview_get(void) { - gpointer sym; + gpointer (*func)(void); + GETFUNC("folderview_get"); + return SAFE_CALL_RET(func); +} - sym = syl_plugin_lookup_symbol("folderview"); - return sym; +void syl_plugin_folderview_add_sub_widget(GtkWidget *widget) +{ + void (*func)(gpointer, GtkWidget *); + gpointer folderview; + + folderview = syl_plugin_folderview_get(); + if (folderview) { + GETFUNC("folderview_get"); + SAFE_CALL_ARG2(func, folderview, widget); + } +} + +void syl_plugin_folderview_select(FolderItem *item) +{ + void (*func)(gpointer, FolderItem *); + gpointer folderview; + + folderview = syl_plugin_folderview_get(); + if (folderview) { + GETFUNC("folderview_select"); + SAFE_CALL_ARG2(func, folderview, item); + } +} + +void syl_plugin_folderview_unselect(void) +{ + void (*func)(gpointer); + gpointer folderview; + + folderview = syl_plugin_folderview_get(); + if (folderview) { + GETFUNC("folderview_unselect"); + SAFE_CALL_ARG1(func, folderview); + } +} + +void syl_plugin_folderview_select_next_unread(void) +{ + void (*func)(gpointer); + gpointer folderview; + + folderview = syl_plugin_folderview_get(); + if (folderview) { + GETFUNC("folderview_select_next_unread"); + SAFE_CALL_ARG1(func, folderview); + } } FolderItem *syl_plugin_folderview_get_selected_item(void) @@ -557,7 +604,7 @@ FolderItem *syl_plugin_folderview_get_selected_item(void) folderview = syl_plugin_folderview_get(); if (folderview) { - func = syl_plugin_lookup_symbol("folderview_get_selected_item"); + GETFUNC("folderview_get_selected_item"); return SAFE_CALL_ARG1_RET(func, folderview); } @@ -608,6 +655,18 @@ void syl_plugin_folderview_update_all_updated(gboolean update_summary) SAFE_CALL_ARG1(func, update_summary); } +void syl_plugin_folderview_check_new_selected(void) +{ + void (*func)(gpointer); + gpointer folderview; + + folderview = syl_plugin_folderview_get(); + if (folderview) { + GETFUNC("folderview_check_new_selected"); + SAFE_CALL_ARG1(func, folderview); + } +} + gpointer syl_plugin_summary_view_get(void) { gpointer sym; diff --git a/src/plugin.h b/src/plugin.h index 70da79f8..019ba0ec 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -139,6 +139,12 @@ void syl_plugin_menu_set_active (const gchar *path, /* FolderView */ gpointer syl_plugin_folderview_get (void); + +void syl_plugin_folderview_add_sub_widget (GtkWidget *widget); + +void syl_plugin_folderview_select (FolderItem *item); +void syl_plugin_folderview_unselect (void); +void syl_plugin_folderview_select_next_unread (void); FolderItem *syl_plugin_folderview_get_selected_item (void); @@ -151,6 +157,7 @@ void syl_plugin_folderview_update_item (FolderItem *item, void syl_plugin_folderview_update_item_foreach (GHashTable *table, gboolean update_summary); void syl_plugin_folderview_update_all_updated (gboolean update_summary); +void syl_plugin_folderview_check_new_selected (void); /* SummaryView */ gpointer syl_plugin_summary_view_get (void); |