# HG changeset patch # User Sadrul Habib Chowdhury # Date 1155094905 0 # Node ID 2d1b41e3cf0d02b0b571fb838e397927df259b63 # Parent 32a71e64ceae0c54c4a92a109a47e0abc4862dec [gaim-migrate @ 16674] Add a way to change some preferences (the preferences for the conversations do not do anything yet). I used the request-api for this, which I think is cool. But too many preferences will make the dialog long, which may not fit in the screen. It looks alright for now though. You can pop the dialog up with "/prefs" command in a converastion. And some other minor fixes. committer: Tailor Script diff -r 32a71e64ceae -r 2d1b41e3cf0d console/gntaccount.c --- a/console/gntaccount.c Tue Aug 08 23:20:08 2006 +0000 +++ b/console/gntaccount.c Wed Aug 09 03:41:45 2006 +0000 @@ -213,8 +213,9 @@ } else { - dialog->splits = gnt_box_new(FALSE, TRUE); + dialog->splits = gnt_vbox_new(FALSE); gnt_box_set_pad(GNT_BOX(dialog->splits), 0); + gnt_box_set_fill(GNT_BOX(dialog->splits), TRUE); } dialog->split_entries = NULL; @@ -232,7 +233,7 @@ GntWidget *entry; char *buf; - hbox = gnt_box_new(TRUE, FALSE); + hbox = gnt_hbox_new(TRUE); gnt_box_add_widget(GNT_BOX(dialog->splits), hbox); buf = g_strdup_printf("%s:", gaim_account_user_split_get_text(split)); @@ -443,16 +444,18 @@ dialog = g_new0(AccountEditDialog, 1); accountdialogs = g_list_prepend(accountdialogs, dialog); - dialog->window = window = gnt_box_new(FALSE, TRUE); + dialog->window = window = gnt_vbox_new(FALSE); dialog->account = account; gnt_box_set_toplevel(GNT_BOX(window), TRUE); gnt_box_set_title(GNT_BOX(window), account ? _("Modify Account") : _("New Account")); gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); gnt_box_set_pad(GNT_BOX(window), 0); + gnt_widget_set_name(window, "edit-account"); + gnt_box_set_fill(GNT_BOX(window), TRUE); - hbox = gnt_box_new(TRUE, FALSE); + hbox = gnt_hbox_new(TRUE); + gnt_box_set_pad(GNT_BOX(hbox), 0); gnt_box_add_widget(GNT_BOX(window), hbox); - gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); dialog->protocol = combo = gnt_combo_box_new(); list = gaim_plugins_get_protocols(); @@ -461,6 +464,7 @@ gnt_combo_box_add_data(GNT_COMBO_BOX(combo), iter->data, ((GaimPlugin*)iter->data)->info->name); } + if (account) gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), gaim_plugins_find_with_id(gaim_account_get_protocol_id(account))); @@ -468,10 +472,12 @@ gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), list->data); g_signal_connect(G_OBJECT(combo), "selection-changed", G_CALLBACK(prpl_changed_cb), dialog); + gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Protocol:"))); gnt_box_add_widget(GNT_BOX(hbox), combo); - hbox = gnt_box_new(TRUE, FALSE); + hbox = gnt_hbox_new(TRUE); + gnt_box_set_pad(GNT_BOX(hbox), 0); gnt_box_add_widget(GNT_BOX(window), hbox); dialog->screenname = entry = gnt_entry_new(NULL); @@ -482,7 +488,8 @@ update_user_splits(dialog); gnt_box_add_widget(GNT_BOX(window), dialog->splits); - hbox = gnt_box_new(TRUE, FALSE); + hbox = gnt_hbox_new(TRUE); + gnt_box_set_pad(GNT_BOX(hbox), 0); gnt_box_add_widget(GNT_BOX(window), hbox); dialog->password = entry = gnt_entry_new(NULL); @@ -492,7 +499,8 @@ if (account) gnt_entry_set_text(GNT_ENTRY(entry), gaim_account_get_password(account)); - hbox = gnt_box_new(TRUE, FALSE); + hbox = gnt_hbox_new(TRUE); + gnt_box_set_pad(GNT_BOX(hbox), 0); gnt_box_add_widget(GNT_BOX(window), hbox); dialog->alias = entry = gnt_entry_new(NULL); @@ -515,8 +523,9 @@ /* TODO: Add proxy options */ /* The button box */ - hbox = gnt_box_new(FALSE, FALSE); + hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(window), hbox); + gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); button = gnt_button_new(_("Cancel")); gnt_box_add_widget(GNT_BOX(hbox), button); @@ -603,7 +612,7 @@ GList *iter; GntWidget *box, *button; - accounts.window = gnt_box_new(FALSE, TRUE); + accounts.window = gnt_vbox_new(FALSE); gnt_box_set_toplevel(GNT_BOX(accounts.window), TRUE); gnt_box_set_title(GNT_BOX(accounts.window), _("Accounts")); gnt_box_set_pad(GNT_BOX(accounts.window), 0); @@ -632,7 +641,7 @@ gnt_box_add_widget(GNT_BOX(accounts.window), gnt_line_new(FALSE)); - box = gnt_box_new(FALSE, FALSE); + box = gnt_hbox_new(FALSE); button = gnt_button_new(_("Add")); gnt_box_add_widget(GNT_BOX(box), button); diff -r 32a71e64ceae -r 2d1b41e3cf0d console/gntblist.c --- a/console/gntblist.c Tue Aug 08 23:20:08 2006 +0000 +++ b/console/gntblist.c Wed Aug 09 03:41:45 2006 +0000 @@ -906,7 +906,8 @@ } gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree); - g_source_remove(ggblist->typing); + if (ggblist->typing) + g_source_remove(ggblist->typing); ggblist->typing = 0; return FALSE; } @@ -923,6 +924,7 @@ else if (now->type == STATUS_PRIMITIVE) { /* Move the focus to the entry box */ + /* XXX: Make sure the selected status can have a message */ gnt_box_move_focus(GNT_BOX(ggblist->window), 1); ggblist->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, NULL); } @@ -936,7 +938,8 @@ if ((text[0] == 27 || (text[0] == '\t' && text[1] == '\0')) && ggblist->typing == 0) return FALSE; - g_source_remove(ggblist->typing); + if (ggblist->typing) + g_source_remove(ggblist->typing); ggblist->typing = 0; if (text[0] == '\r' && text[1] == 0) diff -r 32a71e64ceae -r 2d1b41e3cf0d console/gntconv.c --- a/console/gntconv.c Tue Aug 08 23:20:08 2006 +0000 +++ b/console/gntconv.c Wed Aug 09 03:41:45 2006 +0000 @@ -10,6 +10,7 @@ #include "gntconv.h" #include "gntdebug.h" #include "gntplugin.h" +#include "gntprefs.h" #include "gnt.h" #include "gntbox.h" @@ -538,6 +539,9 @@ gaim_cmd_register("debugwin", "", GAIM_CMD_P_DEFAULT, GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, cmd_show_window, _("debugwin: Show the debug window."), gg_debug_window_show); + gaim_cmd_register("prefs", "", GAIM_CMD_P_DEFAULT, + GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, + cmd_show_window, _("prefs: Show the preference window."), gg_prefs_show_all); } void gg_conversation_uninit() diff -r 32a71e64ceae -r 2d1b41e3cf0d console/gntdebug.c --- a/console/gntdebug.c Tue Aug 08 23:20:08 2006 +0000 +++ b/console/gntdebug.c Wed Aug 09 03:41:45 2006 +0000 @@ -19,7 +19,6 @@ { if (key[0] == 27) { - /* XXX: This doesn't seem to always work */ if (strcmp(key+1, GNT_KEY_DOWN) == 0) gnt_text_view_scroll(view, 1); else if (strcmp(key+1, GNT_KEY_UP) == 0) @@ -61,10 +60,7 @@ } gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), args, flag); - gnt_text_view_next_line(GNT_TEXT_VIEW(debug.tview)); gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0); - - g_signal_connect(G_OBJECT(debug.window), "key_pressed", G_CALLBACK(debug_window_kpress_cb), debug.tview); } } @@ -95,7 +91,10 @@ debug.tview = gnt_text_view_new(); gnt_box_add_widget(GNT_BOX(debug.window), debug.tview); + /* XXX: Add checkboxes/buttons for Clear, Pause, Timestamps */ + g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL); + g_signal_connect(G_OBJECT(debug.window), "key_pressed", G_CALLBACK(debug_window_kpress_cb), debug.tview); } gnt_widget_show(debug.window); diff -r 32a71e64ceae -r 2d1b41e3cf0d console/gntplugin.c --- a/console/gntplugin.c Tue Aug 08 23:20:08 2006 +0000 +++ b/console/gntplugin.c Wed Aug 09 03:41:45 2006 +0000 @@ -128,6 +128,8 @@ g_signal_connect(G_OBJECT(tree), "selection_changed", G_CALLBACK(selection_changed), NULL); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(reset_plugin_window), NULL); + gnt_tree_set_selected(GNT_TREE(tree), gaim_plugins_get_all()->data); + gnt_widget_show(window); } diff -r 32a71e64ceae -r 2d1b41e3cf0d console/gntprefs.c --- a/console/gntprefs.c Tue Aug 08 23:20:08 2006 +0000 +++ b/console/gntprefs.c Wed Aug 09 03:41:45 2006 +0000 @@ -1,7 +1,10 @@ #include +#include "gntgaim.h" #include "gntprefs.h" -#include "gntgaim.h" +#include "gntrequest.h" + +#include void gg_prefs_init() { @@ -10,5 +13,182 @@ gaim_prefs_add_none("/gaim/gnt/plugins"); gaim_prefs_add_string_list("/gaim/gnt/plugins/loaded", NULL); + + gaim_prefs_add_none("/gaim/gnt/conversations"); + gaim_prefs_add_bool("/gaim/gnt/conversations/timestamps", TRUE); + gaim_prefs_add_bool("/gaim/gnt/conversations/notify_typing", FALSE); +} + +typedef struct +{ + GaimPrefType type; + const char *pref; + const char *label; + GList *(*lv)(); /* If the value is to be selected from a number of choices */ +} Prefs; + +static GList * +get_log_options() +{ + return gaim_log_logger_get_options(); +} + +static GaimRequestField * +get_pref_field(Prefs *prefs) +{ + GaimRequestField *field = NULL; + + if (prefs->lv == NULL) + { + switch (prefs->type) + { + case GAIM_PREF_BOOLEAN: + field = gaim_request_field_bool_new(prefs->pref, prefs->label, + gaim_prefs_get_bool(prefs->pref)); + break; + case GAIM_PREF_INT: + field = gaim_request_field_int_new(prefs->pref, prefs->label, + gaim_prefs_get_int(prefs->pref)); + break; + case GAIM_PREF_STRING: + field = gaim_request_field_string_new(prefs->pref, prefs->label, + gaim_prefs_get_string(prefs->pref), FALSE); + break; + default: + break; + } + } + else + { + GList *list = prefs->lv(), *iter; + field = gaim_request_field_list_new(prefs->pref, prefs->label); + for (iter = list; iter; iter = iter->next) + { + gboolean select = FALSE; + const char *data = iter->data; + iter = iter->next; + switch (prefs->type) + { + case GAIM_PREF_BOOLEAN: + if (gaim_prefs_get_bool(prefs->pref) == GPOINTER_TO_INT(iter->data)) + select = TRUE; + break; + case GAIM_PREF_INT: + if (gaim_prefs_get_int(prefs->pref) == GPOINTER_TO_INT(iter->data)) + select = TRUE; + break; + case GAIM_PREF_STRING: + if (strcmp(gaim_prefs_get_string(prefs->pref), iter->data) == 0) + select = TRUE; + break; + default: + break; + } + gaim_request_field_list_add(field, data, iter->data); + if (select) + gaim_request_field_list_add_selected(field, data); + } + g_list_free(list); + } + return field; } +static Prefs convs[] = +{ + {GAIM_PREF_BOOLEAN, "/gaim/gnt/conversations/timestamps", _("Show Timestamps"), NULL}, + {GAIM_PREF_BOOLEAN, "/gaim/gnt/conversations/notify_typing", _("Notify buddies when you are typing"), NULL}, + {GAIM_PREF_NONE, NULL, NULL, NULL} +}; + +static Prefs logging[] = +{ + {GAIM_PREF_STRING, "/core/logging/format", _("Log format"), get_log_options}, + {GAIM_PREF_BOOLEAN, "/core/logging/log_ims", _("Log IMs"), NULL}, + {GAIM_PREF_BOOLEAN, "/core/logging/log_chats", _("Log chats"), NULL}, + {GAIM_PREF_BOOLEAN, "/core/logging/log_system", _("Log status change events"), NULL}, + {GAIM_PREF_NONE, NULL, NULL, NULL}, +}; + +static void +save_cb(void *data, GaimRequestFields *allfields) +{ + GList *list; + for (list = gaim_request_fields_get_groups(allfields); list; list = list->next) + { + GaimRequestFieldGroup *group = list->data; + GList *fields = gaim_request_field_group_get_fields(group); + + for (; fields ; fields = fields->next) + { + GaimRequestField *field = fields->data; + GaimRequestFieldType type = gaim_request_field_get_type(field); + GaimPrefType pt; + gpointer val = NULL; + const char *id = gaim_request_field_get_id(field); + + switch (type) + { + case GAIM_REQUEST_FIELD_LIST: + val = gaim_request_field_list_get_selected(field)->data; + break; + case GAIM_REQUEST_FIELD_BOOLEAN: + val = GINT_TO_POINTER(gaim_request_field_bool_get_value(field)); + break; + case GAIM_REQUEST_FIELD_INTEGER: + val = GINT_TO_POINTER(gaim_request_field_int_get_value(field)); + break; + case GAIM_REQUEST_FIELD_STRING: + val = (gpointer)gaim_request_field_string_get_value(field); + break; + default: + break; + } + + pt = gaim_prefs_get_type(id); + switch (pt) + { + case GAIM_PREF_INT: + gaim_prefs_set_int(id, GPOINTER_TO_INT(val)); + break; + case GAIM_PREF_BOOLEAN: + gaim_prefs_set_bool(id, GPOINTER_TO_INT(val)); + break; + case GAIM_PREF_STRING: + gaim_prefs_set_string(id, val); + break; + default: + break; + } + } + } +} + +void gg_prefs_show_all() +{ + GaimRequestFields *fields; + GaimRequestField *field; + GaimRequestFieldGroup *group; + int i; + + fields = gaim_request_fields_new(); + + group = gaim_request_field_group_new(_("Conversations")); + gaim_request_fields_add_group(fields, group); + for (i = 0; convs[i].pref; i++) + { + field = get_pref_field(convs + i); + gaim_request_field_group_add_field(group, field); + } + + group = gaim_request_field_group_new(_("Logging")); + gaim_request_fields_add_group(fields, group); + for (i = 0; logging[i].pref; i++) + { + field = get_pref_field(logging + i); + gaim_request_field_group_add_field(group, field); + } + + gaim_request_fields(NULL, _("Preferences"), NULL, NULL, fields, + _("Save"), G_CALLBACK(save_cb), _("Cancel"), NULL, NULL); +} + diff -r 32a71e64ceae -r 2d1b41e3cf0d console/gntprefs.h --- a/console/gntprefs.h Tue Aug 08 23:20:08 2006 +0000 +++ b/console/gntprefs.h Wed Aug 09 03:41:45 2006 +0000 @@ -1,2 +1,4 @@ void gg_prefs_init(); +void gg_prefs_show_all(); + diff -r 32a71e64ceae -r 2d1b41e3cf0d console/gntrequest.c --- a/console/gntrequest.c Tue Aug 08 23:20:08 2006 +0000 +++ b/console/gntrequest.c Wed Aug 09 03:41:45 2006 +0000 @@ -251,13 +251,12 @@ } else if (type == GAIM_REQUEST_FIELD_LIST) { - GntWidget *tree = field->ui_data; GList *list = NULL; - if (gaim_request_field_list_get_multi_select(field)) { const GList *iter; - + GntWidget *tree = field->ui_data; + iter = gaim_request_field_list_get_items(field); for (; iter; iter = iter->next) { @@ -269,7 +268,8 @@ } else { - gpointer data = gnt_tree_get_selection_data(GNT_TREE(tree)); + GntWidget *combo = field->ui_data; + gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); list = g_list_append(list, data); } @@ -315,7 +315,9 @@ GList *fields = gaim_request_field_group_get_fields(group); GntWidget *hbox; - /* XXX: Do something with the title, perhaps add a bold label */ + gnt_box_add_widget(GNT_BOX(box), + gnt_label_new_with_format(gaim_request_field_group_get_title(group), + GNT_TEXT_FLAG_BOLD)); for (; fields ; fields = fields->next) { @@ -328,7 +330,11 @@ gnt_box_add_widget(GNT_BOX(box), hbox); if (type != GAIM_REQUEST_FIELD_BOOLEAN) - gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(label)); + { + GntWidget *l = gnt_label_new(label); + gnt_widget_set_size(l, 0, 1); + gnt_box_add_widget(GNT_BOX(hbox), l); + } if (type == GAIM_REQUEST_FIELD_BOOLEAN) { @@ -376,28 +382,38 @@ { const GList *list; gboolean multi = gaim_request_field_list_get_multi_select(field); - GntWidget *tree = gnt_tree_new(); - gnt_box_add_widget(GNT_BOX(hbox), tree); - field->ui_data = tree; + if (multi) + { + GntWidget *tree = gnt_tree_new(); + gnt_box_add_widget(GNT_BOX(hbox), tree); + field->ui_data = tree; - list = gaim_request_field_list_get_items(field); - for (; list; list = list->next) - { - const char *text = list->data; - gpointer key = gaim_request_field_list_get_data(field, text); - if (multi) + list = gaim_request_field_list_get_items(field); + for (; list; list = list->next) { + const char *text = list->data; + gpointer key = gaim_request_field_list_get_data(field, text); gnt_tree_add_choice(GNT_TREE(tree), key, gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); if (gaim_request_field_list_is_selected(field, text)) gnt_tree_set_choice(GNT_TREE(tree), key, TRUE); } - else + } + else + { + GntWidget *combo = gnt_combo_box_new(); + gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); + gnt_box_add_widget(GNT_BOX(hbox), combo); + field->ui_data = combo; + + list = gaim_request_field_list_get_items(field); + for (; list; list = list->next) { - gnt_tree_add_row_after(GNT_TREE(tree), key, - gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); + const char *text = list->data; + gpointer key = gaim_request_field_list_get_data(field, text); + gnt_combo_box_add_data(GNT_COMBO_BOX(combo), key, text); if (gaim_request_field_list_is_selected(field, text)) - gnt_tree_set_selected(GNT_TREE(tree), key); + gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), key); } } } @@ -413,9 +429,9 @@ gnt_label_new_with_format(_("Not implemented yet."), GNT_TEXT_FLAG_BOLD)); } - if (fields->next) - gnt_box_add_widget(GNT_BOX(box), gnt_hline_new()); } + if (list->next) + gnt_box_add_widget(GNT_BOX(box), gnt_hline_new()); } gnt_box_add_widget(GNT_BOX(window), box); @@ -425,7 +441,6 @@ gnt_widget_show(window); - return window; } diff -r 32a71e64ceae -r 2d1b41e3cf0d console/libgnt/Makefile.am --- a/console/libgnt/Makefile.am Tue Aug 08 23:20:08 2006 +0000 +++ b/console/libgnt/Makefile.am Wed Aug 09 03:41:45 2006 +0000 @@ -17,6 +17,7 @@ gntstyle.c \ gnttextview.c \ gnttree.c \ + gntutils.c \ gntmain.c libgnt_la_headers = \ @@ -34,6 +35,7 @@ gntstyle.h \ gnttextview.h \ gnttree.h \ + gntutils.h \ gnt.h libgnt_laincludedir=$(includedir)/gnt diff -r 32a71e64ceae -r 2d1b41e3cf0d console/libgnt/gntbutton.c --- a/console/libgnt/gntbutton.c Tue Aug 08 23:20:08 2006 +0000 +++ b/console/libgnt/gntbutton.c Wed Aug 09 03:41:45 2006 +0000 @@ -1,6 +1,7 @@ #include #include "gntbutton.h" +#include "gntutils.h" enum { @@ -31,8 +32,9 @@ gnt_button_size_request(GntWidget *widget) { GntButton *button = GNT_BUTTON(widget); - widget->priv.width = g_utf8_strlen(button->priv->text, -1) + 4; - widget->priv.height = 1; + gnt_util_get_text_bound(button->priv->text, + &widget->priv.width, &widget->priv.height); + widget->priv.width += 4; if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER)) widget->priv.height += 2; } diff -r 32a71e64ceae -r 2d1b41e3cf0d console/libgnt/gntlabel.c --- a/console/libgnt/gntlabel.c Tue Aug 08 23:20:08 2006 +0000 +++ b/console/libgnt/gntlabel.c Wed Aug 09 03:41:45 2006 +0000 @@ -1,4 +1,5 @@ #include "gntlabel.h" +#include "gntutils.h" #include @@ -33,27 +34,9 @@ gnt_label_size_request(GntWidget *widget) { GntLabel *label = GNT_LABEL(widget); - char *s = label->text, *last = s; - int count = 1; - int max = 0; - /* XXX: ew ... everyone look away */ - while (*s) - { - if (*s == '\n' || *s == '\r') - { - count++; - if (max < s - last + 1) - max = s - last + 1; - last = s + 1; - } - s++; - } - if (max < s - last + 1) - max = s - last + 1; - widget->priv.height = count; - - widget->priv.width = max; + gnt_util_get_text_bound(label->text, + &widget->priv.width, &widget->priv.height); } static void diff -r 32a71e64ceae -r 2d1b41e3cf0d console/libgnt/gntmain.c --- a/console/libgnt/gntmain.c Tue Aug 08 23:20:08 2006 +0000 +++ b/console/libgnt/gntmain.c Wed Aug 09 03:41:45 2006 +0000 @@ -391,7 +391,14 @@ ch = ' '; break; } } - fprintf(file, "%c", ch); + if (ch == '&') + fprintf(file, "&"); + else if (ch == '<') + fprintf(file, "<"); + else if (ch == '>') + fprintf(file, ">"); + else + fprintf(file, "%c", ch); old = now; } fprintf(file, "\n"); diff -r 32a71e64ceae -r 2d1b41e3cf0d console/libgnt/gntutils.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/console/libgnt/gntutils.c Wed Aug 09 03:41:45 2006 +0000 @@ -0,0 +1,33 @@ +#include "gntutils.h" + +void gnt_util_get_text_bound(const char *text, int *width, int *height) +{ + const char *s = text, *last; + int count = 1, max = 0; + int len; + + /* XXX: ew ... everyone look away */ + last = s; + while (*s) + { + if (*s == '\n' || *s == '\r') + { + count++; + len = g_utf8_pointer_to_offset(last, s); + if (max < len) + max = len; + last = s + 1; + } + s++; + } + + len = g_utf8_pointer_to_offset(last, s); + if (max < len) + max = len; + + if (height) + *height = count; + if (width) + *width = max + (count > 1); +} + diff -r 32a71e64ceae -r 2d1b41e3cf0d console/libgnt/gntutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/console/libgnt/gntutils.h Wed Aug 09 03:41:45 2006 +0000 @@ -0,0 +1,6 @@ +#include + +#include "gnt.h" +#include "gntwidget.h" + +void gnt_util_get_text_bound(const char *text, int *width, int *height); diff -r 32a71e64ceae -r 2d1b41e3cf0d console/libgnt/test/combo.c --- a/console/libgnt/test/combo.c Tue Aug 08 23:20:08 2006 +0000 +++ b/console/libgnt/test/combo.c Wed Aug 09 03:41:45 2006 +0000 @@ -50,7 +50,9 @@ gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "8", "8"); gnt_combo_box_add_data(GNT_COMBO_BOX(combo), "9", "9"); - gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new("Select")); + GntWidget *l = gnt_label_new("Select"); + gnt_box_add_widget(GNT_BOX(hbox), l); + gnt_widget_set_size(l, 0, 1); gnt_box_add_widget(GNT_BOX(hbox), combo); gnt_box_add_widget(GNT_BOX(box), hbox);