From: <sa...@us...> - 2006-08-15 18:05:25
|
Revision: 16773 Author: sadrul Date: 2006-08-15 11:05:14 -0700 (Tue, 15 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16773&view=rev Log Message: ----------- Some adjustment to the scrollbars. Deal with dialogs with NULL title. Status-selector in the buddylist should always show the active status. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/libgnt/gntmain.c trunk/console/libgnt/gnttextview.c trunk/console/libgnt/gnttree.c trunk/console/libgnt/test/multiwin.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-08-15 16:48:32 UTC (rev 16772) +++ trunk/console/gntblist.c 2006-08-15 18:05:14 UTC (rev 16773) @@ -67,6 +67,7 @@ static gboolean remove_typing_cb(gpointer null); static void remove_peripherals(GGBlist *ggblist); static const char * get_display_name(GaimBlistNode *node); +static void savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old); static void new_node(GaimBlistNode *node) @@ -1150,6 +1151,9 @@ } else if (now->type == STATUS_SAVED_ALL) { + /* Restore the selection to reflect current status. */ + savedstatus_changed(gaim_savedstatus_get_current(), NULL); + gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree); gg_savedstatus_show_all(); } else Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-08-15 16:48:32 UTC (rev 16772) +++ trunk/console/libgnt/gntmain.c 2006-08-15 18:05:14 UTC (rev 16773) @@ -16,6 +16,8 @@ /** * Notes: Interesting functions to look at: * scr_dump, scr_init, scr_restore: for workspaces + * + * Need to wattrset for colors to use with PDCurses. */ static int lock_focus_list; @@ -176,6 +178,7 @@ { GntWidget *w = iter->data; int color; + const char *title; if (w == focus_list->data) { @@ -194,7 +197,8 @@ } wbkgdset(taskbar, '\0' | COLOR_PAIR(color)); mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), width); - mvwprintw(taskbar, 0, width * i, "%s", GNT_BOX(w)->title); + title = GNT_BOX(w)->title; + mvwprintw(taskbar, 0, width * i, "%s", title ? title : "<gnt>"); update_window_in_list(w); } Modified: trunk/console/libgnt/gnttextview.c =================================================================== --- trunk/console/libgnt/gnttextview.c 2006-08-15 16:48:32 UTC (rev 16772) +++ trunk/console/libgnt/gnttextview.c 2006-08-15 18:05:14 UTC (rev 16773) @@ -26,7 +26,7 @@ GntTextView *view = GNT_TEXT_VIEW(widget); int i = 0; GList *lines; - int showing, position, rows, scrcol; + int rows, scrcol; werase(widget->window); @@ -51,11 +51,17 @@ rows = widget->priv.height - 2; if (rows > 0) { + int total = g_list_length(g_list_first(view->list)); + int showing, position, up, down; - showing = rows * rows / g_list_length(g_list_first(view->list)) + 1; + showing = rows * rows / total + 1; showing = MIN(rows, showing); - position = showing * g_list_length(view->list) / rows; + total -= rows; + up = g_list_length(lines); + down = total - up; + + position = (rows - showing) * up / MAX(1, up + down); position = MAX((lines != NULL), position); if (showing + position > rows) Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-08-15 16:48:32 UTC (rev 16772) +++ trunk/console/libgnt/gnttree.c 2006-08-15 18:05:14 UTC (rev 16773) @@ -250,7 +250,7 @@ GntWidget *widget = GNT_WIDGET(tree); GntTreeRow *row; int pos, up, down; - int showing, position, rows, scrcol; + int rows, scrcol; if (!GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_MAPPED)) return; @@ -371,11 +371,18 @@ rows--; if (rows > 0) { - get_next_n_opt(tree->root, g_list_length(tree->list), &i); - showing = rows * rows / MAX(i, 1) + 1; + int total; + int showing, position; + + get_next_n_opt(tree->root, g_list_length(tree->list), &total); + showing = rows * rows / MAX(total, 1) + 1; showing = MIN(rows, showing); - position = showing * get_distance(tree->root, tree->top) / rows; + total -= rows; + up = get_distance(tree->root, tree->top); + down = total - up; + + position = (rows - showing) * up / MAX(1, up + down); position = MAX((tree->top != tree->root), position); if (showing + position > rows) Modified: trunk/console/libgnt/test/multiwin.c =================================================================== --- trunk/console/libgnt/test/multiwin.c 2006-08-15 16:48:32 UTC (rev 16772) +++ trunk/console/libgnt/test/multiwin.c 2006-08-15 18:05:14 UTC (rev 16773) @@ -63,7 +63,7 @@ gnt_tree_add_row_after(GNT_TREE(tree), "6", gnt_tree_create_row(GNT_TREE(tree), "6", " long text", "a2"), "4", NULL); int i; - for (i = 110; i < 130; i++) + for (i = 110; i < 430; i++) { char *s; s = g_strdup_printf("%d", i); /* XXX: yes, leaking */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |