# HG changeset patch # User Sadrul Habib Chowdhury # Date 1162085524 0 # Node ID c7651586e27b24f6974bc13dbeb7813a7ab12c0b # Parent b1650510f4b8ea78c6f5b22364d8baf5978602dd [gaim-migrate @ 17615] Patch from Richard Nelson (wabz) to fix the blist-width, and do ellipsization in the trees. committer: Tailor Script diff -r b1650510f4b8 -r c7651586e27b console/gntblist.c --- a/console/gntblist.c Sun Oct 29 00:15:32 2006 +0000 +++ b/console/gntblist.c Sun Oct 29 01:32:04 2006 +0000 @@ -1315,10 +1315,13 @@ } static void -size_changed_cb(GntWidget *w, int width, int height) +size_changed_cb(GntWidget *w, int wi, int h) { + int width, height; + gnt_widget_get_size(w, &width, &height); gaim_prefs_set_int(PREF_ROOT "/size/width", width); gaim_prefs_set_int(PREF_ROOT "/size/height", height); + gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, width - 1); } static void @@ -1864,12 +1867,14 @@ ggblist->tree = gnt_tree_new(); GNT_WIDGET_SET_FLAGS(ggblist->tree, GNT_WIDGET_NO_BORDER); - gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, 25); gnt_widget_set_size(ggblist->tree, gaim_prefs_get_int(PREF_ROOT "/size/width"), gaim_prefs_get_int(PREF_ROOT "/size/height")); gnt_widget_set_position(ggblist->window, gaim_prefs_get_int(PREF_ROOT "/position/x"), gaim_prefs_get_int(PREF_ROOT "/position/y")); + gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, + gaim_prefs_get_int(PREF_ROOT "/size/width") - 1); + gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree); ggblist->status = gnt_combo_box_new(); diff -r b1650510f4b8 -r c7651586e27b console/libgnt/gntbox.c --- a/console/libgnt/gntbox.c Sun Oct 29 00:15:32 2006 +0000 +++ b/console/libgnt/gntbox.c Sun Oct 29 01:32:04 2006 +0000 @@ -704,6 +704,9 @@ GntWidget *wid; int width, height; + if (GNT_WIDGET(box)->parent != NULL) + return; + for (iter = box->list; iter; iter = iter->next) { GntWidget *w = iter->data; diff -r b1650510f4b8 -r c7651586e27b console/libgnt/gnttree.c --- a/console/libgnt/gnttree.c Sun Oct 29 00:15:32 2006 +0000 +++ b/console/libgnt/gnttree.c Sun Oct 29 01:32:04 2006 +0000 @@ -200,6 +200,7 @@ const char *text; int len = gnt_util_onscreen_width(col->text, NULL); int fl = 0; + gboolean cut = FALSE; if (i == 0) { @@ -231,13 +232,20 @@ else g_string_append_c(string, '|'); - if (len > tree->columns[i].width) - { - len = tree->columns[i].width; + if (len > tree->columns[i].width) { + len = tree->columns[i].width - 1; + cut = TRUE; + } + text = gnt_util_onscreen_width_to_pointer(col->text, len - fl, NULL); + string = g_string_append_len(string, col->text, text - col->text); + if (cut) { /* ellipsis */ + if (gnt_ascii_only()) + g_string_append_c(string, '~'); + else + string = g_string_append(string, "\342\200\246"); + len++; } - text = gnt_util_onscreen_width_to_pointer(col->text, len - fl, NULL); - string = g_string_append_len(string, col->text, text - col->text); if (len < tree->columns[i].width && iter->next) g_string_append_printf(string, "%*s", tree->columns[i].width - len, ""); } @@ -339,7 +347,6 @@ if ((wr = gnt_util_onscreen_width(str, NULL)) > scrcol) { - /* XXX: ellipsize */ char *s = (char*)gnt_util_onscreen_width_to_pointer(str, scrcol, &wr); *s = '\0'; } diff -r b1650510f4b8 -r c7651586e27b console/plugins/gnthistory.c --- a/console/plugins/gnthistory.c Sun Oct 29 00:15:32 2006 +0000 +++ b/console/plugins/gnthistory.c Sun Oct 29 01:32:04 2006 +0000 @@ -21,7 +21,6 @@ /* Ripped from gtk/plugins/history.c */ #include "internal.h" -#include "gntgaim.h" #include "conversation.h" #include "debug.h"