# HG changeset patch # User Will Thompson # Date 1192633241 0 # Node ID 6bbd023f038750831326319b0853a88322fc598d # Parent ae330012956f7d355134bfa57dcb9d3140ae1ad5# Parent e747ac0c42d628ea46e47c1369ceb87ba73df07f propagate from branch 'im.pidgin.pidgin.next.minor' (head 365b126365cc18309aea7f8eef0e9b2a19e6bda8) to branch 'im.pidgin.cpw.resiak.disconnectreason' (head 75e53ad0238f484c85aa2db94c12cd3f6872f8f6) diff -r e747ac0c42d6 -r 6bbd023f0387 ChangeLog --- a/ChangeLog Mon Oct 15 10:45:46 2007 +0000 +++ b/ChangeLog Wed Oct 17 15:00:41 2007 +0000 @@ -20,6 +20,8 @@ remove the plugin from the list of saved plugins so it won't load at the next startup. Previously, we were ignoring this case, which could lead to crashes. + * It's possible to bind key-strokes to specific menuitems in the windows. + Read the 'Menus' section in the man-page for details. version 2.2.2: http://developer.pidgin.im/query?status=closed&milestone=2.2.2 diff -r e747ac0c42d6 -r 6bbd023f0387 ChangeLog.API --- a/ChangeLog.API Mon Oct 15 10:45:46 2007 +0000 +++ b/ChangeLog.API Wed Oct 17 15:00:41 2007 +0000 @@ -9,6 +9,7 @@ details) (Stefan Ott) * libpurple/purple.h, which includes #define's and #include's required to compile stand-alone plugins + * PURPLE_STATUS_TUNE as a new PurpleStatusPrimitive * purple_plugin_disable(), which is intended to be called when a purple_plugin_unload()--which was called when a user tried to unload a plugin--fails. This then prevents the plugin @@ -97,6 +98,29 @@ * purple_request_ok_cancel() * purple_request_yes_no() + MSN: + * A new independant status type with PURPLE_STATUS_TUNE primitive, and + PURPLE_TUNE_ARTIST, PURPLE_TUNE_ALBUM and PURPLE_TUNE_TITLE + attributes. + + XMPP: + * A new independant status type with PURPLE_STATUS_TUNE primitive, and + PURPLE_TUNE_{ARTIST, TITLE, ALBUM, GENRE, COMMENT, TRACK, TIME, + YEAR, URL} attributes. + + Finch: + libgnt: + * Added gnt_color_pair, which will try to intelligenty set text + attributes in place of colors if the terminal doesn't have color + support. (Bug: #3560) All future code should use gnt_color_pair + instead of COLOR_PAIR. + * Added gnt_menuitem_set_id and gnt_menuitem_get_id to set and get the + string id of a menuitem respectively. + * Added gnt_window_get_accel_item, which returns a the id of a menuitem + bound to a keystroke. + * Added gnt_menu_get_item to activate and return a menuitem of the + given id from a menu. + version 2.2.2 (??/??/????): libpurple: Changed: diff -r e747ac0c42d6 -r 6bbd023f0387 doc/finch.1.in --- a/doc/finch.1.in Mon Oct 15 10:45:46 2007 +0000 +++ b/doc/finch.1.in Wed Oct 17 15:00:41 2007 +0000 @@ -351,6 +351,35 @@ one of \fBa-\fR, \fBalt-\fR, \fBm-\fR or \fBmeta-\fR. You can also use \fBhome\fR, \fBend\fR, \fBleft\fR, \fBright\fR etc. keys. +.SH Menus +You can also specify key-bindings to trigger specific menuitems in windows. For example, the following entry in \fI~/.gntrc\fR will bind \fBCtrl + t\fR to the 'Send IM...' item in the buddylist: + +[buddylist::menu] +.br +c-t = send-im + +The following is the list of IDs of the current menuitems in the buddylist: + +send-im +.br +join-chat +.br +show-empty-groups +.br +show-offline-buddies +.br +sort-status +.br +sort-alpha +.br +sort-log +.br +add-buddy +.br +add-chat +.br +add-group + .SH Mouse Support There is experimental mouse support. You can focus windows, activate buttons, select rows in a list, scroll using the wheel-scroll etc. Selecting text in a diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gnt.h --- a/finch/libgnt/gnt.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gnt.h Wed Oct 17 15:00:41 2007 +0000 @@ -46,19 +46,19 @@ #endif /** - * + * Initialize GNT. */ void gnt_init(void); /** - * + * Start running the mainloop for gnt. */ void gnt_main(void); /** - * + * Check whether the terminal is capable of UTF8 display. * - * @return + * @return @c FALSE if the terminal is capable of drawing UTF-8, @c TRUE otherwise. */ gboolean gnt_ascii_only(void); @@ -71,106 +71,133 @@ * @since 2.0.0 (gnt), 2.1.0 (pidgin) */ void gnt_window_present(GntWidget *window); + /** - * - * @param widget + * @internal + * Use #gnt_widget_show instead. */ void gnt_screen_occupy(GntWidget *widget); /** - * - * @param widget + * @internal + * Use #gnt_widget_hide instead. */ void gnt_screen_release(GntWidget *widget); /** - * - * @param widget + * @internal + * Use #gnt_widget_draw instead. */ void gnt_screen_update(GntWidget *widget); /** - * - * @param widget - * @param width - * @param height + * Resize a widget. + * + * @param widget The widget to resize. + * @param width The desired width. + * @param height The desired height. */ void gnt_screen_resize_widget(GntWidget *widget, int width, int height); /** - * - * @param widget - * @param x - * @param y + * Move a widget. + * + * @param widget The widget to move. + * @param x The desired x-coordinate. + * @param y The desired y-coordinate. */ void gnt_screen_move_widget(GntWidget *widget, int x, int y); /** - * - * @param widget - * @param text + * Rename a widget. + * + * @param widget The widget to rename. + * @param text The new name for the widget. */ void gnt_screen_rename_widget(GntWidget *widget, const char *text); /** - * - * @param widget + * Check whether a widget has focus. * - * @return + * @param widget The widget. + * + * @return @c TRUE if the widget has the current focus, @c FALSE otherwise. */ gboolean gnt_widget_has_focus(GntWidget *widget); /** - * - * @param widget + * Set the URGENT hint for a widget. + * + * @param widget The widget to set the URGENT hint for. */ void gnt_widget_set_urgent(GntWidget *widget); /** - * - * @param label - * @param callback + * Register a global action. + * + * @param label The user-visible label for the action. + * @param callback The callback function for the action. */ void gnt_register_action(const char *label, void (*callback)()); /** - * - * @param menu + * Show a menu. * - * @return + * @param menu The menu to display. + * + * @return @c TRUE if the menu is displayed, @c FALSE otherwise (e.g., if another menu is currently displayed). */ gboolean gnt_screen_menu_show(gpointer menu); /** - * + * Terminate the mainloop of gnt. */ void gnt_quit(void); /** - * + * Get the global clipboard. * - * @return + * @return The clipboard. */ GntClipboard * gnt_get_clipboard(void); /** - * + * Get the string in the clipboard. * - * @return + * @return A copy of the string in the clipboard. The caller must @c g_free the string. */ gchar * gnt_get_clipboard_string(void); /** - * - * @param string + * Set the contents of the global clipboard. + * + * @param string The new content of the new clipboard. */ -void gnt_set_clipboard_string(gchar *string); +void gnt_set_clipboard_string(const gchar *string); /** * Spawn a different application that will consume the console. + * + * @param wd The working directory for the new application. + * @param argv The argument vector. + * @param envp The environment, or @c NULL. + * @param stin Location to store the child's stdin, or @c NULL. + * @param stout Location to store the child's stdout, or @c NULL. + * @param sterr Location to store the child's stderr, or @c NULL. + * @param callback The callback to call after the child exits. + * @param data The data to pass to the callback. + * + * @return @c TRUE if the child was successfully spawned, @c FALSE otherwise. */ gboolean gnt_giveup_console(const char *wd, char **argv, char **envp, gint *stin, gint *stout, gint *sterr, void (*callback)(int status, gpointer data), gpointer data); +/** + * Check whether a child process is in control of the current terminal. + * + * @return @c TRUE if a child process (eg., PAGER) is occupying the current + * terminal, @c FALSE otherwise. + */ gboolean gnt_is_refugee(void); + diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntbindable.h --- a/finch/libgnt/gntbindable.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntbindable.h Wed Oct 17 15:00:41 2007 +0000 @@ -160,8 +160,8 @@ /** * Returns a GntTree populated with "key" -> "binding" for the widget. - * - * @param widget The object to list the bindings for. + * + * @param bind The object to list the bindings for. * * @return The GntTree. */ @@ -170,9 +170,9 @@ /** * Builds a window that list the key bindings for a GntBindable object. * From this window a user can select a listing to rebind a new key for the given action. - * + * * @param bindable The object to list the bindings for. - * + * * @return @c TRUE */ diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntbox.c --- a/finch/libgnt/gntbox.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntbox.c Wed Oct 17 15:00:41 2007 +0000 @@ -80,12 +80,12 @@ get_title_thingies(box, title, &pos, &right); if (gnt_widget_has_focus(widget)) - wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TITLE)); + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_TITLE)); else - wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TITLE_D)); - mvwaddch(widget->window, 0, pos-1, ACS_RTEE | COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_TITLE_D)); + mvwaddch(widget->window, 0, pos-1, ACS_RTEE | gnt_color_pair(GNT_COLOR_NORMAL)); mvwaddstr(widget->window, 0, pos, title); - mvwaddch(widget->window, 0, right, ACS_LTEE | COLOR_PAIR(GNT_COLOR_NORMAL)); + mvwaddch(widget->window, 0, right, ACS_LTEE | gnt_color_pair(GNT_COLOR_NORMAL)); g_free(title); } @@ -603,7 +603,7 @@ /* Erase the old title */ int pos, right; get_title_thingies(b, prev, &pos, &right); - mvwhline(w->window, 0, pos - 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), + mvwhline(w->window, 0, pos - 1, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), right - pos + 2); g_free(prev); } diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntbutton.c --- a/finch/libgnt/gntbutton.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntbutton.c Wed Oct 17 15:00:41 2007 +0000 @@ -47,7 +47,7 @@ else type = GNT_COLOR_NORMAL; - wbkgdset(widget->window, '\0' | COLOR_PAIR(type)); + wbkgdset(widget->window, '\0' | gnt_color_pair(type)); mvwaddstr(widget->window, (small_button) ? 0 : 1, 2, button->priv->text); if (small_button) { type = GNT_COLOR_HIGHLIGHT; @@ -126,6 +126,7 @@ widget->priv.minh = small_button ? 1 : 3; if (small_button) GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); + GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_GROW_X | GNT_WIDGET_GROW_Y); GNTDEBUG; } diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntcheckbox.c --- a/finch/libgnt/gntcheckbox.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntcheckbox.c Wed Oct 17 15:00:41 2007 +0000 @@ -43,13 +43,13 @@ else type = GNT_COLOR_NORMAL; - wbkgdset(widget->window, '\0' | COLOR_PAIR(type)); + wbkgdset(widget->window, '\0' | gnt_color_pair(type)); text = g_strdup_printf("[%c]", cb->checked ? 'X' : ' '); mvwaddstr(widget->window, 0, 0, text); g_free(text); - wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL)); mvwaddstr(widget->window, 0, 4, GNT_BUTTON(cb)->priv->text); GNTDEBUG; diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntcolors.c --- a/finch/libgnt/gntcolors.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntcolors.c Wed Oct 17 15:00:41 2007 +0000 @@ -32,6 +32,7 @@ #include #include +static gboolean hascolors; static struct { short r, g, b; @@ -75,6 +76,8 @@ init = TRUE; start_color(); + if (!(hascolors = has_colors())) + return; defaults = use_default_colors(); if (can_use_custom_color()) @@ -276,3 +279,11 @@ } #endif /* GKeyFile */ + +int gnt_color_pair(int pair) +{ + return (hascolors ? COLOR_PAIR(pair) : + ((pair == GNT_COLOR_NORMAL || pair == GNT_COLOR_HIGHLIGHT_D || + pair == GNT_COLOR_TITLE_D || pair == GNT_COLOR_DISABLED) ? 0 : A_STANDOUT)); +} + diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntcolors.h --- a/finch/libgnt/gntcolors.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntcolors.h Wed Oct 17 15:00:41 2007 +0000 @@ -88,4 +88,17 @@ #endif +/** + * Return the appropriate character attribute for a specified color. + * If the terminal doesn't have color support, this returns A_STANDOUT + * when deemed appropriate. + * + * @param color The color code. + * + * @return A character attribute. + * + * @since 2.3.0 + */ +int gnt_color_pair(int color); + #endif diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntcombobox.c --- a/finch/libgnt/gntcombobox.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntcombobox.c Wed Oct 17 15:00:41 2007 +0000 @@ -85,15 +85,15 @@ else type = GNT_COLOR_NORMAL; - wbkgdset(widget->window, '\0' | COLOR_PAIR(type)); + wbkgdset(widget->window, '\0' | gnt_color_pair(type)); s = (char*)gnt_util_onscreen_width_to_pointer(text, widget->priv.width - 4, &len); *s = '\0'; mvwaddstr(widget->window, 1, 1, text); - whline(widget->window, ' ' | COLOR_PAIR(type), widget->priv.width - 4 - len); - mvwaddch(widget->window, 1, widget->priv.width - 3, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL)); - mvwaddch(widget->window, 1, widget->priv.width - 2, ACS_DARROW | COLOR_PAIR(GNT_COLOR_NORMAL)); + whline(widget->window, ' ' | gnt_color_pair(type), widget->priv.width - 4 - len); + mvwaddch(widget->window, 1, widget->priv.width - 3, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL)); + mvwaddch(widget->window, 1, widget->priv.width - 2, ACS_DARROW | gnt_color_pair(GNT_COLOR_NORMAL)); g_free(text); GNTDEBUG; diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntentry.c --- a/finch/libgnt/gntentry.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntentry.c Wed Oct 17 15:00:41 2007 +0000 @@ -201,9 +201,9 @@ gboolean focus; if ((focus = gnt_widget_has_focus(widget))) - wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_TEXT_NORMAL)); + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_TEXT_NORMAL)); else - wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D)); if (entry->masked) { diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntfilesel.c --- a/finch/libgnt/gntfilesel.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntfilesel.c Wed Oct 17 15:00:41 2007 +0000 @@ -718,6 +718,7 @@ void gnt_file_sel_set_suggested_filename(GntFileSel *sel, const char *suggest) { + g_free(sel->suggest); sel->suggest = g_strdup(suggest); } diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntfilesel.h --- a/finch/libgnt/gntfilesel.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntfilesel.h Wed Oct 17 15:00:41 2007 +0000 @@ -98,113 +98,123 @@ G_BEGIN_DECLS /** - * - * - * @return + * @return GType for GntFileSel. */ GType gnt_file_sel_get_gtype(void); /** - * + * Create a new file selector. * - * @return + * @return The newly created file selector. */ GntWidget * gnt_file_sel_new(void); /** - * - * @param sel - * @param path + * Set the current location of the file selector. * - * @return + * @param sel The file selector. + * @param path The current path of the selector. + * + * @return @c TRUE if the current location was successfully changed, @c FALSE otherwise. */ gboolean gnt_file_sel_set_current_location(GntFileSel *sel, const char *path); /** - * - * @param sel - * @param dirs + * Set wheter to only allow selecting directories. + * + * @param sel The file selector. + * @param dirs @c TRUE if only directories can be selected, @c FALSE if files + * can also be selected. */ void gnt_file_sel_set_dirs_only(GntFileSel *sel, gboolean dirs); /** - * - * @param sel + * Check whether the file selector allows only selecting directories. * - * @return + * @param sel The file selector. + * + * @return @c TRUE if only directories can be selected. */ gboolean gnt_file_sel_get_dirs_only(GntFileSel *sel); /** - * - * @param sel - * @param must + * Set whether a selected file must exist. + * + * @param sel The file selector. + * @param must @c TRUE if the selected file must exist. */ void gnt_file_sel_set_must_exist(GntFileSel *sel, gboolean must); /** - * - * @param sel + * Check whether the selector allows selecting non-existent files. * - * @return + * @param sel The file selector. + * + * @return @c TRUE if the selected file must exist, @c FALSE if a non-existent + * file can be selected. */ gboolean gnt_file_sel_get_must_exist(GntFileSel *sel); /** - * - * @param sel + * Get the selected file in the selector. * - * @return + * @param sel The file selector. + * + * @return The path of the selected file. The caller should g_free the returned + * string. */ char * gnt_file_sel_get_selected_file(GntFileSel *sel); - /* The returned value should be free'd */ - /** - * - * @param sel + * Get the list of selected files in the selector. * - * @return + * @param sel The file selector. + * + * @return A list of paths for the selected files. The caller must g_free the + * contents of the list, and g_list_free the list. */ GList * gnt_file_sel_get_selected_multi_files(GntFileSel *sel); /** - * - * @param sel - * @param set + * Allow selecting multiple files. + * + * @param sel The file selector. + * @param set @c TRUE if selecting multiple files should be allowed. */ void gnt_file_sel_set_multi_select(GntFileSel *sel, gboolean set); /** - * - * @param sel - * @param suggest + * Set the suggested file to have selected at startup. + * + * @param sel The file selector. + * @param suggest The suggested filename. */ void gnt_file_sel_set_suggested_filename(GntFileSel *sel, const char *suggest); /** - * - * @param sel - * @param path - * @param files - * @param error) + * Set custom functions to read the names of files. + * + * @param sel The file selector. + * @param read_fn The custom read function. */ void gnt_file_sel_set_read_fn(GntFileSel *sel, gboolean (*read_fn)(const char *path, GList **files, GError **error)); /** - * - * @param name - * @param size + * Create a new GntFile. * - * @return + * @param name The name of the file. + * @param size The size of the file. + * + * @return The newly created GntFile. */ GntFile* gnt_file_new(const char *name, unsigned long size); /** - * - * @param name + * Create a new GntFile for a directory. * - * @return + * @param name The name of the directory. + * + * @return The newly created GntFile. */ GntFile* gnt_file_new_dir(const char *name); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntkeys.h --- a/finch/libgnt/gntkeys.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntkeys.h Wed Oct 17 15:00:41 2007 +0000 @@ -104,41 +104,59 @@ #define GNT_KEY_F12 SAFE(key_f12) /** - * This will do stuff with the terminal settings and stuff. - */ -/** - * + * Initialize the keys. */ void gnt_init_keys(void); /** - * - * @param text + * Refine input text. This usually looks at what the terminal claims it is, + * and tries to change the text to work around some oft-broken terminfo entries. + * + * @param text The input text to refine. */ void gnt_keys_refine(char *text); +/** + * Translate a user-readable representation of an input to a machine-readable representation. + * + * @param name The user-readable representation of an input (eg.: c-t) + * + * @return A machine-readable representation of the input. + */ const char *gnt_key_translate(const char *name); + +/** + * Translate a machine-readable representation of an input to a user-readable representation. + * + * @param key The machine-readable representation of an input. + * + * @return A user-readable representation of the input (eg.: c-t). + */ const char *gnt_key_lookup(const char *key); /** - * - * @param path + * Add a key combination to the internal key-tree. + * + * @param key The key to add */ -void gnt_keys_add_combination(const char *path); +void gnt_keys_add_combination(const char *key); /** - * - * @param path + * Remove a key combination from the internal key-tree. + * + * @param key The key to remove. */ -void gnt_keys_del_combination(const char *path); +void gnt_keys_del_combination(const char *key); /** - * - * @param path + * Find a combination from the given string. + * + * @param key The input string. * - * @return + * @return The number of bytes in the combination that starts at the beginning + * of key (can be 0). */ -int gnt_keys_find_combination(const char *path); +int gnt_keys_find_combination(const char *key); /* A lot of commonly used variable names are defined in . * #undef them to make life easier for everyone. */ diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntlabel.h --- a/finch/libgnt/gntlabel.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntlabel.h Wed Oct 17 15:00:41 2007 +0000 @@ -67,33 +67,34 @@ G_BEGIN_DECLS /** - * - * - * @return + * @return GType for GntLabel. */ GType gnt_label_get_gtype(void); /** - * - * @param text + * Create a new GntLabel. * - * @return + * @param text The text of the label. + * + * @return The newly created label. */ GntWidget * gnt_label_new(const char *text); /** - * - * @param text - * @param flags + * Create a new label with specified text attributes. * - * @return + * @param text The text. + * @param flags Text attributes for the text. + * + * @return The newly created label. */ GntWidget * gnt_label_new_with_format(const char *text, GntTextFormatFlags flags); /** - * - * @param label - * @param text + * Change the text of a label. + * + * @param label The label. + * @param text The new text to set in the label. */ void gnt_label_set_text(GntLabel *label, const char *text); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntline.c --- a/finch/libgnt/gntline.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntline.c Wed Oct 17 15:00:41 2007 +0000 @@ -40,10 +40,10 @@ { GntLine *line = GNT_LINE(widget); if (line->vertical) - mvwvline(widget->window, 1, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), + mvwvline(widget->window, 1, 0, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.height - 2); else - mvwhline(widget->window, 0, 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), + mvwhline(widget->window, 0, 1, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.width - 2); } diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntline.h --- a/finch/libgnt/gntline.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntline.h Wed Oct 17 15:00:41 2007 +0000 @@ -67,9 +67,7 @@ G_BEGIN_DECLS /** - * - * - * @return + * @return GType for GntLine. */ GType gnt_line_get_gtype(void); @@ -77,10 +75,11 @@ #define gnt_vline_new() gnt_line_new(TRUE) /** - * - * @param vertical + * Create new line * - * @return + * @param vertical @c TRUE if the line should be vertical, @c FALSE for a horizontal line. + * + * @return The newly created line. */ GntWidget * gnt_line_new(gboolean vertical); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntmain.c --- a/finch/libgnt/gntmain.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntmain.c Wed Oct 17 15:00:41 2007 +0000 @@ -482,7 +482,7 @@ gnt_init_colors(); - wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgdset(stdscr, '\0' | gnt_color_pair(GNT_COLOR_NORMAL)); refresh(); #ifdef ALL_MOUSE_EVENTS @@ -490,7 +490,7 @@ mousemask(ALL_MOUSE_EVENTS | REPORT_MOUSE_POSITION, NULL); #endif - wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgdset(stdscr, '\0' | gnt_color_pair(GNT_COLOR_NORMAL)); werase(stdscr); wrefresh(stdscr); @@ -646,7 +646,7 @@ return TRUE; } -void gnt_set_clipboard_string(gchar *string) +void gnt_set_clipboard_string(const gchar *string) { gnt_clipboard_set_string(clipboard, string); } diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntmenu.c --- a/finch/libgnt/gntmenu.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntmenu.c Wed Oct 17 15:00:41 2007 +0000 @@ -56,12 +56,12 @@ int i; if (menu->type == GNT_MENU_TOPLEVEL) { - wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT)); + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_HIGHLIGHT)); werase(widget->window); for (i = 0, iter = menu->list; iter; iter = iter->next, i++) { GntMenuItem *item = GNT_MENU_ITEM(iter->data); - type = ' ' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT); + type = ' ' | gnt_color_pair(GNT_COLOR_HIGHLIGHT); if (i == menu->selected) type |= A_REVERSE; item->priv.x = getcurx(widget->window) + widget->priv.x; diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntmenu.h --- a/finch/libgnt/gntmenu.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntmenu.h Wed Oct 17 15:00:41 2007 +0000 @@ -108,12 +108,14 @@ void gnt_menu_add_item(GntMenu *menu, GntMenuItem *item); /** - * Get the GntMenuItem with the given ID. + * Activate and return the GntMenuItem with the given ID. * * @param menu The menu. * @param id The ID for an item. * * @return The menuitem with the given ID, or @c NULL. + * + * @since 2.3.0 */ GntMenuItem *gnt_menu_get_item(GntMenu *menu, const char *id); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntmenuitem.h --- a/finch/libgnt/gntmenuitem.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntmenuitem.h Wed Oct 17 15:00:41 2007 +0000 @@ -123,6 +123,8 @@ * @param item The menuitem. * * @return The submenu, or @c NULL. + * + * @since 2.3.0 */ GntMenu *gnt_menuitem_get_submenu(GntMenuItem *item); @@ -150,6 +152,8 @@ * * @param item The menuitem. * @param id The ID for the menuitem. + * + * @since 2.3.0 */ void gnt_menuitem_set_id(GntMenuItem *item, const char *id); @@ -159,6 +163,8 @@ * @param item The menuitem. * * @return The ID for the menuitem. + * + * @since 2.3.0 */ const char * gnt_menuitem_get_id(GntMenuItem *item); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntmenuitemcheck.h --- a/finch/libgnt/gntmenuitemcheck.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntmenuitemcheck.h Wed Oct 17 15:00:41 2007 +0000 @@ -66,32 +66,33 @@ G_BEGIN_DECLS /** - * - * - * @return + * @return GType for GntMenuItemCheck. */ GType gnt_menuitem_check_get_gtype(void); /** - * - * @param text + * Create a new menuitem. * - * @return + * @param text The text for the menuitem. + * + * @return The newly created menuitem. */ GntMenuItem * gnt_menuitem_check_new(const char *text); /** - * - * @param item + * Check whether the menuitem is checked or not. * - * @return + * @param item The menuitem. + * + * @return @c TRUE if the item is checked, @c FALSE otherwise. */ gboolean gnt_menuitem_check_get_checked(GntMenuItemCheck *item); /** - * - * @param item - * @param set + * Set whether the menuitem is checked or not. + * + * @param item The menuitem. + * @param set @c TRUE if the item should be checked, @c FALSE otherwise. */ void gnt_menuitem_check_set_checked(GntMenuItemCheck *item, gboolean set); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntslider.c --- a/finch/libgnt/gntslider.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntslider.c Wed Oct 17 15:00:41 2007 +0000 @@ -84,21 +84,21 @@ else position = 0; if (slider->vertical) { - mvwvline(widget->window, size-position, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL) | A_BOLD, + mvwvline(widget->window, size-position, 0, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL) | A_BOLD, position); - mvwvline(widget->window, 0, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), + mvwvline(widget->window, 0, 0, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL), size-position); } else { - mvwhline(widget->window, 0, 0, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL) | A_BOLD, + mvwhline(widget->window, 0, 0, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL) | A_BOLD, position); - mvwhline(widget->window, 0, position, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), + mvwhline(widget->window, 0, position, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), size - position); } mvwaddch(widget->window, slider->vertical ? (size - position - 1) : 0, slider->vertical ? 0 : position, - ACS_CKBOARD | COLOR_PAIR(attr)); + ACS_CKBOARD | gnt_color_pair(attr)); } static void diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntstyle.h --- a/finch/libgnt/gntstyle.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntstyle.h Wed Oct 17 15:00:41 2007 +0000 @@ -38,11 +38,17 @@ } GntStyle; /** - * - * @param filename + * Read configuration from a file. + * + * @param filename The filename to read configuration from. */ void gnt_style_read_configure_file(const char *filename); +/** + * Get the user-setting for a style. + * @param style The style. + * @return The user-setting, or @c NULL. + */ const char *gnt_style_get(GntStyle style); /** @@ -70,30 +76,27 @@ gboolean gnt_style_parse_bool(const char *value); /** - * - * @param style - * @param def + * Get the boolean value for a user-setting. * - * @return + * @param style The style. + * @param def The default value (i.e, the value if the user didn't define + * any value) + * + * @return The value of the setting. */ gboolean gnt_style_get_bool(GntStyle style, gboolean def); -/* This should be called only once for the each type */ /** - * - * @param type - * @param hash + * @internal */ void gnt_styles_get_keyremaps(GType type, GHashTable *hash); /** - * - * @param type - * @param klass + * @internal */ void gnt_style_read_actions(GType type, GntBindableClass *klass); -/* +/** * Read menu-accels from ~/.gntrc * * @param name The name of the window. @@ -103,15 +106,19 @@ */ gboolean gnt_style_read_menu_accels(const char *name, GHashTable *table); +/** + * @internal + * Read workspace information. + */ void gnt_style_read_workspaces(GntWM *wm); /** - * + * Initialize style settings. */ void gnt_init_styles(void); /** - * + * Uninitialize style settings. */ void gnt_uninit_styles(void); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gnttextview.c --- a/finch/libgnt/gnttextview.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gnttextview.c Wed Oct 17 15:00:41 2007 +0000 @@ -71,7 +71,7 @@ int comp = 0; /* Used for top-aligned text */ gboolean has_scroll = !(view->flags & GNT_TEXT_VIEW_NO_SCROLL); - wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgd(widget->window, gnt_color_pair(GNT_COLOR_NORMAL)); werase(widget->window); if ((view->flags & GNT_TEXT_VIEW_TOP_ALIGN) && @@ -158,15 +158,15 @@ position = rows - showing; mvwvline(widget->window, position + 1, scrcol, - ACS_CKBOARD | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D), showing); + ACS_CKBOARD | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D), showing); } if (has_scroll) { mvwaddch(widget->window, 0, scrcol, - (lines ? ACS_UARROW : ' ') | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); + (lines ? ACS_UARROW : ' ') | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D)); mvwaddch(widget->window, widget->priv.height - 1, scrcol, ((view->list && view->list->prev) ? ACS_DARROW : ' ') | - COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); + gnt_color_pair(GNT_COLOR_HIGHLIGHT_D)); } GNTDEBUG; @@ -645,11 +645,11 @@ fl |= A_BLINK; if (flags & GNT_TEXT_FLAG_DIM) - fl |= (A_DIM | COLOR_PAIR(GNT_COLOR_DISABLED)); + fl |= (A_DIM | gnt_color_pair(GNT_COLOR_DISABLED)); else if (flags & GNT_TEXT_FLAG_HIGHLIGHT) - fl |= (A_DIM | COLOR_PAIR(GNT_COLOR_HIGHLIGHT)); + fl |= (A_DIM | gnt_color_pair(GNT_COLOR_HIGHLIGHT)); else - fl |= COLOR_PAIR(GNT_COLOR_NORMAL); + fl |= gnt_color_pair(GNT_COLOR_NORMAL); return fl; } diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gnttextview.h --- a/finch/libgnt/gnttextview.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gnttextview.h Wed Oct 17 15:00:41 2007 +0000 @@ -88,116 +88,144 @@ G_BEGIN_DECLS /** - * - * - * @return + * @return GType for GntTextView. */ GType gnt_text_view_get_gtype(void); -/* XXX: For now, don't set a textview to have any border. - * If you want borders real bad, put it in a box. */ /** - * + * Create a new textview. * - * @return + * @return The newly created textview. */ GntWidget * gnt_text_view_new(void); -/* scroll > 0 means scroll up, < 0 means scroll down, == 0 means scroll to the end */ /** - * - * @param view - * @param scroll + * Scroll the textview. + * @param view The textview to scroll. + * @param scroll scroll > 0 means scroll up, < 0 means scroll down, == 0 means scroll to the end. */ void gnt_text_view_scroll(GntTextView *view, int scroll); /** - * - * @param view - * @param text - * @param flags + * Append new text in a textview. + * + * @param view The textview. + * @param text The text to append to the textview. + * @param flags The text-flags to apply to the new text. */ void gnt_text_view_append_text_with_flags(GntTextView *view, const char *text, GntTextFormatFlags flags); /** - * - * @param view - * @param text - * @param flags - * @param tag + * Append text in the textview, with some identifier (tag) for the added text. + * + * @param view The textview. + * @param text The text to append. + * @param flags The text-flags to apply to the new text. + * @param tag The tag for the appended text, so it can be changed later (@see gnt_text_view_tag_change) */ void gnt_text_view_append_text_with_tag(GntTextView *view, const char *text, GntTextFormatFlags flags, const char *tag); -/* Move the cursor to the beginning of the next line and resets text-attributes. - * It first completes the current line with the current text-attributes. */ /** - * - * @param view + * Move the cursor to the beginning of the next line and resets text-attributes. + * It first completes the current line with the current text-attributes. + * + * @param view The textview. */ void gnt_text_view_next_line(GntTextView *view); /** - * - * @param flags + * Convert GNT-text formats to ncurses-text attributes. * - * @return + * @param flags The GNT text format. + * + * @return Nucrses text attribute. */ chtype gnt_text_format_flag_to_chtype(GntTextFormatFlags flags); /** - * - * @param view + * Clear the contents of the textview. + * + * @param view The textview. */ void gnt_text_view_clear(GntTextView *view); /** - * - * @param view + * The number of lines below the bottom-most visible line. * - * @return + * @param view The textview. + * + * @return Number of lines below the bottom-most visible line. */ int gnt_text_view_get_lines_below(GntTextView *view); /** - * - * @param view + * The number of lines above the topmost visible line. * - * @return + * @param view The textview. + * + * @return Number of lines above the topmost visible line. */ int gnt_text_view_get_lines_above(GntTextView *view); -/* If text is NULL, then the tag is removed. */ /** - * - * @param view - * @param name - * @param text - * @param all + * Change the text of a tag. * - * @return + * @param view The textview. + * @param name The name of the tag. + * @param text The new text for the text. If 'text' is @c NULL, the tag is removed. + * @param all @c TRUE if all of the instancess of the tag should be changed, @c FALSE if + * only the first instance should be changed. + * + * @return The number of instances changed. */ int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *text, gboolean all); /** - * - * @param view - * @param widget + * Setup hooks so that pressing up/down/page-up/page-down keys when 'widget' is + * in focus scrolls the textview. + * + * @param view The textview. + * @param widget The trigger widget. */ void gnt_text_view_attach_scroll_widget(GntTextView *view, GntWidget *widget); /** - * - * @param view - * @param widget + * Setup appropriate hooks so that pressing some keys when the 'pager' widget + * is in focus triggers the PAGER to popup with the contents of the textview + * in it. + * + * The default key-combination to trigger the pager is a-v, and the default + * PAGER application is $PAGER. Both can be changed in ~/.gntrc like this: + * + * @code + * [pager] + * key = a-v + * path = /path/to/pager + * @endcode + * + * @param view The textview. + * @param pager The widget to trigger the PAGER. */ void gnt_text_view_attach_pager_widget(GntTextView *view, GntWidget *pager); /** - * - * @param view - * @param widget + * Setup appropriate hooks so that pressing some keys when 'widget' + * is in focus triggers the EDITOR to popup with the contents of the textview + * in it. + * + * The default key-combination to trigger the pager is a-e, and the default + * EDITOR application is $EDITOR. Both can be changed in ~/.gntrc like this: + * + * @code + * [editor] + * key = a-e + * path = /path/to/editor + * @endcode + * + * @param view The textview. + * @param widget The widget to trigger the EDITOR. */ -void gnt_text_view_attach_editor_widget(GntTextView *view, GntWidget *pager); +void gnt_text_view_attach_editor_widget(GntTextView *view, GntWidget *widget); /** * Set a GntTextViewFlag for the textview widget. diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gnttree.c --- a/finch/libgnt/gnttree.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gnttree.c Wed Oct 17 15:00:41 2007 +0000 @@ -432,7 +432,7 @@ tree_selection_changed(tree, NULL, tree->current); } - wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgd(widget->window, gnt_color_pair(GNT_COLOR_NORMAL)); start = 0; if (tree->show_title) @@ -440,9 +440,9 @@ int i; int x = pos; - mvwhline(widget->window, pos + 1, pos, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), + mvwhline(widget->window, pos + 1, pos, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.width - pos - 1); - mvwhline(widget->window, pos, pos, ' ' | COLOR_PAIR(GNT_COLOR_NORMAL), + mvwhline(widget->window, pos, pos, ' ' | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.width - pos - 1); for (i = 0; i < tree->ncol; i++) @@ -455,14 +455,14 @@ } if (pos) { - tree_mark_columns(tree, pos, 0, ACS_TTEE | COLOR_PAIR(GNT_COLOR_NORMAL)); + tree_mark_columns(tree, pos, 0, ACS_TTEE | gnt_color_pair(GNT_COLOR_NORMAL)); tree_mark_columns(tree, pos, widget->priv.height - pos, - ACS_BTEE | COLOR_PAIR(GNT_COLOR_NORMAL)); + ACS_BTEE | gnt_color_pair(GNT_COLOR_NORMAL)); } tree_mark_columns(tree, pos, pos + 1, - (tree->show_separator ? ACS_PLUS : ACS_HLINE) | COLOR_PAIR(GNT_COLOR_NORMAL)); + (tree->show_separator ? ACS_PLUS : ACS_HLINE) | gnt_color_pair(GNT_COLOR_NORMAL)); tree_mark_columns(tree, pos, pos, - (tree->show_separator ? ACS_VLINE : ' ') | COLOR_PAIR(GNT_COLOR_NORMAL)); + (tree->show_separator ? ACS_VLINE : ' ') | gnt_color_pair(GNT_COLOR_NORMAL)); start = 2; } @@ -514,18 +514,18 @@ if (row == tree->current) { if (gnt_widget_has_focus(widget)) - attr |= COLOR_PAIR(GNT_COLOR_HIGHLIGHT); + attr |= gnt_color_pair(GNT_COLOR_HIGHLIGHT); else - attr |= COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D); + attr |= gnt_color_pair(GNT_COLOR_HIGHLIGHT_D); } else { if (flags & GNT_TEXT_FLAG_DIM) - attr |= (A_DIM | COLOR_PAIR(GNT_COLOR_DISABLED)); + attr |= (A_DIM | gnt_color_pair(GNT_COLOR_DISABLED)); else if (flags & GNT_TEXT_FLAG_HIGHLIGHT) - attr |= (A_DIM | COLOR_PAIR(GNT_COLOR_HIGHLIGHT)); + attr |= (A_DIM | gnt_color_pair(GNT_COLOR_HIGHLIGHT)); else - attr |= COLOR_PAIR(GNT_COLOR_NORMAL); + attr |= gnt_color_pair(GNT_COLOR_NORMAL); } wbkgdset(widget->window, '\0' | attr); @@ -537,7 +537,7 @@ (tree->show_separator ? ACS_VLINE : ' ') | attr); } - wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL)); while (i < widget->priv.height - pos) { mvwhline(widget->window, i, pos, ' ', @@ -576,22 +576,22 @@ position += pos + start + 1; mvwvline(widget->window, pos + start + 1, scrcol, - ' ' | COLOR_PAIR(GNT_COLOR_NORMAL), rows); + ' ' | gnt_color_pair(GNT_COLOR_NORMAL), rows); mvwvline(widget->window, position, scrcol, - ACS_CKBOARD | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D), showing); + ACS_CKBOARD | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D), showing); } mvwaddch(widget->window, start + pos, scrcol, ((tree->top != tree->root) ? ACS_UARROW : ' ') | - COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); + gnt_color_pair(GNT_COLOR_HIGHLIGHT_D)); mvwaddch(widget->window, widget->priv.height - pos - 1, scrcol, - (row ? ACS_DARROW : ' ') | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); + (row ? ACS_DARROW : ' ') | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D)); /* If there's a search-text, show it in the bottom of the tree */ if (tree->priv->search && tree->priv->search->len > 0) { const char *str = gnt_util_onscreen_width_to_pointer(tree->priv->search->str, scrcol - 1, NULL); - wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT_D)); + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_HIGHLIGHT_D)); mvwaddnstr(widget->window, widget->priv.height - pos - 1, pos, tree->priv->search->str, str - tree->priv->search->str); } @@ -1328,7 +1328,6 @@ tree->list = g_list_insert(tree->list, key, position + 1); } } - redraw_tree(tree); return row; diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntutils.h --- a/finch/libgnt/gntutils.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntutils.h Wed Oct 17 15:00:41 2007 +0000 @@ -153,5 +153,5 @@ * * @since 2.0.0 (gnt), 2.1.0 (pidgin) */ -void gnt_util_set_trigger_widget(GntWidget *wid, const char *text, GntWidget *button); +void gnt_util_set_trigger_widget(GntWidget *widget, const char *key, GntWidget *button); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntwidget.c --- a/finch/libgnt/gntwidget.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntwidget.c Wed Oct 17 15:00:41 2007 +0000 @@ -420,7 +420,7 @@ gnt_widget_hide(GntWidget *widget) { g_signal_emit(widget, signals[SIG_HIDE], 0); - wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL)); #if 0 /* XXX: I have no clue why, but this seemed to be necessary. */ if (gnt_widget_has_shadow(widget)) @@ -477,31 +477,31 @@ if (!gnt_widget_has_shadow(widget)) shadow = FALSE; - wbkgd(widget->window, COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgd(widget->window, gnt_color_pair(GNT_COLOR_NORMAL)); werase(widget->window); if (!(GNT_WIDGET_FLAGS(widget) & GNT_WIDGET_NO_BORDER)) { /* - This is ugly. */ /* - What's your point? */ - mvwvline(widget->window, 0, 0, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.height); + mvwvline(widget->window, 0, 0, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.height); mvwvline(widget->window, 0, widget->priv.width - 1, - ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.height); + ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.height); mvwhline(widget->window, widget->priv.height - 1, 0, - ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.width); - mvwhline(widget->window, 0, 0, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), widget->priv.width); - mvwaddch(widget->window, 0, 0, ACS_ULCORNER | COLOR_PAIR(GNT_COLOR_NORMAL)); + ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.width); + mvwhline(widget->window, 0, 0, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), widget->priv.width); + mvwaddch(widget->window, 0, 0, ACS_ULCORNER | gnt_color_pair(GNT_COLOR_NORMAL)); mvwaddch(widget->window, 0, widget->priv.width - 1, - ACS_URCORNER | COLOR_PAIR(GNT_COLOR_NORMAL)); + ACS_URCORNER | gnt_color_pair(GNT_COLOR_NORMAL)); mvwaddch(widget->window, widget->priv.height - 1, 0, - ACS_LLCORNER | COLOR_PAIR(GNT_COLOR_NORMAL)); + ACS_LLCORNER | gnt_color_pair(GNT_COLOR_NORMAL)); mvwaddch(widget->window, widget->priv.height - 1, widget->priv.width - 1, - ACS_LRCORNER | COLOR_PAIR(GNT_COLOR_NORMAL)); + ACS_LRCORNER | gnt_color_pair(GNT_COLOR_NORMAL)); } if (shadow) { - wbkgdset(widget->window, '\0' | COLOR_PAIR(GNT_COLOR_SHADOW)); + wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_SHADOW)); mvwvline(widget->window, 1, widget->priv.width, ' ', widget->priv.height); mvwhline(widget->window, widget->priv.height, 1, ' ', widget->priv.width); } @@ -617,7 +617,7 @@ return; while (widget->parent) widget = widget->parent; - + if (!g_object_get_data(G_OBJECT(widget), "gnt:queue_update")) { int id = g_timeout_add(0, update_queue_callback, widget); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntwidget.h --- a/finch/libgnt/gntwidget.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntwidget.h Wed Oct 17 15:00:41 2007 +0000 @@ -140,167 +140,176 @@ G_BEGIN_DECLS /** - * - * - * @return + * @return GType for GntWidget. */ GType gnt_widget_get_gtype(void); /** - * - * @param widget + * Destroy a widget. + * @param widget The widget to destroy. */ void gnt_widget_destroy(GntWidget *widget); /** - * - * @param widget + * Show a widget. This should only be used for toplevel widgets. For the rest + * of the widgets, use #gnt_widget_draw instead. + * + * @param widget The widget to show. */ void gnt_widget_show(GntWidget *widget); /** - * - * @param widget + * Draw a widget. + * @param widget The widget to draw. */ void gnt_widget_draw(GntWidget *widget); /** - * - * @param widget - * @param x - * @param y - * @param width - * @param height + * @internal + * Expose part of a widget. */ void gnt_widget_expose(GntWidget *widget, int x, int y, int width, int height); /** - * - * @param widget + * Hide a widget. + * @param widget The widget to hide. */ void gnt_widget_hide(GntWidget *widget); /** - * - * @param widget - * @param x - * @param y + * Get the position of a widget. + * + * @param widget The widget. + * @param x Location to store the x-coordinate of the widget. + * @param y Location to store the y-coordinate of the widget. */ void gnt_widget_get_position(GntWidget *widget, int *x, int *y); /** - * - * @param widget - * @param x - * @param y + * Set the position of a widget. + * @param widget The widget to reposition. + * @param x The x-coordinate of the widget. + * @param y The x-coordinate of the widget. */ void gnt_widget_set_position(GntWidget *widget, int x, int y); /** - * - * @param widget + * Request a widget to calculate its desired size. + * @param widget The widget. */ void gnt_widget_size_request(GntWidget *widget); /** - * - * @param widget - * @param width - * @param height + * Get the size of a widget. + * @param widget The widget. + * @param width Location to store the width of the widget. + * @param height Location to store the height of the widget. */ void gnt_widget_get_size(GntWidget *widget, int *width, int *height); /** - * - * @param widget - * @param width - * @param height + * Set the size of a widget. * - * @return + * @param widget The widget to resize. + * @param width The width of the widget. + * @param height The height of the widget. + * + * @return If the widget was resized to the new size. */ gboolean gnt_widget_set_size(GntWidget *widget, int width, int height); /** - * - * @param widget - * @param width - * @param height + * Confirm a requested a size for a widget. * - * @return + * @param widget The widget. + * @param width The requested width. + * @param height The requested height. + * + * @return @c TRUE if the new size was confirmed, @c FALSE otherwise. */ gboolean gnt_widget_confirm_size(GntWidget *widget, int width, int height); /** - * - * @param widget - * @param keys + * Trigger the key-press callbacks for a widget. * - * @return + * @param widget The widget. + * @param keys The keypress on the widget. + * + * @return @c TRUE if the key-press was handled, @c FALSE otherwise. */ gboolean gnt_widget_key_pressed(GntWidget *widget, const char *keys); /** - * - * @param widget - * @param event - * @param x - * @param y + * Trigger the 'click' callback of a widget. * - * @return + * @param widget The widget. + * @param event The mouseevent. + * @param x The x-coordinate of the mouse. + * @param y The y-coordinate of the mouse. + * + * @return @c TRUE if the event was handled, @c FALSE otherwise. */ gboolean gnt_widget_clicked(GntWidget *widget, GntMouseEvent event, int x, int y); /** - * - * @param widget - * @param set + * Give or remove focus to a widget. + * @param widget The widget. + * @param set @c TRUE of focus should be given to the widget, @c FALSE if + * focus should be removed. * - * @return + * @return @c TRUE if the focus has been changed, @c FALSE otherwise. */ gboolean gnt_widget_set_focus(GntWidget *widget, gboolean set); /** - * - * @param widget + * Activate a widget. This only applies to widgets that can be activated (eg. GntButton) + * @param widget The widget to activate. */ void gnt_widget_activate(GntWidget *widget); /** - * - * @param widget - * @param name + * Set the name of a widget. + * @param widget The widget. + * @param name A new name for the widget. */ void gnt_widget_set_name(GntWidget *widget, const char *name); +/** + * Get the name of a widget. + * @param widget The widget. + * @return The name of the widget. + */ const char *gnt_widget_get_name(GntWidget *widget); -/* Widget-subclasses should call this from the draw-callback. - * Applications should just call gnt_widget_draw instead of this. */ /** - * - * @param widget + * @internal + * Use #gnt_widget_draw instead. */ void gnt_widget_queue_update(GntWidget *widget); /** - * - * @param widget - * @param set + * Set whether a widget can take focus or not. + * + * @param widget The widget. + * @param set @c TRUE if the widget can take focus. */ void gnt_widget_set_take_focus(GntWidget *widget, gboolean set); /** - * - * @param widget - * @param set + * Set the visibility of a widget. + * + * @param widget The widget. + * @param set Whether the widget is visible or not. */ void gnt_widget_set_visible(GntWidget *widget, gboolean set); /** - * - * @param widget + * Check whether the widget has shadows. * - * @return + * @param widget The widget. + * + * @return @c TRUE if the widget has shadows. This checks both the user-setting + * and whether the widget can have shadows at all. */ gboolean gnt_widget_has_shadow(GntWidget *widget); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntwindow.h --- a/finch/libgnt/gntwindow.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntwindow.h Wed Oct 17 15:00:41 2007 +0000 @@ -68,9 +68,7 @@ G_BEGIN_DECLS /** - * - * - * @return + * @return GType for GntWindow. */ GType gnt_window_get_gtype(void); @@ -78,28 +76,40 @@ #define gnt_hwindow_new(homo) gnt_window_box_new(homo, FALSE) /** - * + * Create a new window. * - * @return + * @return The newly created window. */ GntWidget * gnt_window_new(void); /** - * - * @param homo - * @param vert + * Create a new window. * - * @return + * @param homo @c TRUE if the widgets inside the window should have the same dimensions. + * @param vert @c TRUE if the widgets inside the window should be stacked vertically. + * + * @return The newly created window. */ GntWidget * gnt_window_box_new(gboolean homo, gboolean vert); /** - * - * @param window - * @param menu + * Set the menu for a window. + * + * @param window The window. + * @param menu The menu for the window. */ void gnt_window_set_menu(GntWindow *window, GntMenu *menu); +/** + * Return the id of a menuitem specified to a keystroke. + * + * @param window The window. + * @param key The keystroke. + * + * @return The id of the menuitem bound to the keystroke, or @c NULL. + * + * @since 2.3.0 + */ const char * gnt_window_get_accel_item(GntWindow *window, const char *key); void gnt_window_workspace_hiding(GntWindow *); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntwm.c --- a/finch/libgnt/gntwm.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntwm.c Wed Oct 17 15:00:41 2007 +0000 @@ -1046,7 +1046,7 @@ GntWM *wm = GNT_WM(wim); GntWidget *w = GNT_WIDGET(wid); wm->tagged = g_list_remove(wm->tagged, w); - mvwhline(w->window, 0, 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), 3); + mvwhline(w->window, 0, 1, ACS_HLINE | gnt_color_pair(GNT_COLOR_NORMAL), 3); gnt_widget_draw(w); } @@ -1066,7 +1066,7 @@ } wm->tagged = g_list_prepend(wm->tagged, widget); - wbkgdset(widget->window, ' ' | COLOR_PAIR(GNT_COLOR_HIGHLIGHT)); + wbkgdset(widget->window, ' ' | gnt_color_pair(GNT_COLOR_HIGHLIGHT)); mvwprintw(widget->window, 0, 1, "[T]"); gnt_widget_draw(widget); return TRUE; @@ -1675,7 +1675,7 @@ { while (widget->parent) widget = widget->parent; - + if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_INVISIBLE) || g_hash_table_lookup(wm->nodes, widget)) { update_screen(wm); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntwm.h --- a/finch/libgnt/gntwm.h Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntwm.h Wed Oct 17 15:00:41 2007 +0000 @@ -113,7 +113,7 @@ * whether to give focus to a new window. */ gboolean event_stack; - + GntKeyPressMode mode; GHashTable *positions; @@ -184,108 +184,149 @@ G_BEGIN_DECLS /** - * - * - * @return + * @return GType for GntWM. */ GType gnt_wm_get_gtype(void); +/** + * Add a workspace. + * @param wm The window-manager. + * @param ws The workspace to add. + */ void gnt_wm_add_workspace(GntWM *wm, GntWS *ws); +/** + * Switch to a workspace. + * @param wm The window-manager. + * @param n Index of the workspace to switch to. + * + * @return @c TRUE if the switch was successful. + */ gboolean gnt_wm_switch_workspace(GntWM *wm, gint n); + +/** + * Switch to the previous workspace from the current one. + * @param wm The window-manager. + */ gboolean gnt_wm_switch_workspace_prev(GntWM *wm); + +/** + * Switch to the next workspace from the current one. + * @param wm The window-manager. + */ gboolean gnt_wm_switch_workspace_next(GntWM *wm); + +/** + * Move a window to a specific workspace. + * @param wm The window manager. + * @param neww The new workspace. + * @param widget The widget to move. + */ void gnt_wm_widget_move_workspace(GntWM *wm, GntWS *neww, GntWidget *widget); + +/** + * Set the list of workspaces . + * @param wm The window manager. + * @param workspaces The list of workspaces. + */ void gnt_wm_set_workspaces(GntWM *wm, GList *workspaces); + +/** + * Find the workspace that contains a specific widget. + * @param wm The window-manager. + * @param widget The widget to find. + * @return The workspace that has the widget. + */ GntWS *gnt_wm_widget_find_workspace(GntWM *wm, GntWidget *widget); /** - * - * @param wm - * @param widget + * Process a new window. + * + * @param wm The window-manager. + * @param widget The new window. */ void gnt_wm_new_window(GntWM *wm, GntWidget *widget); /** - * - * @param wm - * @param widget + * Decorate a window. + * @param wm The window-manager. + * @param widget The widget to decorate. */ void gnt_wm_window_decorate(GntWM *wm, GntWidget *widget); /** - * - * @param wm - * @param widget + * Close a window. + * @param wm The window-manager. + * @param widget The window to close. */ void gnt_wm_window_close(GntWM *wm, GntWidget *widget); /** - * - * @param wm - * @param string + * Process input. * - * @return + * @param wm The window-manager. + * @param string The input string to process. + * + * @return @c TRUE of the string was processed, @c FALSE otherwise. */ gboolean gnt_wm_process_input(GntWM *wm, const char *string); /** - * - * @param wm - * @param event - * @param x - * @param y - * @param widget + * Process a click event. + * @param wm The window manager. + * @param event The mouse event. + * @param x The x-coordinate of the mouse. + * @param y The y-coordinate of the mouse. + * @param widget The widget under the mouse. * - * @return + * @return @c TRUE if the event was handled, @c FALSE otherwise. */ gboolean gnt_wm_process_click(GntWM *wm, GntMouseEvent event, int x, int y, GntWidget *widget); /** - * - * @param wm - * @param widget - * @param width - * @param height + * Resize a window. + * @param wm The window manager. + * @param widget The window to resize. + * @param width The desired width of the window. + * @param height The desired height of the window. */ void gnt_wm_resize_window(GntWM *wm, GntWidget *widget, int width, int height); /** - * - * @param wm - * @param widget - * @param x - * @param y + * Move a window. + * @param wm The window manager. + * @param widget The window to move. + * @param x The desired x-coordinate of the window. + * @param y The desired y-coordinate of the window. */ void gnt_wm_move_window(GntWM *wm, GntWidget *widget, int x, int y); /** - * - * @param wm - * @param widget + * Update a window. + * @param wm The window-manager. + * @param widget The window to update. */ void gnt_wm_update_window(GntWM *wm, GntWidget *widget); /** - * - * @param wm - * @param widget + * Raise a window. + * @param wm The window-manager. + * @param widget The window to raise. */ void gnt_wm_raise_window(GntWM *wm, GntWidget *widget); /** - * - * @param wm - * @param set + * @internal */ void gnt_wm_set_event_stack(GntWM *wm, gboolean set); +/** + * @internal + */ void gnt_wm_copy_win(GntWidget *widget, GntNode *node); /** - * - * - * @return + * @return The idle time of the user. */ time_t gnt_wm_get_idle_time(void); diff -r e747ac0c42d6 -r 6bbd023f0387 finch/libgnt/gntws.c --- a/finch/libgnt/gntws.c Mon Oct 15 10:45:46 2007 +0000 +++ b/finch/libgnt/gntws.c Wed Oct 17 15:00:41 2007 +0000 @@ -45,7 +45,7 @@ mvwin(taskbar, Y_MAX, 0); } - wbkgdset(taskbar, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); + wbkgdset(taskbar, '\0' | gnt_color_pair(GNT_COLOR_NORMAL)); werase(taskbar); n = g_list_length(ws->list); @@ -66,15 +66,15 @@ } else { color = GNT_COLOR_NORMAL; } - wbkgdset(taskbar, '\0' | COLOR_PAIR(color)); + wbkgdset(taskbar, '\0' | gnt_color_pair(color)); if (iter->next) - mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), width); + mvwhline(taskbar, 0, width * i, ' ' | gnt_color_pair(color), width); else - mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), getmaxx(stdscr) - width * i); + mvwhline(taskbar, 0, width * i, ' ' | gnt_color_pair(color), getmaxx(stdscr) - width * i); title = GNT_BOX(w)->title; mvwprintw(taskbar, 0, width * i, "%s", title ? title : ""); if (i) - mvwaddch(taskbar, 0, width *i - 1, ACS_VLINE | A_STANDOUT | COLOR_PAIR(GNT_COLOR_NORMAL)); + mvwaddch(taskbar, 0, width *i - 1, ACS_VLINE | A_STANDOUT | gnt_color_pair(GNT_COLOR_NORMAL)); } wrefresh(taskbar); }