From: <ro...@us...> - 2006-08-13 17:39:38
|
Revision: 16738 Author: roast Date: 2006-08-13 10:38:25 -0700 (Sun, 13 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16738&view=rev Log Message: ----------- merged with svn trunk. 16676:16737. Modified Paths: -------------- branches/soc-2006-file-loggers/configure.ac branches/soc-2006-file-loggers/console/gntblist.c branches/soc-2006-file-loggers/console/gntconv.c branches/soc-2006-file-loggers/console/gntprefs.c branches/soc-2006-file-loggers/console/gntrequest.c branches/soc-2006-file-loggers/console/libgnt/Makefile.am branches/soc-2006-file-loggers/console/libgnt/gntcombobox.c branches/soc-2006-file-loggers/console/libgnt/gntentry.c branches/soc-2006-file-loggers/console/libgnt/gntentry.h branches/soc-2006-file-loggers/console/libgnt/gntkeys.h branches/soc-2006-file-loggers/console/libgnt/gntmain.c branches/soc-2006-file-loggers/console/libgnt/gnttree.c branches/soc-2006-file-loggers/console/libgnt/gnttree.h branches/soc-2006-file-loggers/console/libgnt/gntutils.c branches/soc-2006-file-loggers/console/libgnt/gntwidget.c branches/soc-2006-file-loggers/console/libgnt/test/tv.c branches/soc-2006-file-loggers/gaim.apspec.in branches/soc-2006-file-loggers/plugins/ChangeLog.API branches/soc-2006-file-loggers/plugins/log_reader.c branches/soc-2006-file-loggers/po/ChangeLog branches/soc-2006-file-loggers/po/de.po branches/soc-2006-file-loggers/po/fi.po branches/soc-2006-file-loggers/po/gl.po branches/soc-2006-file-loggers/po/gu.po branches/soc-2006-file-loggers/po/it.po branches/soc-2006-file-loggers/po/sl.po branches/soc-2006-file-loggers/po/zh_TW.po branches/soc-2006-file-loggers/src/account.c branches/soc-2006-file-loggers/src/ft.c branches/soc-2006-file-loggers/src/gtkaccount.c branches/soc-2006-file-loggers/src/gtkblist.c branches/soc-2006-file-loggers/src/gtkdialogs.c branches/soc-2006-file-loggers/src/plugin.c branches/soc-2006-file-loggers/src/protocols/irc/irc.c branches/soc-2006-file-loggers/src/protocols/jabber/JEPS branches/soc-2006-file-loggers/src/protocols/jabber/buddy.c branches/soc-2006-file-loggers/src/protocols/jabber/jabber.c branches/soc-2006-file-loggers/src/protocols/jabber/si.c branches/soc-2006-file-loggers/src/protocols/msn/directconn.c branches/soc-2006-file-loggers/src/protocols/msn/directconn.h branches/soc-2006-file-loggers/src/protocols/msn/httpconn.c branches/soc-2006-file-loggers/src/protocols/msn/nexus.c branches/soc-2006-file-loggers/src/protocols/msn/servconn.c branches/soc-2006-file-loggers/src/protocols/msn/slp.c branches/soc-2006-file-loggers/src/protocols/oscar/family_icbm.c branches/soc-2006-file-loggers/src/protocols/oscar/family_oservice.c branches/soc-2006-file-loggers/src/protocols/oscar/oscar.c branches/soc-2006-file-loggers/src/protocols/oscar/peer.c branches/soc-2006-file-loggers/src/protocols/oscar/peer.h branches/soc-2006-file-loggers/src/protocols/oscar/peer_proxy.c branches/soc-2006-file-loggers/src/protocols/qq/qq_proxy.c branches/soc-2006-file-loggers/src/protocols/sametime/sametime.c branches/soc-2006-file-loggers/src/protocols/silc/silc.c branches/soc-2006-file-loggers/src/protocols/silc/util.c branches/soc-2006-file-loggers/src/protocols/simple/simple.c branches/soc-2006-file-loggers/src/protocols/simple/simple.h branches/soc-2006-file-loggers/src/protocols/simple/sipmsg.c branches/soc-2006-file-loggers/src/protocols/simple/sipmsg.h branches/soc-2006-file-loggers/src/protocols/yahoo/yahoo.c branches/soc-2006-file-loggers/src/protocols/yahoo/yahoo_filexfer.c branches/soc-2006-file-loggers/src/protocols/yahoo/yahoo_picture.c branches/soc-2006-file-loggers/src/protocols/yahoo/yahoochat.c branches/soc-2006-file-loggers/src/protocols/yahoo/ycht.c branches/soc-2006-file-loggers/src/proxy.c branches/soc-2006-file-loggers/src/proxy.h branches/soc-2006-file-loggers/src/request.c branches/soc-2006-file-loggers/src/request.h branches/soc-2006-file-loggers/src/sslconn.c branches/soc-2006-file-loggers/src/upnp.c branches/soc-2006-file-loggers/src/util.c branches/soc-2006-file-loggers/src/xmlnode.h Added Paths: ----------- branches/soc-2006-file-loggers/console/libgnt/gntkeys.c branches/soc-2006-file-loggers/po/ne.po Modified: branches/soc-2006-file-loggers/configure.ac =================================================================== --- branches/soc-2006-file-loggers/configure.ac 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/configure.ac 2006-08-13 17:38:25 UTC (rev 16738) @@ -46,7 +46,7 @@ ;; esac -ALL_LINGUAS="am az bg bn bs ca ca@valencia cs da de el en_AU en_CA en_GB es et eu fa fi fr gl gu he hi hu it ja ka ko ku lt mk my_MM nb nl nn pa pl pt_BR pt ro ru sk sl sq sr sr@Latn sv ta te th tr uk vi xh zh_CN zh_TW" +ALL_LINGUAS="am az bg bn bs ca ca@valencia cs da de el en_AU en_CA en_GB es et eu fa fi fr gl gu he hi hu it ja ka ko ku lt mk my_MM nb ne nl nn pa pl pt_BR pt ro ru sk sl sq sr sr@Latn sv ta te th tr uk vi xh zh_CN zh_TW" AM_GLIB_GNU_GETTEXT dnl we don't use autobreak on cygwin!! @@ -546,7 +546,6 @@ if test "x$enable_debug" = "xyes" ; then AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.]) - enable_fatal_asserts="yes" fi if test "x$enable_fatal_asserts" = "xyes" ; then @@ -1822,9 +1821,10 @@ echo echo Use XScreenSaver Extension.... : $enable_xss echo Use X Session Management...... : $enable_sm -echo Use startup notification.......: $enable_startup_notification +echo Use startup notification...... : $enable_startup_notification echo echo Print debugging messages...... : $enable_debug +echo Assertions are fatal.......... : $enable_fatal_asserts echo eval eval echo Gaim will be installed in $bindir. if test "x$gaimpath" != "x" ; then Modified: branches/soc-2006-file-loggers/console/gntblist.c =================================================================== --- branches/soc-2006-file-loggers/console/gntblist.c 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/gntblist.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -1,5 +1,6 @@ #include <account.h> #include <blist.h> +#include <notify.h> #include <request.h> #include <savedstatuses.h> #include <server.h> @@ -100,7 +101,6 @@ gnt_tree_remove(GNT_TREE(ggblist->tree), node); node->ui_data = NULL; - /* XXX: Depending on the node, we may want to remove the group/contact node if necessary */ if (GAIM_BLIST_NODE_IS_BUDDY(node)) { GaimGroup *group = gaim_buddy_get_group((GaimBuddy*)node); @@ -141,6 +141,103 @@ { } +static void +add_buddy_cb(void *data, GaimRequestFields *allfields) +{ + const char *username = gaim_request_fields_get_string(allfields, "screenname"); + const char *alias = gaim_request_fields_get_string(allfields, "alias"); + const char *group = gaim_request_fields_get_string(allfields, "group"); + GaimAccount *account = gaim_request_fields_get_account(allfields, "account"); + const char *error = NULL; + GaimGroup *grp; + GaimBuddy *buddy; + + if (!username) + error = _("You must provide a screename for the buddy."); + else if (!group) + error = _("You must provide a group."); + else if (!account) + error = _("You must select an account."); + + if (error) + { + gaim_notify_error(NULL, _("Error"), _("Error adding buddy"), error); + return; + } + + grp = gaim_find_group(group); + if (!grp) + { + grp = gaim_group_new(group); + gaim_blist_add_group(grp, NULL); + } + + buddy = gaim_buddy_new(account, username, alias); + gaim_blist_add_buddy(buddy, NULL, grp, NULL); + gaim_account_add_buddy(account, buddy); +} + +static void +gg_request_add_buddy(GaimAccount *account, const char *username, const char *grp, const char *alias) +{ + GaimRequestFields *fields = gaim_request_fields_new(); + GaimRequestFieldGroup *group = gaim_request_field_group_new(NULL); + GaimRequestField *field; + + gaim_request_fields_add_group(fields, group); + + field = gaim_request_field_string_new("screenname", _("Screen Name"), username, FALSE); + gaim_request_field_group_add_field(group, field); + + field = gaim_request_field_string_new("alias", _("Alias"), alias, FALSE); + gaim_request_field_group_add_field(group, field); + + field = gaim_request_field_string_new("group", _("Group"), grp, FALSE); + gaim_request_field_group_add_field(group, field); + + field = gaim_request_field_account_new("account", _("Account"), NULL); + gaim_request_field_account_set_show_all(field, FALSE); + if (account) + gaim_request_field_account_set_value(field, account); + gaim_request_field_group_add_field(group, field); + + gaim_request_fields(NULL, _("Add Buddy"), NULL, _("Please enter buddy information."), + fields, _("Add"), G_CALLBACK(add_buddy_cb), _("Cancel"), NULL, NULL); +} + +static void +add_group_cb(gpointer null, const char *group) +{ + GaimGroup *grp; + + if (!group || !*group) + { + gaim_notify_error(NULL, _("Error"), _("Error adding group"), + _("You must give a name for the group to add.")); + return; + } + + grp = gaim_find_group(group); + if (!grp) + { + grp = gaim_group_new(group); + gaim_blist_add_group(grp, NULL); + } + else + { + gaim_notify_error(NULL, _("Error"), _("Error adding group"), + _("A group with the name already exists.")); + } +} + +static void +gg_request_add_group() +{ + gaim_request_input(NULL, _("Add Group"), NULL, _("Enter the name of the group"), + NULL, FALSE, FALSE, NULL, + _("Add"), G_CALLBACK(add_group_cb), _("Cancel"), NULL, NULL); +} + static GaimBlistUiOps blist_ui_ops = { new_list, @@ -150,9 +247,9 @@ node_remove, NULL, NULL, + .request_add_buddy = gg_request_add_buddy, NULL, - NULL, - NULL + .request_add_group = gg_request_add_group }; static gpointer @@ -360,8 +457,24 @@ } static void +gg_add_buddy(GaimGroup *grp, GaimBlistNode *node) +{ + gaim_blist_request_add_buddy(NULL, NULL, grp->name, NULL); +} + +static void +gg_add_group(GaimGroup *grp, GaimBlistNode *node) +{ + gaim_blist_request_add_group(); +} + +static void create_group_menu(GntTree *tree, GaimGroup *group) { + add_custom_action(tree, _("Add Buddy"), + GAIM_CALLBACK(gg_add_buddy), group); + add_custom_action(tree, _("Add Group"), + GAIM_CALLBACK(gg_add_group), group); } static void @@ -476,26 +589,91 @@ g_free(prompt); } -/* XXX: This still doesn't do anything, because request doesn't have a ui yet */ +/* Xeroxed from gtkdialogs.c:gaim_gtkdialogs_remove_group_cb*/ static void +remove_group(GaimGroup *group) +{ + GaimBlistNode *cnode, *bnode; + + cnode = ((GaimBlistNode*)group)->child; + + while (cnode) { + if (GAIM_BLIST_NODE_IS_CONTACT(cnode)) { + bnode = cnode->child; + cnode = cnode->next; + while (bnode) { + GaimBuddy *buddy; + if (GAIM_BLIST_NODE_IS_BUDDY(bnode)) { + buddy = (GaimBuddy*)bnode; + bnode = bnode->next; + if (gaim_account_is_connected(buddy->account)) { + gaim_account_remove_buddy(buddy->account, buddy, group); + gaim_blist_remove_buddy(buddy); + } + } else { + bnode = bnode->next; + } + } + } else if (GAIM_BLIST_NODE_IS_CHAT(cnode)) { + GaimChat *chat = (GaimChat *)cnode; + cnode = cnode->next; + if (gaim_account_is_connected(chat->account)) + gaim_blist_remove_chat(chat); + } else { + cnode = cnode->next; + } + } + + gaim_blist_remove_group(group); +} + +static void +gg_blist_remove_node(GaimBlistNode *node) +{ + if (GAIM_BLIST_NODE_IS_BUDDY(node)) + { + GaimBuddy *buddy = (GaimBuddy*)node; + GaimGroup *group = gaim_buddy_get_group(buddy); + gaim_account_remove_buddy(gaim_buddy_get_account(buddy), buddy, group); + gaim_blist_remove_buddy(buddy); + } + else if (GAIM_BLIST_NODE_IS_CHAT(node)) + { + gaim_blist_remove_chat((GaimChat*)node); + } + else if (GAIM_BLIST_NODE_IS_GROUP(node)) + { + remove_group((GaimGroup*)node); + } +} + +static void gg_blist_remove_node_cb(GaimBlistNode *node, GaimBlistNode *null) { - void (*callback)(gpointer); + char *primary, *sec = NULL; + const char *name; if (GAIM_BLIST_NODE_IS_BUDDY(node)) - callback = (void(*)(gpointer))gaim_blist_remove_buddy; + name = gaim_buddy_get_name((GaimBuddy*)node); else if (GAIM_BLIST_NODE_IS_CHAT(node)) - callback = (void(*)(gpointer))gaim_blist_remove_chat; + name = gaim_chat_get_name((GaimChat*)node); else if (GAIM_BLIST_NODE_IS_GROUP(node)) - callback = (void(*)(gpointer))gaim_blist_remove_group; + { + name = ((GaimGroup*)node)->name; + sec = _("Removing this group will also remove all the buddies in the group"); + } + else + return; + primary = g_strdup_printf(_("Are you sure you want to remove %s?"), name); + /* XXX: anything to do with the returned ui-handle? */ gaim_request_action(node, _("Confirm Remove"), - _("Are you sure you want to remove ..."), NULL, /* XXX: tidy up */ + primary, sec, 1, node, 2, - _("Remove"), callback, - _("No"), NULL); - + _("Remove"), gg_blist_remove_node, + _("Cancel"), NULL); + g_free(primary); } static void @@ -555,6 +733,7 @@ GAIM_CALLBACK(gg_blist_remove_node_cb), node); window = gnt_vbox_new(FALSE); + GNT_WIDGET_SET_FLAGS(window, GNT_WIDGET_TRANSIENT); gnt_box_set_toplevel(GNT_BOX(window), TRUE); gnt_box_set_title(GNT_BOX(window), title); @@ -634,6 +813,18 @@ g_free(br); } + if (gaim_prefs_get_bool("/gaim/gnt/blist/idletime")) + { + GaimPresence *pre = gaim_buddy_get_presence(buddy); + if (gaim_presence_is_idle(pre)) + { + time_t idle = gaim_presence_get_idle_time(pre); + char *st = gaim_str_seconds_to_string(time(NULL) - idle); + g_string_append_printf(str, _("\nIdle: %s"), st); + g_free(st); + } + } + title = g_strdup(gaim_buddy_get_name(buddy)); } else if (GAIM_BLIST_NODE_IS_GROUP(node)) Modified: branches/soc-2006-file-loggers/console/gntconv.c =================================================================== --- branches/soc-2006-file-loggers/console/gntconv.c 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/gntconv.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -123,6 +123,7 @@ } g_free(escape); } + gnt_entry_add_to_history(GNT_ENTRY(ggconv->entry), text); gnt_entry_clear(GNT_ENTRY(ggconv->entry)); return TRUE; } @@ -198,8 +199,11 @@ ggc->entry = gnt_entry_new(NULL); gnt_box_add_widget(GNT_BOX(ggc->window), ggc->entry); gnt_widget_set_name(ggc->entry, "conversation-window-entry"); + gnt_entry_set_history_length(GNT_ENTRY(ggc->entry), -1); + gnt_entry_set_word_suggest(GNT_ENTRY(ggc->entry), TRUE); + gnt_entry_set_always_suggest(GNT_ENTRY(ggc->entry), FALSE); - g_signal_connect(G_OBJECT(ggc->entry), "key_pressed", G_CALLBACK(entry_key_pressed), ggc); + g_signal_connect_after(G_OBJECT(ggc->entry), "key_pressed", G_CALLBACK(entry_key_pressed), ggc); g_signal_connect(G_OBJECT(ggc->window), "destroy", G_CALLBACK(closing_window), ggc); gnt_widget_set_position(ggc->window, gaim_prefs_get_int(PREF_ROOT "/position/x"), @@ -229,6 +233,9 @@ g_return_if_fail(ggconv != NULL); + if (gaim_prefs_get_bool("/gaim/gnt/conversations/timestamps")) + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), + gaim_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM); if (who && *who && (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV))) { char * name = g_strdup_printf("%s: ", who); @@ -312,6 +319,9 @@ static void gg_chat_add_users(GaimConversation *conv, GList *users, gboolean new_arrivals) { + GGConv *ggc = conv->ui_data; + GntEntry *entry = GNT_ENTRY(ggc->entry); + if (!new_arrivals) { /* Print the list of users in the room */ @@ -332,25 +342,39 @@ GAIM_MESSAGE_SYSTEM, time(NULL)); g_string_free(string, TRUE); } - /* XXX: Add the names for string completion */ + + for (; users; users = users->next) + { + GaimConvChatBuddy *cbuddy = users->data; + gnt_entry_add_suggest(entry, cbuddy->name); + gnt_entry_add_suggest(entry, cbuddy->alias); + } } static void gg_chat_rename_user(GaimConversation *conv, const char *old, const char *new_n, const char *new_a) { /* XXX: Update the name for string completion */ + GGConv *ggc = conv->ui_data; + GntEntry *entry = GNT_ENTRY(ggc->entry); + gnt_entry_remove_suggest(entry, old); + gnt_entry_add_suggest(entry, new_n); + gnt_entry_add_suggest(entry, new_a); } static void gg_chat_remove_user(GaimConversation *conv, GList *list) { /* XXX: Remove the name from string completion */ + GGConv *ggc = conv->ui_data; + GntEntry *entry = GNT_ENTRY(ggc->entry); + for (; list; list = list->next) + gnt_entry_remove_suggest(entry, list->data); } static void gg_chat_update_user(GaimConversation *conv, const char *user) { - /* XXX: This probably will not require updating the string completion */ } static GaimConversationUiOps conv_ui_ops = Modified: branches/soc-2006-file-loggers/console/gntprefs.c =================================================================== --- branches/soc-2006-file-loggers/console/gntprefs.c 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/gntprefs.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -14,9 +14,12 @@ gaim_prefs_add_none("/gaim/gnt/plugins"); gaim_prefs_add_string_list("/gaim/gnt/plugins/loaded", NULL); + gaim_prefs_add_none("/gaim/gnt/blist"); + gaim_prefs_add_bool("/gaim/gnt/blist/idletime", TRUE); + 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); + gaim_prefs_add_bool("/gaim/gnt/conversations/notify_typing", FALSE); /* XXX: Not functional yet */ } typedef struct @@ -93,6 +96,12 @@ return field; } +static Prefs blist[] = +{ + {GAIM_PREF_BOOLEAN, "/gaim/gnt/blist/idletime", _("Show Idle Time"), NULL}, + {GAIM_PREF_NONE, NULL, NULL, NULL} +}; + static Prefs convs[] = { {GAIM_PREF_BOOLEAN, "/gaim/gnt/conversations/timestamps", _("Show Timestamps"), NULL}, @@ -163,31 +172,32 @@ } } -void gg_prefs_show_all() +static void +add_pref_group(GaimRequestFields *fields, const char *title, Prefs *prefs) { - GaimRequestFields *fields; GaimRequestField *field; GaimRequestFieldGroup *group; int i; - fields = gaim_request_fields_new(); - - group = gaim_request_field_group_new(_("Conversations")); + group = gaim_request_field_group_new(title); gaim_request_fields_add_group(fields, group); - for (i = 0; convs[i].pref; i++) + for (i = 0; prefs[i].pref; i++) { - field = get_pref_field(convs + i); + field = get_pref_field(prefs + 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); - } +void gg_prefs_show_all() +{ + GaimRequestFields *fields; + fields = gaim_request_fields_new(); + + add_pref_group(fields, _("Buddy List"), blist); + add_pref_group(fields, _("Conversations"), convs); + add_pref_group(fields, _("Logging"), logging); + gaim_request_fields(NULL, _("Preferences"), NULL, NULL, fields, _("Save"), G_CALLBACK(save_cb), _("Cancel"), NULL, NULL); } Modified: branches/soc-2006-file-loggers/console/gntrequest.c =================================================================== --- branches/soc-2006-file-loggers/console/gntrequest.c 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/gntrequest.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -182,7 +182,7 @@ window = setup_request_window(title, primary, secondary, GAIM_REQUEST_ACTION); - box = gnt_hbox_new(TRUE); + box = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(window), box); for (i = 0; i < actioncount; i++) { @@ -234,7 +234,8 @@ else if (type == GAIM_REQUEST_FIELD_STRING) { GntWidget *entry = field->ui_data; - gaim_request_field_string_set_value(field, gnt_entry_get_text(GNT_ENTRY(entry))); + const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); + gaim_request_field_string_set_value(field, (text && *text) ? text : NULL); } else if (type == GAIM_REQUEST_FIELD_INTEGER) { @@ -278,6 +279,9 @@ } else if (type == GAIM_REQUEST_FIELD_ACCOUNT) { + GntWidget *combo = field->ui_data; + GaimAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); + gaim_request_field_account_set_value(field, acc); } } } @@ -293,13 +297,13 @@ static void * gg_request_fields(const char *title, const char *primary, - const char *secondary, GaimRequestFields *fields, + const char *secondary, GaimRequestFields *allfields, const char *ok, GCallback ok_cb, const char *cancel, GCallback cancel_cb, void *userdata) { GntWidget *window, *box; - GList *list; + GList *grlist; window = setup_request_window(title, primary, secondary, GAIM_REQUEST_FIELDS); @@ -309,27 +313,28 @@ box = gnt_vbox_new(FALSE); gnt_box_set_pad(GNT_BOX(box), 0); gnt_box_set_fill(GNT_BOX(box), TRUE); - for (list = gaim_request_fields_get_groups(fields); list; list = list->next) + for (grlist = gaim_request_fields_get_groups(allfields); grlist; grlist = grlist->next) { - GaimRequestFieldGroup *group = list->data; + GaimRequestFieldGroup *group = grlist->data; GList *fields = gaim_request_field_group_get_fields(group); GntWidget *hbox; - - gnt_box_add_widget(GNT_BOX(box), - gnt_label_new_with_format(gaim_request_field_group_get_title(group), - GNT_TEXT_FLAG_BOLD)); + const char *title = gaim_request_field_group_get_title(group); + if (title) + gnt_box_add_widget(GNT_BOX(box), + gnt_label_new_with_format(title, GNT_TEXT_FLAG_BOLD)); + for (; fields ; fields = fields->next) { + /* XXX: Break each of the fields into a separate function? */ GaimRequestField *field = fields->data; GaimRequestFieldType type = gaim_request_field_get_type(field); const char *label = gaim_request_field_get_label(field); - hbox = gnt_hbox_new(FALSE); - gnt_box_set_pad(GNT_BOX(hbox), 0); + hbox = gnt_hbox_new(TRUE); /* hrm */ gnt_box_add_widget(GNT_BOX(box), hbox); - if (type != GAIM_REQUEST_FIELD_BOOLEAN) + if (type != GAIM_REQUEST_FIELD_BOOLEAN && label) { GntWidget *l = gnt_label_new(label); gnt_widget_set_size(l, 0, 1); @@ -417,12 +422,44 @@ } } } -#if 0 else if (type == GAIM_REQUEST_FIELD_ACCOUNT) { - /* XXX: remember to set the field->ui_data */ + gboolean all; + GaimAccount *def; + GList *list; + 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; + + all = gaim_request_field_account_get_show_all(field); + def = gaim_request_field_account_get_default_value(field); + + if (all) + list = gaim_accounts_get_all(); + else + list = gaim_connections_get_all(); + + for (; list; list = list->next) + { + GaimAccount *account; + char *text; + + if (all) + account = list->data; + else + account = gaim_connection_get_account(list->data); + + text = g_strdup_printf("%s (%s)", + gaim_account_get_username(account), + gaim_account_get_protocol_name(account)); + gnt_combo_box_add_data(GNT_COMBO_BOX(combo), account, text); + g_free(text); + if (account == def) + gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), account); + } + gnt_widget_set_size(combo, 20, 3); /* ew */ } -#endif else { gnt_box_add_widget(GNT_BOX(hbox), @@ -430,12 +467,12 @@ GNT_TEXT_FLAG_BOLD)); } } - if (list->next) + if (grlist->next) gnt_box_add_widget(GNT_BOX(box), gnt_hline_new()); } gnt_box_add_widget(GNT_BOX(window), box); - box = setup_button_box(userdata, request_fields_cb, fields, + box = setup_button_box(userdata, request_fields_cb, allfields, ok, ok_cb, cancel, cancel_cb, NULL); gnt_box_add_widget(GNT_BOX(window), box); Modified: branches/soc-2006-file-loggers/console/libgnt/Makefile.am =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/Makefile.am 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/libgnt/Makefile.am 2006-08-13 17:38:25 UTC (rev 16738) @@ -11,6 +11,7 @@ gntcolors.c \ gntcombobox.c \ gntentry.c \ + gntkeys.c \ gntlabel.c \ gntline.c \ gntmarshal.c \ Modified: branches/soc-2006-file-loggers/console/libgnt/gntcombobox.c =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntcombobox.c 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/libgnt/gntcombobox.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -74,8 +74,13 @@ static void gnt_combo_box_size_request(GntWidget *widget) { - widget->priv.height = 3; /* For now, a combobox will have border */ - widget->priv.width = 15; + if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED)) + { + GntWidget *dd = GNT_COMBO_BOX(widget)->dropdown; + gnt_widget_size_request(dd); + widget->priv.height = 3; /* For now, a combobox will have border */ + widget->priv.width = MIN(10, dd->priv.width + 4); + } } static void Modified: branches/soc-2006-file-loggers/console/libgnt/gntentry.c =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntentry.c 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/libgnt/gntentry.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -1,7 +1,9 @@ #include <ctype.h> #include <string.h> +#include "gntbox.h" #include "gntentry.h" +#include "gnttree.h" enum { @@ -12,6 +14,92 @@ static guint signals[SIGS] = { 0 }; static void +destroy_suggest(GntEntry *entry) +{ + if (entry->ddown) + { + gnt_widget_destroy(entry->ddown->parent); + entry->ddown = NULL; + } +} + +static char * +get_beginning_of_word(GntEntry *entry) +{ + char *s = entry->cursor; + while (s > entry->start) + { + char *t = g_utf8_find_prev_char(entry->start, s); + if ((*t < 'A' || *t > 'Z') && (*t < 'a' || *t > 'z')) + break; + s = t; + } + return s; +} + +static gboolean +show_suggest_dropdown(GntEntry *entry) +{ + char *suggest = NULL; + int len; + int offset = 0, x, y; + int count = 0; + GList *iter; + + if (entry->word) + { + char *s = get_beginning_of_word(entry); + suggest = g_strndup(s, entry->cursor - s); + if (entry->scroll < s) + offset = g_utf8_pointer_to_offset(entry->scroll, s); + } + else + suggest = g_strdup(entry->start); + len = strlen(suggest); /* Don't need to use the utf8-function here */ + + if (entry->ddown == NULL) + { + GntWidget *box = gnt_vbox_new(FALSE); + entry->ddown = gnt_tree_new(); + gnt_box_add_widget(GNT_BOX(box), entry->ddown); + + GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_TRANSIENT); + + gnt_widget_get_position(GNT_WIDGET(entry), &x, &y); + x += offset; + y++; + if (y + 10 >= getmaxy(stdscr)) + y -= 11; + gnt_widget_set_position(box, x, y); + + gnt_widget_draw(box); + } + else + gnt_tree_remove_all(GNT_TREE(entry->ddown)); + + for (count = 0, iter = entry->suggests; iter; iter = iter->next) + { + const char *text = iter->data; + if (g_ascii_strncasecmp(suggest, text, len) == 0 && strlen(text) >= len) + { + gnt_tree_add_row_after(GNT_TREE(entry->ddown), (gpointer)text, + gnt_tree_create_row(GNT_TREE(entry->ddown), text), + NULL, NULL); + count++; + } + } + g_free(suggest); + + if (count == 0) + { + destroy_suggest(entry); + return FALSE; + } + + return TRUE; +} + +static void gnt_entry_draw(GntWidget *widget) { GntEntry *entry = GNT_ENTRY(widget); @@ -80,6 +168,11 @@ memmove(entry->cursor, entry->cursor + len, entry->end - entry->cursor - len + 1); entry->end -= len; entry_redraw(widget); + + if (entry->ddown) + show_suggest_dropdown(entry); + + return TRUE; } else if (strcmp(text + 1, GNT_KEY_LEFT) == 0 && entry->cursor > entry->start) { @@ -87,6 +180,8 @@ if (entry->cursor < entry->scroll) entry->scroll = entry->cursor; entry_redraw(widget); + + return TRUE; } else if (strcmp(text + 1, GNT_KEY_RIGHT) == 0 && entry->cursor < entry->end) { @@ -94,15 +189,89 @@ if (g_utf8_pointer_to_offset(entry->scroll, entry->cursor) >= widget->priv.width) entry->scroll = g_utf8_find_next_char(entry->scroll, NULL); entry_redraw(widget); + + return TRUE; } + else if (strcmp(text + 1, GNT_KEY_CTRL_DOWN) == 0 && entry->histlength) + { + if (entry->history->prev) + { + entry->history = entry->history->prev; + gnt_entry_set_text(entry, entry->history->data); + destroy_suggest(entry); + + return TRUE; + } + } + else if (strcmp(text + 1, GNT_KEY_UP) == 0 || + strcmp(text + 1, GNT_KEY_DOWN) == 0) + { + if (entry->ddown) + { + gnt_widget_key_pressed(entry->ddown, text); + return TRUE; + } + } + else if (strcmp(text + 1, GNT_KEY_CTRL_UP) == 0 && entry->histlength) + { + if (entry->history->next) + { + if (entry->history->prev == NULL) + { + /* Save the current contents */ + char *text = g_strdup(gnt_entry_get_text(entry)); + g_free(entry->history->data); + entry->history->data = text; + } + + entry->history = entry->history->next; + gnt_entry_set_text(entry, entry->history->data); + destroy_suggest(entry); + + return TRUE; + } + } /* XXX: handle other keys, like home/end, and ctrl+ goodness */ - else - return FALSE; + else if (text[1] == 0) + { + destroy_suggest(entry); + } - return TRUE; + return FALSE; } else { + if (text[0] == '\t') + { + if (entry->ddown) + destroy_suggest(entry); + else if (entry->suggests) + return show_suggest_dropdown(entry); + + return FALSE; + } + else if (text[0] == '\r' && entry->ddown) + { + char *text = g_strdup(gnt_tree_get_selection_data(GNT_TREE(entry->ddown))); + destroy_suggest(entry); + if (entry->word) + { + char *s = get_beginning_of_word(entry); + char *iter = text; + while (toupper(*s) == toupper(*iter)) + { + *s++ = *iter++; + } + gnt_entry_key_pressed(widget, iter); + } + else + { + gnt_entry_set_text(entry, text); + } + g_free(text); + return TRUE; + } + if (!iscntrl(text[0])) { const char *str, *next; @@ -143,6 +312,9 @@ while (g_utf8_pointer_to_offset(entry->scroll, entry->cursor) >= widget->priv.width) entry->scroll = g_utf8_find_next_char(entry->scroll, NULL); + + if (entry->ddown) + show_suggest_dropdown(entry); } entry_redraw(widget); return TRUE; @@ -161,6 +333,8 @@ entry->scroll = g_utf8_find_prev_char(entry->start, entry->scroll); entry_redraw(widget); + if (entry->ddown) + show_suggest_dropdown(entry); return TRUE; } } @@ -174,9 +348,35 @@ { GntEntry *entry = GNT_ENTRY(widget); g_free(entry->start); + + if (entry->history) + { + entry->history = g_list_first(entry->history); + g_list_foreach(entry->history, (GFunc)g_free, NULL); + g_list_free(entry->history); + } + + if (entry->suggests) + { + g_list_foreach(entry->suggests, (GFunc)g_free, NULL); + g_list_free(entry->suggests); + } + + if (entry->ddown) + { + gnt_widget_destroy(entry->ddown->parent); + } } static void +gnt_entry_lost_focus(GntWidget *widget) +{ + GntEntry *entry = GNT_ENTRY(widget); + destroy_suggest(entry); + entry_redraw(widget); +} + +static void gnt_entry_class_init(GntEntryClass *klass) { parent_class = GNT_WIDGET_CLASS(klass); @@ -185,6 +385,7 @@ parent_class->map = gnt_entry_map; parent_class->size_request = gnt_entry_size_request; parent_class->key_pressed = gnt_entry_key_pressed; + parent_class->lost_focus = gnt_entry_lost_focus; DEBUG; } @@ -197,7 +398,14 @@ entry->flag = GNT_ENTRY_FLAG_ALL; entry->max = 0; + + entry->histlength = 0; + entry->history = NULL; + entry->word = TRUE; + entry->always = FALSE; + entry->suggests = NULL; + GNT_WIDGET_SET_FLAGS(GNT_WIDGET(entry), GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW | GNT_WIDGET_CAN_TAKE_FOCUS); GNT_WIDGET_SET_FLAGS(GNT_WIDGET(entry), GNT_WIDGET_GROW_X); @@ -302,6 +510,7 @@ gnt_entry_set_text(entry, NULL); entry->scroll = entry->cursor = entry->end = entry->start; entry_redraw(GNT_WIDGET(entry)); + destroy_suggest(entry); } void gnt_entry_set_masked(GntEntry *entry, gboolean set) @@ -309,3 +518,90 @@ entry->masked = set; } +void gnt_entry_add_to_history(GntEntry *entry, const char *text) +{ + g_return_if_fail(entry->history != NULL); /* Need to set_history_length first */ + + if (g_list_length(entry->history) >= entry->histlength) + return; + + entry->history = g_list_first(entry->history); + g_free(entry->history->data); + entry->history->data = g_strdup(text); + entry->history = g_list_prepend(entry->history, NULL); +} + +void gnt_entry_set_history_length(GntEntry *entry, int num) +{ + if (num == 0) + { + entry->histlength = num; + if (entry->history) + { + entry->history = g_list_first(entry->history); + g_list_foreach(entry->history, (GFunc)g_free, NULL); + g_list_free(entry->history); + entry->history = NULL; + } + return; + } + + if (entry->histlength == 0) + { + entry->histlength = num; + entry->history = g_list_append(NULL, NULL); + return; + } + + if (num > 0 && num < entry->histlength) + { + GList *first, *iter; + int index = 0; + for (first = entry->history, index = 0; first->prev; first = first->prev, index++); + while ((iter = g_list_nth(first, num)) != NULL) + { + g_free(iter->data); + first = g_list_delete_link(first, iter); + } + entry->histlength = num; + if (index >= num) + entry->history = g_list_last(first); + return; + } + + entry->histlength = num; +} + +void gnt_entry_set_word_suggest(GntEntry *entry, gboolean word) +{ + entry->word = word; +} + +void gnt_entry_set_always_suggest(GntEntry *entry, gboolean always) +{ + entry->always = always; +} + +void gnt_entry_add_suggest(GntEntry *entry, const char *text) +{ + GList *find; + + if (!text || !*text) + return; + + find = g_list_find_custom(entry->suggests, text, (GCompareFunc)g_utf8_collate); + if (find) + return; + entry->suggests = g_list_append(entry->suggests, g_strdup(text)); +} + +void gnt_entry_remove_suggest(GntEntry *entry, const char *text) +{ + GList *find = g_list_find_custom(entry->suggests, text, (GCompareFunc)g_utf8_collate); + if (find) + { + g_free(find->data); + entry->suggests = g_list_delete_link(entry->suggests, find); + } +} + Modified: branches/soc-2006-file-loggers/console/libgnt/gntentry.h =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntentry.h 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/libgnt/gntentry.h 2006-08-13 17:38:25 UTC (rev 16738) @@ -50,6 +50,14 @@ int max; /* 0 means infinite */ gboolean masked; + + GList *history; /* History of the strings. User can use this by pressing ctrl+up/down */ + int histlength; /* How long can the history be? */ + + GList *suggests; /* List of suggestions */ + gboolean word; /* Are the suggestions for only a word, or for the whole thing? */ + gboolean always; /* Should the list of suggestions show at all times, or only on tab-press? */ + GntWidget *ddown; /* The dropdown with the suggested list */ }; struct _GnEntryClass @@ -70,7 +78,6 @@ void gnt_entry_set_max(GntEntry *entry, int max); -/* XXX: For now, call gnt_entry_clear before calling this */ void gnt_entry_set_text(GntEntry *entry, const char *text); void gnt_entry_set_flag(GntEntry *entry, GntEntryFlag flag); @@ -81,6 +88,18 @@ void gnt_entry_set_masked(GntEntry *entry, gboolean set); +void gnt_entry_add_to_history(GntEntry *entry, const char *text); + +void gnt_entry_set_history_length(GntEntry *entry, int num); + +void gnt_entry_set_word_suggest(GntEntry *entry, gboolean word); + +void gnt_entry_set_always_suggest(GntEntry *entry, gboolean always); + +void gnt_entry_add_suggest(GntEntry *entry, const char *text); + +void gnt_entry_remove_suggest(GntEntry *entry, const char *text); + G_END_DECLS #endif /* GNT_ENTRY_H */ Copied: branches/soc-2006-file-loggers/console/libgnt/gntkeys.c (from rev 16737, trunk/console/libgnt/gntkeys.c) =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntkeys.c (rev 0) +++ branches/soc-2006-file-loggers/console/libgnt/gntkeys.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -0,0 +1,29 @@ +#include "gntkeys.h" + +#include <string.h> + +void gnt_keys_refine(char *text) +{ + if (text[0] == 27) + { + /* These are for urxvt */ + if (strcmp(text + 1, "Oa") == 0) + { + strcpy(text + 1, GNT_KEY_CTRL_UP); + } + else if (strcmp(text + 1, "Ob") == 0) + { + strcpy(text + 1, GNT_KEY_CTRL_DOWN); + } + } + else if ((unsigned char)text[0] == 195) + { + /* These for xterm */ + if (text[2] == 0) + { + text[0] = 27; + text[1] -= 64; + } + } +} + Modified: branches/soc-2006-file-loggers/console/libgnt/gntkeys.h =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntkeys.h 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/libgnt/gntkeys.h 2006-08-13 17:38:25 UTC (rev 16738) @@ -9,6 +9,11 @@ #define GNT_KEY_UP "[A" #define GNT_KEY_DOWN "[B" +#define GNT_KEY_CTRL_UP "[1;5A" +#define GNT_KEY_CTRL_DOWN "[1;5B" +#define GNT_KEY_CTRL_RIGHT "[1;5C" +#define GNT_KEY_CTRL_LEFT "[1;5D" + #define GNT_KEY_PGUP "[5~" #define GNT_KEY_PGDOWN "[6~" @@ -17,4 +22,9 @@ #define GNT_KEY_BACKSPACE "\177" #define GNT_KEY_DEL "[3~" +/** + * This will do stuff with the terminal settings and stuff. + */ +void gnt_keys_refine(char *text); + #endif Modified: branches/soc-2006-file-loggers/console/libgnt/gntmain.c =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntmain.c 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/libgnt/gntmain.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -13,6 +13,11 @@ #include <unistd.h> #include <string.h> +/** + * Notes: Interesting functions to look at: + * scr_dump, scr_init, scr_restore: for workspaces + */ + static int lock_focus_list; static GList *focus_list; @@ -52,6 +57,14 @@ static void draw_taskbar(); static void bring_on_top(GntWidget *widget); +static gboolean +update_screen(gpointer null) +{ + update_panels(); + doupdate(); + return TRUE; +} + void gnt_screen_take_focus(GntWidget *widget) { GntWidget *w = NULL; @@ -119,8 +132,7 @@ GntNode *nd = g_hash_table_lookup(nodes, window_list.window); top_panel(nd->panel); } - update_panels(); - doupdate(); + update_screen(NULL); draw_taskbar(); } @@ -437,6 +449,8 @@ dump_screen(); } + gnt_keys_refine(buffer); + if (mode == GNT_KP_MODE_NORMAL) { if (focus_list) @@ -499,6 +513,14 @@ { shift_window(focus_list->data, 1); } + else if (strcmp(buffer + 1, "l") == 0) + { + touchwin(stdscr); + touchwin(newscr); + wrefresh(newscr); + update_screen(NULL); + draw_taskbar(); + } } } } @@ -557,8 +579,7 @@ GntNode *node = g_hash_table_lookup(nodes, widget); gnt_widget_set_position(widget, x, y); move_panel(node->panel, y, x); - update_panels(); - doupdate(); + update_screen(NULL); } } else if (*buffer == '\r') @@ -656,6 +677,10 @@ ascii_only = TRUE; initscr(); + typeahead(-1); + noecho(); + curs_set(0); + gnt_init_colors(); gnt_init_styles(); @@ -671,7 +696,6 @@ nodes = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, free_node); wbkgdset(stdscr, '\0' | COLOR_PAIR(GNT_COLOR_NORMAL)); - noecho(); refresh(); #if 0 mousemask(NCURSES_BUTTON_PRESSED | NCURSES_BUTTON_RELEASED | REPORT_MOUSE_POSITION, NULL); @@ -729,8 +753,7 @@ } } - update_panels(); - doupdate(); + update_screen(NULL); } void gnt_screen_release(GntWidget *widget) @@ -750,8 +773,7 @@ gnt_tree_remove(GNT_TREE(window_list.tree), widget); } - update_panels(); - doupdate(); + update_screen(NULL); } void gnt_screen_update(GntWidget *widget) @@ -779,8 +801,7 @@ top_panel(nd->panel); } - update_panels(); - doupdate(); + update_screen(NULL); } gboolean gnt_widget_has_focus(GntWidget *widget) @@ -844,8 +865,7 @@ gnt_widget_draw(widget); replace_panel(node->panel, widget->window); show_panel(node->panel); - update_panels(); - doupdate(); + update_screen(NULL); } } Modified: branches/soc-2006-file-loggers/console/libgnt/gnttree.c =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gnttree.c 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/libgnt/gnttree.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -770,6 +770,15 @@ } } +void gnt_tree_remove_all(GntTree *tree) +{ + tree->root = NULL; + g_hash_table_remove_all(tree->hash); + g_list_free(tree->list); + tree->list = NULL; + tree->current = tree->top = tree->bottom = NULL; +} + int gnt_tree_get_selection_visible_line(GntTree *tree) { return get_distance(tree->top, tree->current) + Modified: branches/soc-2006-file-loggers/console/libgnt/gnttree.h =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gnttree.h 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/libgnt/gnttree.h 2006-08-13 17:38:25 UTC (rev 16738) @@ -85,6 +85,8 @@ void gnt_tree_remove(GntTree *tree, gpointer key); +void gnt_tree_remove_all(GntTree *tree); + /* Returns the visible line number of the selected row */ int gnt_tree_get_selection_visible_line(GntTree *tree); Modified: branches/soc-2006-file-loggers/console/libgnt/gntutils.c =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntutils.c 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/libgnt/gntutils.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -8,23 +8,26 @@ /* XXX: ew ... everyone look away */ last = s; - while (*s) + if (s) { - if (*s == '\n' || *s == '\r') + while (*s) { - count++; - len = g_utf8_pointer_to_offset(last, s); - if (max < len) - max = len; - last = s + 1; + if (*s == '\n' || *s == '\r') + { + count++; + len = g_utf8_pointer_to_offset(last, s); + if (max < len) + max = len; + last = s + 1; + } + s++; } - s++; + + len = g_utf8_pointer_to_offset(last, s); + if (max < len) + max = len; } - len = g_utf8_pointer_to_offset(last, s); - if (max < len) - max = len; - if (height) *height = count; if (width) Modified: branches/soc-2006-file-loggers/console/libgnt/gntwidget.c =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/gntwidget.c 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/libgnt/gntwidget.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -80,6 +80,23 @@ return TRUE; } +static gboolean +gnt_boolean_handled_accumulator(GSignalInvocationHint *ihint, + GValue *return_accu, + const GValue *handler_return, + gpointer dummy) +{ + gboolean continue_emission; + gboolean signal_handled; + + signal_handled = g_value_get_boolean (handler_return); + g_value_set_boolean (return_accu, signal_handled); + continue_emission = !signal_handled; + + return continue_emission; +} + + static void gnt_widget_class_init(GntWidgetClass *klass) { @@ -194,7 +211,7 @@ G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(GntWidgetClass, key_pressed), - NULL, NULL, + gnt_boolean_handled_accumulator, NULL, gnt_closure_marshal_BOOLEAN__STRING, G_TYPE_BOOLEAN, 1, G_TYPE_STRING); DEBUG; Modified: branches/soc-2006-file-loggers/console/libgnt/test/tv.c =================================================================== --- branches/soc-2006-file-loggers/console/libgnt/test/tv.c 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/console/libgnt/test/tv.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -14,19 +14,24 @@ gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(view), gnt_entry_get_text(GNT_ENTRY(w)), GNT_TEXT_FLAG_HIGHLIGHT); + gnt_entry_add_to_history(GNT_ENTRY(w), gnt_entry_get_text(GNT_ENTRY(w))); gnt_text_view_next_line(GNT_TEXT_VIEW(view)); gnt_entry_clear(GNT_ENTRY(w)); if (gnt_text_view_get_lines_below(GNT_TEXT_VIEW(view)) <= 1) gnt_text_view_scroll(GNT_TEXT_VIEW(view), 0); + gnt_entry_remove_suggest(GNT_ENTRY(w), "acb"); return TRUE; } else if (key[0] == 27) { - if (strcmp(key+1, GNT_KEY_UP)) + if (strcmp(key+1, GNT_KEY_UP) == 0) + gnt_text_view_scroll(GNT_TEXT_VIEW(view), -1); + else if (strcmp(key+1, GNT_KEY_DOWN) == 0) gnt_text_view_scroll(GNT_TEXT_VIEW(view), 1); - else if (strcmp(key+1, GNT_KEY_DOWN)) - gnt_text_view_scroll(GNT_TEXT_VIEW(view), -1); + else + return FALSE; + return TRUE; } return FALSE; @@ -53,6 +58,15 @@ gnt_widget_set_name(entry, "entry"); GNT_WIDGET_SET_FLAGS(entry, GNT_WIDGET_CAN_TAKE_FOCUS); + gnt_entry_set_word_suggest(GNT_ENTRY(entry), TRUE); + gnt_entry_set_always_suggest(GNT_ENTRY(entry), FALSE); + gnt_entry_add_suggest(GNT_ENTRY(entry), "a"); + gnt_entry_add_suggest(GNT_ENTRY(entry), "ab"); + gnt_entry_add_suggest(GNT_ENTRY(entry), "abc"); + gnt_entry_add_suggest(GNT_ENTRY(entry), "abcd"); + gnt_entry_add_suggest(GNT_ENTRY(entry), "abcde"); + gnt_entry_add_suggest(GNT_ENTRY(entry), "acb"); + view = gnt_text_view_new(); gnt_widget_set_name(view, "view"); @@ -65,7 +79,8 @@ gnt_widget_show(hbox); - g_signal_connect(G_OBJECT(entry), "key_pressed", G_CALLBACK(key_pressed), view); + gnt_entry_set_history_length(GNT_ENTRY(entry), -1); + g_signal_connect_after(G_OBJECT(entry), "key_pressed", G_CALLBACK(key_pressed), view); #ifdef STANDALONE gnt_main(); Modified: branches/soc-2006-file-loggers/gaim.apspec.in =================================================================== --- branches/soc-2006-file-loggers/gaim.apspec.in 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/gaim.apspec.in 2006-08-13 17:38:25 UTC (rev 16738) @@ -15,7 +15,7 @@ [Description] Gaim allows you to talk to anyone using a variety of messaging protocols, including AIM (Oscar and TOC), ICQ, IRC, Yahoo!, MSN Messenger, Jabber, -Gadu-Gadu, Napster, and Zephyr. These protocols are implemented using a +Gadu-Gadu, and Zephyr. These protocols are implemented using a modular, easy to use design. To use a protocol, just add an account using the account editor. Modified: branches/soc-2006-file-loggers/plugins/ChangeLog.API =================================================================== --- branches/soc-2006-file-loggers/plugins/ChangeLog.API 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/plugins/ChangeLog.API 2006-08-13 17:38:25 UTC (rev 16738) @@ -114,6 +114,9 @@ * All network activity has been updated to use non-blocking sockets. This means that plugins must be updated to expect such a socket from gaim_proxy_connect() and gaim_network_listen*(). + * gaim_proxy_connect(): changed to return NULL on error and a void * + handle on success, and changed parameters. It is now possible to + cancel connection attempts. * gaim_gtk_create_imhtml(): Added sw_ret() parameter * gaim_account_get_log(): Added create parameter * GAIM_CMD_P_VERYHIGH is now GAIM_CMD_P_VERY_HIGH Modified: branches/soc-2006-file-loggers/plugins/log_reader.c =================================================================== --- branches/soc-2006-file-loggers/plugins/log_reader.c 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/plugins/log_reader.c 2006-08-13 17:38:25 UTC (rev 16738) @@ -796,6 +796,7 @@ time_t time_unix; struct tm *tm_new; char *timestamp; + char *tmp; const char *style; new_session_id = xmlnode_get_attrib(message, "SessionID"); @@ -906,7 +907,7 @@ !isalnum(*(from_name + alias_length))); - to_name_matches = (gaim_str_has_prefix( + to_name_matches = to_name && (gaim_str_has_prefix( to_name, alias) && !isalnum(*(to_name + alias_length))); @@ -988,16 +989,18 @@ style = xmlnode_get_attrib(text_node, "Style"); + tmp = xmlnode_get_data(text_node); if (style && *style) { text = g_string_append(text, "<span style=\""); text = g_string_append(text, style); text = g_string_append(text, "\">"); - text = g_string_append(text, xmlnode_get_data(text_node)); + text = g_string_append(text, tmp); text = g_string_append(text, "</span>\n"); } else { - text = g_string_append(text, xmlnode_get_data(text_node)); + text = g_string_append(text, tmp); text = g_string_append(text, "\n"); } + g_free(tmp); } data->text = text; @@ -1493,7 +1496,7 @@ g_string_append(formatted, "<span style=\"color: #ff0000;\">"); - + if (gaim_str_has_prefix(line, "Your previous message has not been sent. " "Reason: Maximum length exceeded.")) { @@ -1713,10 +1716,11 @@ char buffer[1024] = ""; DWORD size = (sizeof(buffer) - 1); DWORD type; + gboolean found = FALSE; path = NULL; /* TODO: Test this after removing the trailing "\\". */ - if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, "Trillian.SkinZip\\shell\\Add\\command\\", + if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, "Trillian.SkinZip\\shell\\Add\\command\\", 0, KEY_QUERY_VALUE, &hKey)) { if(ERROR_SUCCESS == RegQueryValueEx(hKey, "", NULL, &type, (LPBYTE)buffer, &size)) { @@ -1751,20 +1755,18 @@ if (!path) { char *folder = wgaim_get_special_folder(CSIDL_PROGRAM_FILES); - if (folder) + if (folder) { path = g_build_filename(folder, "Trillian", "users", "default", "talk.ini", NULL); g_free(folder); } } - gboolean found = FALSE; - if (path) { /* Read talk.ini file to find the log directory. */ GError *error = NULL; -#if 0 && GTK_CHECK_VERSION(2,6,0) /* FIXME: Not tested yet. */ +#if 0 && GLIB_CHECK_VERSION(2,6,0) /* FIXME: Not tested yet. */ GKeyFile *key_file; gaim_debug(GAIM_DEBUG_INFO, "Trillian talk.ini read", @@ -1791,9 +1793,9 @@ g_key_file_free(key_file); } -#else /* !GTK_CHECK_VERSION(2,6,0) */ - GError *error = NULL; +#else /* !GLIB_CHECK_VERSION(2,6,0) */ gsize length; + gchar *contents = NULL; gaim_debug(GAIM_DEBUG_INFO, "Trillian talk.ini read", "Reading %s\n", path); Modified: branches/soc-2006-file-loggers/po/ChangeLog =================================================================== --- branches/soc-2006-file-loggers/po/ChangeLog 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/po/ChangeLog 2006-08-13 17:38:25 UTC (rev 16738) @@ -23,13 +23,16 @@ * German translation updated (Bjoern Voigt) * German win32 translation updated (Bjoern Voigt) * Greek translation added (Bouklis Panos) + * Gujarati translation updated (Ankit Patel) * Hebrew translation updated (Shalom Craimer) * Hungarian translation updated (Gabor Kelemen) + * Italian translation updated (Claudio Satriano) * Japanese translation updated (Takeshi Aihana) * Kurdish translation added (Erdal Ronahi and Amed Ç. Jiyan) * Kurdish win32 installer translation added (Erdal Ronahi) * Lithuanian translation updated (Andrius Štikonas, Laurynas Biveinis) * Lithuanian win32 translation added (Laurynas Biveinis) + * Nepali translation added (Shyam Krishna Bal) * Persian translation added (Elnaz Sarbar, Meelad Zakaria) * Polish translation updated (Emil Nowak) * Portuguese translation updated (Duarte Henriques) Modified: branches/soc-2006-file-loggers/po/de.po =================================================================== --- branches/soc-2006-file-loggers/po/de.po 2006-08-13 16:01:52 UTC (rev 16737) +++ branches/soc-2006-file-loggers/po/de.po 2006-08-13 17:38:25 UTC (rev 16738) @@ -10,8 +10,8 @@ msgstr "" "Project-Id-Version: Gaim\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-04-29 23:34+0200\n" -"PO-Revision-Date: 2006-04-29 23:33+0200\n" +"POT-Creation-Date: 2006-06-20 10:30+0200\n" +"PO-Revision-Date: 2006-06-20 10:38+0200\n" "Last-Translator: Björn Voigt <bj...@cs...>\n" "Language-Team: de <de...@li...>\n" "MIME-Version: 1.0\n" @@ -196,7 +196,7 @@ msgid "Right-click for more unread messages...\n" msgstr "Rechtsklicken für weitere ungelesene Nachrichten...\n" -#: ../plugins/docklet/docklet.c:157 ../src/gtkblist.c:3230 +#: ../plugins/docklet/docklet.c:157 ../src/gtkblist.c:3246 #, c-format msgid "%d unread message from %s\n" msgid_plural "%d unread messages from %s\n" @@ -208,10 +208,10 @@ msgstr "Ändere Status" #: ../plugins/docklet/docklet.c:435 ../src/gtkstatusbox.c:673 -#: ../src/protocols/gg/gg.c:996 ../src/protocols/jabber/buddy.c:1104 +#: ../src/protocols/gg/gg.c:996 ../src/protocols/jabber/buddy.c:1363 #: ../src/protocols/msn/state.c:29 ../src/protocols/msn/state.c:30 #: ../src/protocols/msn/state.c:37 ../src/protocols/msn/state.c:38 -#: ../src/protocols/novell/novell.c:2845 ../src/protocols/yahoo/yahoo.c:2733 +#: ../src/protocols/novell/novell.c:2843 ../src/protocols/yahoo/yahoo.c:2731 #: ../src/status.c:155 msgid "Available" msgstr "Verfügbar" @@ -222,25 +222,25 @@ #: ../plugins/docklet/docklet.c:439 ../src/gtkprefs.c:1774 #: ../src/gtkstatusbox.c:674 ../src/protocols/gg/gg.c:999 #: ../src/protocols/irc/irc.c:520 ../src/protocols/irc/msgs.c:223 -#: ../src/protocols/jabber/buddy.c:1108 ../src/protocols/novell/novell.c:2848 -#: ../src/protocols/oscar/oscar.c:719 ../src/protocols/oscar/oscar.c:4391 -#: ../src/protocols/oscar/oscar.c:5434 ../src/protocols/silc/buddy.c:1469 -#: ../src/protocols/yahoo/yahoo.c:3187 ../src/protocols/yahoo/yahoo.c:3260 +#: ../src/protocols/jabber/buddy.c:1367 ../src/protocols/novell/novell.c:2846 +#: ../src/protocols/oscar/oscar.c:719 ../src/protocols/oscar/oscar.c:4397 +#: ../src/protocols/oscar/oscar.c:5440 ../src/protocols/silc/buddy.c:1469 +#: ../src/protocols/yahoo/yahoo.c:3185 ../src/protocols/yahoo/yahoo.c:3258 #: ../src/status.c:158 msgid "Away" msgstr "Abwesend" #: ../plugins/docklet/docklet.c:443 ../src/gtkstatusbox.c:675 -#: ../src/protocols/oscar/oscar.c:723 ../src/protocols/yahoo/yahoo.c:2727 +#: ../src/protocols/oscar/oscar.c:723 ../src/protocols/yahoo/yahoo.c:2725 #: ../src/status.c:157 msgid "Invisible" msgstr "Unsichtbar" -#: ../plugins/docklet/docklet.c:447 ../src/gtkblist.c:2960 +#: ../plugins/docklet/docklet.c:447 ../src/gtkblist.c:2976 #: ../src/gtkstatusbox.c:676 ../src/protocols/gg/gg.c:993 -#: ../src/protocols/jabber/buddy.c:1102 ../src/protocols/novell/novell.c:2857 -#: ../src/protocols/oscar/oscar.c:785 ../src/protocols/oscar/oscar.c:5406 -#: ../src/protocols/yahoo/yahoo.c:2731 ../src/status.c:154 +#: ../src/protocols/jabber/buddy.c:1361 ../src/protocols/novell/novell.c:2855 +#: ../src/protocols/oscar/oscar.c:785 ../src/protocols/oscar/oscar.c:5412 +#: ../src/protocols/yahoo/yahoo.c:2729 ../src/status.c:154 msgid "Offline" msgstr "Offline" @@ -256,7 +256,7 @@ msgid "Show Buddy List" msgstr "Buddy-Liste anzeigen" -#: ../plugins/docklet/docklet.c:489 ../src/gtkconv.c:5626 +#: ../plugins/docklet/docklet.c:489 ../src/gtkconv.c:5675 msgid "Unread Messages" msgstr "Ungelesene Nachrichten" @@ -296,7 +296,7 @@ msgstr "_Sofortnachrichten:" #: ../plugins/docklet/docklet.c:684 ../plugins/docklet/docklet.c:692 -#: ../plugins/win32/winprefs/winprefs.c:424 ../src/gtkprefs.c:823 +#: ../plugins/win32/winprefs/winprefs.c:462 ../src/gtkprefs.c:823 #: ../src/gtkprefs.c:1764 ../src/gtkprefs.c:1778 msgid "Never" msgstr "Niemals" @@ -307,7 +307,7 @@ #: ../plugins/docklet/docklet.c:686 ../plugins/docklet/docklet.c:694 #: ../plugins/timestamp_format.c:39 ../plugins/timestamp_format.c:48 -#: ../plugins/win32/winprefs/winprefs.c:425 ../src/gtkprefs.c:825 +#: ../plugins/win32/winprefs/winprefs.c:463 ../src/gtkprefs.c:825 msgid "Always" msgstr "Immer" @@ -617,7 +617,7 @@ #. Business #: ../plugins/gevolution/add_buddy_dialog.c:131 #: ../plugins/gevolution/assoc-buddy.c:119 ../src/gtkplugin.c:587 -#: ../src/gtkroomlist.c:604 ../src/protocols/jabber/jabber.c:755 +#: ../src/gtkroomlist.c:604 ../src/protocols/jabber/jabber.c:759 #: ../src/protocols/msn/msn.c:1532 ../src/protocols/msn/msn.c:1585 #: ../src/protocols/msn/msn.c:1606 msgid "Name" @@ -627,10 +627,10 @@ msgid "Instant Messaging" msgstr "Sofortnachrichten" -#: ../plugins/gevolution/add_buddy_dialog.c:442 ../src/gtkblist.c:4526 +#: ../plugins/gevolution/add_buddy_dialog.c:442 ../src/gtkblist.c:4532 #: ../src/protocols/silc/buddy.c:736 ../src/protocols/silc/buddy.c:1030 #: ../src/protocols/silc/buddy.c:1075 ../src/protocols/silc/buddy.c:1174 -#: ../src/protocols/yahoo/yahoo.c:2976 +#: ../src/protocols/yahoo/yahoo.c:2974 msgid "Add Buddy" msgstr "Buddy hinzufügen" @@ -644,14 +644,14 @@ #. "Search" #: ../plugins/gevolution/add_buddy_dialog.c:468 #: ../plugins/gevolution/assoc-buddy.c:353 -#: ../src/protocols/jabber/buddy.c:1460 ../src/protocols/oscar/oscar.c:6014 -#: ../src/protocols/sametime/sametime.c:5531 +#: ../src/protocols/jabber/buddy.c:1720 ../src/protocols/oscar/oscar.c:6020 +#: ../src/protocols/sametime/sametime.c:5529 msgid "Search" msgstr "Suchen" #: ../plugins/gevolution/add_buddy_dialog.c:549 -#: ../plugins/gevolution/new_person_dialog.c:307 ../src/gtkblist.c:4610 -#: ../src/gtkblist.c:4974 +#: ../plugins/gevolution/new_person_dialog.c:307 ../src/gtkblist.c:4616 +#: ../src/gtkblist.c:4980 msgid "Group:" msgstr "Gruppe:" @@ -687,13 +687,13 @@ msgstr "_Assoziiere den Buddy" #: ../plugins/gevolution/eds-utils.c:73 ../plugins/gevolution/eds-utils.c:86 -#: ../src/protocols/jabber/jabber.c:1122 +#: ../src/protocols/jabber/jabber.c:1125 msgid "None" msgstr "Kein" #: ../plugins/gevolution/gevo-util.c:64 ../plugins/gevolution/gevolution.c:96 #: ../src/blist.c:516 ../src/blist.c:1278 ../src/blist.c:1505 -#: ../src/gtkblist.c:4419 ../src/protocols/jabber/roster.c:65 +#: ../src/gtkblist.c:4425 ../src/protocols/jabber/roster.c:66 msgid "Buddies" msgstr "Buddys" @@ -730,8 +730,8 @@ "Wählen Sie alle Konten, zu denen Buddys automatisch hinzugefügt werden " "sollen." -#: ../plugins/gevolution/gevolution.c:450 ../plugins/idle.c:150 -#: ../plugins/idle.c:186 ../src/gtknotify.c:399 ../src/gtkpounce.c:1262 +#: ../plugins/gevolution/gevolution.c:450 ../plugins/idle.c:153 +#: ../plugins/idle.c:189 ../src/gtknotify.c:399 ../src/gtkpounce.c:1255 msgid "Account" msgstr "Konto" @@ -768,7 +768,7 @@ msgstr "Kontotyp:" #: ../plugins/gevolution/new_person_dialog.c:295 ../src/gtkaccount.c:784 -#: ../src/gtkblist.c:4572 +#: ../src/gtkblist.c:4578 msgid "Screen name:" msgstr "Benutzername:" @@ -870,50 +870,50 @@ msgid "Iconifies the buddy list and your conversations when you go away." msgstr "Minimiert die Buddy-Liste und die Gesprächsfenster, wenn Sie weggehen." -#: ../plugins/idle.c:155 ../plugins/idle.c:213 +#: ../plugins/idle.c:158 ../plugins/idle.c:216 msgid "Minutes" msgstr "Minuten" #. This is a cultural reference. Dy'er Mak'er is a song by Led Zeppelin. #. If that doesn't translate well into your language, drop the 's before translating. -#: ../plugins/idle.c:162 ../plugins/idle.c:195 ../plugins/idle.c:220 -#: ../plugins/idle.c:312 +#: ../plugins/idle.c:165 ../plugins/idle.c:198 ../plugins/idle.c:223 +#: ../plugins/idle.c:315 msgid "I'dle Mak'er" msgstr "Untätigkeitsmarker" -#: ../plugins/idle.c:163 ../plugins/idle.c:252 +#: ../plugins/idle.c:166 ../plugins/idle.c:255 msgid "Set Account Idle Time" msgstr "Setze Konto-Untätigkeitszeit" -#: ../plugins/idle.c:166 ../plugins/idle.c:224 +#: ../plugins/idle.c:169 ../plugins/idle.c:227 msgid "_Set" msgstr "_Setzen" -#: ../plugins/idle.c:167 ../plugins/idle.c:200 ../plugins/idle.c:225 +#: ../plugins/idle.c:170 ../plugins/idle.c:203 ../plugins/idle.c:228 msgid "_Cancel" msgstr "A_bbrechen" -#: ../plugins/idle.c:180 +#: ../plugins/idle.c:183 msgid "None of your accounts are idle." msgstr "Keine ihrer Konten sind untätig." -#: ../... [truncated message content] |