From 4c19c798f729d167e6dd58872489f5ad7adfea47 Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Tue, 8 Feb 2011 14:51:53 +0800 Subject: [PATCH] Add function documentation --- commands.h | 62 +++++++++++++++++++ completion.h | 7 +++ config.h | 3 + render.h | 28 +++++++-- shortcuts.h | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++ zathura.c | 5 -- zathura.h | 5 +- 7 files changed, 265 insertions(+), 12 deletions(-) diff --git a/commands.h b/commands.h index 5096510..471aa3c 100644 --- a/commands.h +++ b/commands.h @@ -6,12 +6,74 @@ #include #include +/** + * Create a bookmark + * + * @param session The used girara session + * @param argc Number of arguments + * @param argv Value of the arguments + * @return true if no error occured + */ bool cmd_bookmark_create(girara_session_t* session, int argc, char** argv); + +/** + * Delete a bookmark + * + * @param session The used girara session + * @param argc Number of arguments + * @param argv Value of the arguments + * @return true if no error occured + */ bool cmd_bookmark_delete(girara_session_t* session, int argc, char** argv); + +/** + * Open a bookmark + * + * @param session The used girara session + * @param argc Number of arguments + * @param argv Value of the arguments + * @return true if no error occured + */ bool cmd_bookmark_open(girara_session_t* session, int argc, char** argv); + +/** + * Close zathura + * + * @param session The used girara session + * @param argc Number of arguments + * @param argv Value of the arguments + * @return true if no error occured + */ bool cmd_close(girara_session_t* session, int argc, char** argv); + +/** + * Display document information + * + * @param session The used girara session + * @param argc Number of arguments + * @param argv Value of the arguments + * @return true if no error occured + */ bool cmd_info(girara_session_t* session, int argc, char** argv); + +/** + * Print the current file + * + * @param session The used girara session + * @param argc Number of arguments + * @param argv Value of the arguments + * @return true if no error occured + */ bool cmd_print(girara_session_t* session, int argc, char** argv); + +/** + * Save the current file + * + * @param session The used girara session + * @param argc Number of arguments + * @param argv Value of the arguments + * @return true if no error occured + */ bool cmd_save(girara_session_t* session, int argc, char** argv); #endif // COMMANDS_H diff --git a/completion.h b/completion.h index 81800e9..3baba94 100644 --- a/completion.h +++ b/completion.h @@ -5,6 +5,13 @@ #include +/** + * Completion for the print command. Creates a list of available printers + * + * @param session The used girara session + * @param input The current input + * @return The completion object or NULL if an error occured + */ girara_completion_t* cc_print(girara_session_t* session, char* input); #endif // COMPLETION_H diff --git a/config.h b/config.h index 7b8293b..a3a03e7 100644 --- a/config.h +++ b/config.h @@ -3,6 +3,9 @@ #ifndef CONFIG_H #define CONFIG_H +/** + * This function loads the default values of the configuration + */ void config_load_default(void); #endif // CONFIG_H diff --git a/render.h b/render.h index 89e2024..29e2607 100644 --- a/render.h +++ b/render.h @@ -11,14 +11,34 @@ typedef struct render_thread_s { - girara_list_t* list; - GThread* thread; - GMutex* lock; - GCond* cond; + girara_list_t* list; /**> The list of pages */ + GThread* thread; /**> The thread object */ + GMutex* lock; /**> Lock */ + GCond* cond; /**> Condition */ } render_thread_t; +/** + * This function initializes a render thread + * + * @return The render thread object or NULL if an error occured + */ render_thread_t* render_init(void); + +/** + * This function destroys the render thread object + * + * @param render_thread The render thread object + */ void render_free(render_thread_t* render_thread); + +/** + * This function is used to add a page to the render thread list + * that should be rendered. + * + * @param render_thread The render thread object + * @param page The page that should be rendered + * @return true if no error occured + */ bool render_page(render_thread_t* render_thread, zathura_page_t* page); #endif // RENDER_H diff --git a/shortcuts.h b/shortcuts.h index 22b0310..88c21c9 100644 --- a/shortcuts.h +++ b/shortcuts.h @@ -5,26 +5,193 @@ #include +/** + * Abort the current action and return to normal mode + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_abort(girara_session_t* session, girara_argument_t* argument); + +/** + * Adjust the rendered pages to the window + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_adjust_window(girara_session_t* session, girara_argument_t* argument); + +/** + * Modify the current buffer + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_change_buffer(girara_session_t* session, girara_argument_t* argument); + +/** + * Change the current mode + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_change_mode(girara_session_t* session, girara_argument_t* argument); + +/** + * Focus the inputbar + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_focus_inputbar(girara_session_t* session, girara_argument_t* argument); + +/** + * Follow a link + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_follow(girara_session_t* session, girara_argument_t* argument); + +/** + * Go to a specific page or position + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_goto(girara_session_t* session, girara_argument_t* argument); + +/** + * Navigate through the document + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_navigate(girara_session_t* session, girara_argument_t* argument); + +/** + * Recolor the pages + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_recolor(girara_session_t* session, girara_argument_t* argument); + +/** + * Reload the current document + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_reload(girara_session_t* session, girara_argument_t* argument); + +/** + * Rotate the pages + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_rotate(girara_session_t* session, girara_argument_t* argument); + +/** + * Scroll through the pages + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_scroll(girara_session_t* session, girara_argument_t* argument); + +/** + * Search through the document for the latest search item + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_search(girara_session_t* session, girara_argument_t* argument); + +/** + * Switch go to mode (numeric, labels) + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_switch_goto_mode(girara_session_t* session, girara_argument_t* argument); + +/** + * Navigate through the index of the document + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_navigate_index(girara_session_t* session, girara_argument_t* argument); + +/** + * Show/Hide the index of the document + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_toggle_index(girara_session_t* session, girara_argument_t* argument); + +/** + * Show/Hide the inputbar + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_toggle_inputbar(girara_session_t* session, girara_argument_t* argument); + +/** + * Toggle fullscreen mode + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_toggle_fullscreen(girara_session_t* session, girara_argument_t* argument); + +/** + * Show/Hide the statusbar + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_toggle_statusbar(girara_session_t* session, girara_argument_t* argument); + +/** + * Quit zathura + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_quit(girara_session_t* session, girara_argument_t* argument); + +/** + * Change the zoom level + * + * @param session The used girara session + * @param argument The used argument + * @return true if no error occured otherwise false + */ bool sc_zoom(girara_session_t* session, girara_argument_t* argument); #endif // SHORTCUTS_H diff --git a/zathura.c b/zathura.c index 473e2fa..9d92db7 100644 --- a/zathura.c +++ b/zathura.c @@ -25,7 +25,6 @@ init_zathura() Zathura.UI.statusbar.file = NULL; Zathura.UI.statusbar.buffer = NULL; Zathura.UI.statusbar.page_number = NULL; - Zathura.UI.drawing_area = NULL; Zathura.UI.page_view = NULL; /* page view */ @@ -71,10 +70,6 @@ init_zathura() error_free: - if(Zathura.UI.drawing_area) { - g_object_unref(Zathura.UI.drawing_area); - } - if(Zathura.UI.page_view) { g_object_unref(Zathura.UI.page_view); } diff --git a/zathura.h b/zathura.h index f45a8bf..e857ac0 100644 --- a/zathura.h +++ b/zathura.h @@ -37,13 +37,12 @@ struct girara_statusbar_item_t* page_number; /**> page number statusbar entry */ } statusbar; - GtkWidget *drawing_area; - GtkWidget *page_view; + GtkWidget *page_view; /**> Widget that contains all rendered pages */ } UI; struct { - render_thread_t* render_thread; + render_thread_t* render_thread; /**> The thread responsible for rendering the pages */ } Sync; zathura_document_t* document; /**> The current document */