From: <ro...@us...> - 2006-08-09 04:52:51
|
Revision: 16677 Author: roast Date: 2006-08-08 21:49:19 -0700 (Tue, 08 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16677&view=rev Log Message: ----------- merged with svn trunk. 16597:16676. Modified Paths: -------------- branches/soc-2006-file-loggers/COPYRIGHT branches/soc-2006-file-loggers/ChangeLog branches/soc-2006-file-loggers/Makefile.mingw branches/soc-2006-file-loggers/configure.ac branches/soc-2006-file-loggers/console/Makefile branches/soc-2006-file-loggers/console/gntaccount.c branches/soc-2006-file-loggers/console/gntblist.c branches/soc-2006-file-loggers/console/gntblist.h branches/soc-2006-file-loggers/console/gntconv.c branches/soc-2006-file-loggers/console/gntdebug.c branches/soc-2006-file-loggers/console/gntdebug.h branches/soc-2006-file-loggers/console/gntgaim.c branches/soc-2006-file-loggers/console/gntprefs.c branches/soc-2006-file-loggers/console/gntprefs.h branches/soc-2006-file-loggers/console/gntrequest.c branches/soc-2006-file-loggers/console/gntui.c branches/soc-2006-file-loggers/console/libgnt/Makefile.am branches/soc-2006-file-loggers/console/libgnt/gntbox.c branches/soc-2006-file-loggers/console/libgnt/gntbox.h branches/soc-2006-file-loggers/console/libgnt/gntbutton.c 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/gntlabel.c branches/soc-2006-file-loggers/console/libgnt/gntline.c branches/soc-2006-file-loggers/console/libgnt/gntmain.c branches/soc-2006-file-loggers/console/libgnt/gntstyle.c branches/soc-2006-file-loggers/console/libgnt/gntstyle.h branches/soc-2006-file-loggers/console/libgnt/gnttextview.c branches/soc-2006-file-loggers/console/libgnt/gnttextview.h 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/gntwidget.c branches/soc-2006-file-loggers/console/libgnt/gntwidget.h branches/soc-2006-file-loggers/console/libgnt/test/combo.c branches/soc-2006-file-loggers/console/libgnt/test/multiwin.c branches/soc-2006-file-loggers/console/libgnt/test/tv.c branches/soc-2006-file-loggers/doc/Makefile.am branches/soc-2006-file-loggers/doc/gaim.1.in branches/soc-2006-file-loggers/doc/gaims_funniest_home_convos.txt branches/soc-2006-file-loggers/gaim.spec.in branches/soc-2006-file-loggers/pixmaps/status/default/Makefile.am branches/soc-2006-file-loggers/plugins/codeinline.c branches/soc-2006-file-loggers/plugins/contact_priority.c branches/soc-2006-file-loggers/plugins/dbus-example.c branches/soc-2006-file-loggers/plugins/history.c branches/soc-2006-file-loggers/plugins/log_reader.c branches/soc-2006-file-loggers/plugins/timestamp.c branches/soc-2006-file-loggers/po/POTFILES.in branches/soc-2006-file-loggers/src/account.c branches/soc-2006-file-loggers/src/accountopt.c branches/soc-2006-file-loggers/src/blist.c branches/soc-2006-file-loggers/src/buddyicon.c branches/soc-2006-file-loggers/src/cipher.c branches/soc-2006-file-loggers/src/cmds.c branches/soc-2006-file-loggers/src/connection.c branches/soc-2006-file-loggers/src/conversation.c branches/soc-2006-file-loggers/src/core.c branches/soc-2006-file-loggers/src/dbus-define-api.h branches/soc-2006-file-loggers/src/dbus-server.h branches/soc-2006-file-loggers/src/dbus-useful.c branches/soc-2006-file-loggers/src/dbus-useful.h branches/soc-2006-file-loggers/src/ft.c branches/soc-2006-file-loggers/src/gaim-client-example.c branches/soc-2006-file-loggers/src/gaim-client.c branches/soc-2006-file-loggers/src/gtkaccount.c branches/soc-2006-file-loggers/src/gtkblist.c branches/soc-2006-file-loggers/src/gtkconv.c branches/soc-2006-file-loggers/src/gtkdebug.c branches/soc-2006-file-loggers/src/gtkdialogs.c branches/soc-2006-file-loggers/src/gtkft.c branches/soc-2006-file-loggers/src/gtkimhtml.c branches/soc-2006-file-loggers/src/gtkimhtmltoolbar.c branches/soc-2006-file-loggers/src/gtklog.c branches/soc-2006-file-loggers/src/gtkpluginpref.c branches/soc-2006-file-loggers/src/gtkpounce.c branches/soc-2006-file-loggers/src/gtkprefs.c branches/soc-2006-file-loggers/src/gtkprivacy.c branches/soc-2006-file-loggers/src/gtkrequest.c branches/soc-2006-file-loggers/src/gtkroomlist.c branches/soc-2006-file-loggers/src/gtksound.c branches/soc-2006-file-loggers/src/gtkstatusbox.c branches/soc-2006-file-loggers/src/gtkthemes.c branches/soc-2006-file-loggers/src/gtkutils.c branches/soc-2006-file-loggers/src/imgstore.c branches/soc-2006-file-loggers/src/log.c branches/soc-2006-file-loggers/src/mime.c branches/soc-2006-file-loggers/src/mime.h branches/soc-2006-file-loggers/src/notify.c branches/soc-2006-file-loggers/src/plugin.c branches/soc-2006-file-loggers/src/pluginpref.c branches/soc-2006-file-loggers/src/pounce.c branches/soc-2006-file-loggers/src/prefs.c branches/soc-2006-file-loggers/src/protocols/Makefile.am branches/soc-2006-file-loggers/src/protocols/bonjour/jabber.c branches/soc-2006-file-loggers/src/protocols/jabber/jabber.c branches/soc-2006-file-loggers/src/protocols/msn/servconn.c branches/soc-2006-file-loggers/src/protocols/oscar/oft.c branches/soc-2006-file-loggers/src/protocols/oscar/oscar.c branches/soc-2006-file-loggers/src/protocols/qq/Makefile.am branches/soc-2006-file-loggers/src/protocols/qq/Makefile.mingw branches/soc-2006-file-loggers/src/protocols/qq/buddy_info.c branches/soc-2006-file-loggers/src/protocols/qq/buddy_info.h branches/soc-2006-file-loggers/src/protocols/qq/buddy_list.c branches/soc-2006-file-loggers/src/protocols/qq/buddy_list.h branches/soc-2006-file-loggers/src/protocols/qq/buddy_opt.c branches/soc-2006-file-loggers/src/protocols/qq/buddy_opt.h branches/soc-2006-file-loggers/src/protocols/qq/buddy_status.c branches/soc-2006-file-loggers/src/protocols/qq/buddy_status.h branches/soc-2006-file-loggers/src/protocols/qq/char_conv.c branches/soc-2006-file-loggers/src/protocols/qq/char_conv.h branches/soc-2006-file-loggers/src/protocols/qq/crypt.c branches/soc-2006-file-loggers/src/protocols/qq/crypt.h branches/soc-2006-file-loggers/src/protocols/qq/file_trans.c branches/soc-2006-file-loggers/src/protocols/qq/file_trans.h branches/soc-2006-file-loggers/src/protocols/qq/group.c branches/soc-2006-file-loggers/src/protocols/qq/group.h branches/soc-2006-file-loggers/src/protocols/qq/group_conv.c branches/soc-2006-file-loggers/src/protocols/qq/group_conv.h branches/soc-2006-file-loggers/src/protocols/qq/group_find.c branches/soc-2006-file-loggers/src/protocols/qq/group_find.h branches/soc-2006-file-loggers/src/protocols/qq/group_free.c branches/soc-2006-file-loggers/src/protocols/qq/group_free.h branches/soc-2006-file-loggers/src/protocols/qq/group_hash.c branches/soc-2006-file-loggers/src/protocols/qq/group_hash.h branches/soc-2006-file-loggers/src/protocols/qq/group_im.c branches/soc-2006-file-loggers/src/protocols/qq/group_im.h branches/soc-2006-file-loggers/src/protocols/qq/group_info.c branches/soc-2006-file-loggers/src/protocols/qq/group_info.h branches/soc-2006-file-loggers/src/protocols/qq/group_join.c branches/soc-2006-file-loggers/src/protocols/qq/group_join.h branches/soc-2006-file-loggers/src/protocols/qq/group_misc.c branches/soc-2006-file-loggers/src/protocols/qq/group_misc.h branches/soc-2006-file-loggers/src/protocols/qq/group_network.c branches/soc-2006-file-loggers/src/protocols/qq/group_network.h branches/soc-2006-file-loggers/src/protocols/qq/group_opt.c branches/soc-2006-file-loggers/src/protocols/qq/group_opt.h branches/soc-2006-file-loggers/src/protocols/qq/group_search.c branches/soc-2006-file-loggers/src/protocols/qq/group_search.h branches/soc-2006-file-loggers/src/protocols/qq/header_info.c branches/soc-2006-file-loggers/src/protocols/qq/header_info.h branches/soc-2006-file-loggers/src/protocols/qq/im.c branches/soc-2006-file-loggers/src/protocols/qq/im.h branches/soc-2006-file-loggers/src/protocols/qq/keep_alive.c branches/soc-2006-file-loggers/src/protocols/qq/keep_alive.h branches/soc-2006-file-loggers/src/protocols/qq/login_logout.c branches/soc-2006-file-loggers/src/protocols/qq/login_logout.h branches/soc-2006-file-loggers/src/protocols/qq/packet_parse.c branches/soc-2006-file-loggers/src/protocols/qq/packet_parse.h branches/soc-2006-file-loggers/src/protocols/qq/qq.c branches/soc-2006-file-loggers/src/protocols/qq/qq.h branches/soc-2006-file-loggers/src/protocols/qq/qq_proxy.c branches/soc-2006-file-loggers/src/protocols/qq/qq_proxy.h branches/soc-2006-file-loggers/src/protocols/qq/recv_core.c branches/soc-2006-file-loggers/src/protocols/qq/recv_core.h branches/soc-2006-file-loggers/src/protocols/qq/send_core.c branches/soc-2006-file-loggers/src/protocols/qq/send_core.h branches/soc-2006-file-loggers/src/protocols/qq/send_file.c branches/soc-2006-file-loggers/src/protocols/qq/send_file.h branches/soc-2006-file-loggers/src/protocols/qq/sendqueue.c branches/soc-2006-file-loggers/src/protocols/qq/sendqueue.h branches/soc-2006-file-loggers/src/protocols/qq/sys_msg.c branches/soc-2006-file-loggers/src/protocols/qq/sys_msg.h branches/soc-2006-file-loggers/src/protocols/qq/udp_proxy_s5.c branches/soc-2006-file-loggers/src/protocols/qq/udp_proxy_s5.h branches/soc-2006-file-loggers/src/protocols/qq/utils.c branches/soc-2006-file-loggers/src/protocols/qq/utils.h branches/soc-2006-file-loggers/src/protocols/yahoo/yahoo.c branches/soc-2006-file-loggers/src/protocols/yahoo/yahoo_packet.c branches/soc-2006-file-loggers/src/protocols/yahoo/yahoo_packet.h branches/soc-2006-file-loggers/src/proxy.c branches/soc-2006-file-loggers/src/prpl.c branches/soc-2006-file-loggers/src/request.c branches/soc-2006-file-loggers/src/roomlist.c branches/soc-2006-file-loggers/src/server.c branches/soc-2006-file-loggers/src/signals.c branches/soc-2006-file-loggers/src/status.c branches/soc-2006-file-loggers/src/util.c branches/soc-2006-file-loggers/src/value.c branches/soc-2006-file-loggers/src/whiteboard.c branches/soc-2006-file-loggers/src/xmlnode.c Added Paths: ----------- branches/soc-2006-file-loggers/console/gntplugin.c branches/soc-2006-file-loggers/console/gntplugin.h branches/soc-2006-file-loggers/console/libgnt/gntutils.c branches/soc-2006-file-loggers/console/libgnt/gntutils.h branches/soc-2006-file-loggers/doc/gntgaim.1.in Removed Paths: ------------- branches/soc-2006-file-loggers/pixmaps/status/default/napster.png branches/soc-2006-file-loggers/src/gaim-socket.h branches/soc-2006-file-loggers/src/protocols/napster/ branches/soc-2006-file-loggers/src/protocols/qq/ip_location.c branches/soc-2006-file-loggers/src/protocols/qq/ip_location.h branches/soc-2006-file-loggers/src/socket.c Property Changed: ---------------- branches/soc-2006-file-loggers/doc/ branches/soc-2006-file-loggers/plugins/codeinline.c Modified: branches/soc-2006-file-loggers/COPYRIGHT =================================================================== --- branches/soc-2006-file-loggers/COPYRIGHT 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/COPYRIGHT 2006-08-09 04:49:19 UTC (rev 16677) @@ -86,6 +86,7 @@ Nelson Elhage Ignacio J. Elia Brian Enigma +Mattias Eriksson Stefan Esser Steffen Eschenbacher Marc Etcheverry Modified: branches/soc-2006-file-loggers/ChangeLog =================================================================== --- branches/soc-2006-file-loggers/ChangeLog 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/ChangeLog 2006-08-09 04:49:19 UTC (rev 16677) @@ -152,6 +152,7 @@ * SIP/SIMPLE support (Thomas Butter, Google Summer of Code) * Sametime protocol support Requires the meanwhile library: http://meanwhile.sourceforge.net + * Removed support for the napster and toc protocols Other Noteworthy Changes: * UPnP and NAT traversal support (Adam J. Warrington, Google Summer of Modified: branches/soc-2006-file-loggers/Makefile.mingw =================================================================== --- branches/soc-2006-file-loggers/Makefile.mingw 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/Makefile.mingw 2006-08-09 04:49:19 UTC (rev 16677) @@ -21,7 +21,6 @@ TOC = $(GAIM_PROTOS)/toc IRC = $(GAIM_PROTOS)/irc JABBER = $(GAIM_PROTOS)/jabber -NAPSTER = $(GAIM_PROTOS)/napster GG = $(GAIM_PROTOS)/gg NOVELL = $(GAIM_PROTOS)/novell SILC = $(GAIM_PROTOS)/silc @@ -55,7 +54,6 @@ TOC_TYPE = PLUGIN IRC_TYPE = PLUGIN JABBER_TYPE = PLUGIN -NAPSTER_TYPE = PLUGIN GG_TYPE = PLUGIN NOVELL_TYPE = PLUGIN SILC_TYPE = PLUGIN @@ -69,7 +67,6 @@ $(MAKE) TYPE='$(MSN_TYPE)' -C $(MSN) -f Makefile.mingw $(MAKE) TYPE='$(IRC_TYPE)' -C $(IRC) -f Makefile.mingw $(MAKE) TYPE='$(JABBER_TYPE)' -C $(JABBER) -f Makefile.mingw - $(MAKE) TYPE='$(NAPSTER_TYPE)' -C $(NAPSTER) -f Makefile.mingw $(MAKE) TYPE='$(GG_TYPE)' -C $(GG) -f Makefile.mingw $(MAKE) TYPE='$(NOVELL_TYPE)' -C $(NOVELL) -f Makefile.mingw $(MAKE) TYPE='$(SILC_TYPE)' -C $(SILC) -f Makefile.mingw @@ -91,7 +88,6 @@ $(MAKE) TYPE='$(MSN_TYPE)' -C $(MSN) -f Makefile.mingw install $(MAKE) TYPE='$(IRC_TYPE)' -C $(IRC) -f Makefile.mingw install $(MAKE) TYPE='$(JABBER_TYPE)' -C $(JABBER) -f Makefile.mingw install - $(MAKE) TYPE='$(NAPSTER_TYPE)' -C $(NAPSTER) -f Makefile.mingw install $(MAKE) TYPE='$(GG_TYPE)' -C $(GG) -f Makefile.mingw install $(MAKE) TYPE='$(NOVELL_TYPE)' -C $(NOVELL) -f Makefile.mingw install $(MAKE) TYPE='$(SILC_TYPE)' -C $(SILC) -f Makefile.mingw install @@ -119,7 +115,6 @@ $(MAKE) -C $(MSN) -f Makefile.mingw clean $(MAKE) -C $(IRC) -f Makefile.mingw clean $(MAKE) -C $(JABBER) -f Makefile.mingw clean - $(MAKE) -C $(NAPSTER) -f Makefile.mingw clean $(MAKE) -C $(GG) -f Makefile.mingw clean $(MAKE) -C $(NOVELL) -f Makefile.mingw clean $(MAKE) -C $(SILC) -f Makefile.mingw clean Modified: branches/soc-2006-file-loggers/configure.ac =================================================================== --- branches/soc-2006-file-loggers/configure.ac 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/configure.ac 2006-08-09 04:49:19 UTC (rev 16677) @@ -1747,6 +1747,7 @@ gaim.service doc/Makefile doc/gaim.1 + doc/gntgaim.1 m4macros/Makefile pixmaps/Makefile pixmaps/smileys/Makefile @@ -1776,7 +1777,6 @@ src/protocols/irc/Makefile src/protocols/jabber/Makefile src/protocols/msn/Makefile - src/protocols/napster/Makefile src/protocols/novell/Makefile src/protocols/oscar/Makefile src/protocols/qq/Makefile Modified: branches/soc-2006-file-loggers/console/Makefile =================================================================== --- branches/soc-2006-file-loggers/console/Makefile 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/console/Makefile 2006-08-09 04:49:19 UTC (rev 16677) @@ -1,7 +1,7 @@ VERSION=gntgaim-0.0.0dev CC=gcc CFLAGS=`pkg-config --cflags gaim gobject-2.0 gnt` -g -Wall -DVERSION=\"$(VERSION)\" -DSTANDALONE -LDFLAGS=`pkg-config --libs gaim gobject-2.0 libxml-2.0 gnt` -pg +LDFLAGS=`pkg-config --libs gaim gobject-2.0 libxml-2.0 gnt` -pg -lgaim GG_SOURCES = \ gntaccount.c \ @@ -10,6 +10,7 @@ gntconv.c \ gntdebug.c \ gntnotify.c \ + gntplugin.c \ gntprefs.c \ gntrequest.c \ gntui.c @@ -22,6 +23,7 @@ gntdebug.h \ gntnotify.h \ gntprefs.h \ + gntplugin.h \ gntrequest.h \ gntui.h @@ -32,6 +34,7 @@ gntconv.o \ gntdebug.o \ gntnotify.o \ + gntplugin.o \ gntprefs.o \ gntrequest.o \ gntui.o Modified: branches/soc-2006-file-loggers/console/gntaccount.c =================================================================== --- branches/soc-2006-file-loggers/console/gntaccount.c 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/console/gntaccount.c 2006-08-09 04:49:19 UTC (rev 16677) @@ -49,6 +49,9 @@ GntWidget *remember; } AccountEditDialog; +/* This is necessary to close an edit-dialog when an account is deleted */ +static GList *accountdialogs; + static void account_add(GaimAccount *account) { @@ -64,6 +67,7 @@ static void edit_dialog_destroy(AccountEditDialog *dialog) { + accountdialogs = g_list_remove(accountdialogs, dialog); g_list_free(dialog->prpl_entries); g_list_free(dialog->split_entries); g_free(dialog); @@ -143,7 +147,6 @@ gaim_account_set_password(account, NULL); /* Mail notification */ - /* XXX: Only if the protocol has anything to do with emails */ gaim_account_set_check_mail(account, gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->newmail))); @@ -210,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; @@ -229,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)); @@ -426,18 +430,32 @@ GList *list, *iter; AccountEditDialog *dialog; + if (account) + { + GList *iter; + for (iter = accountdialogs; iter; iter = iter->next) + { + AccountEditDialog *dlg = iter->data; + if (dlg->account == account) + return; + } + } + 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(); @@ -446,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))); @@ -453,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); @@ -467,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); @@ -477,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); @@ -500,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); @@ -534,10 +558,38 @@ } static void +really_delete_account(GaimAccount *account) +{ + GList *iter; + for (iter = accountdialogs; iter; iter = iter->next) + { + AccountEditDialog *dlg = iter->data; + if (dlg->account == account) + { + gnt_widget_destroy(dlg->window); + break; + } + } + gaim_accounts_delete(account); +} + +static void delete_account_cb(GntWidget *widget, GntTree *tree) { - /* XXX: After the request-api is complete */ - /* Note: remove the modify-dialog for the account */ + GaimAccount *account; + char *prompt; + + account = gnt_tree_get_selection_data(tree); + if (!account) + return; + + prompt = g_strdup_printf(_("Are you sure you want to delete %s?"), + gaim_account_get_username(account)); + + gaim_request_close_with_handle(account); /* Close any other opened delete window */ + gaim_request_action(account, _("Delete Account"), prompt, NULL, 0, account, 2, + _("Delete"), really_delete_account, _("Cancel"), NULL); + g_free(prompt); } static void @@ -548,12 +600,19 @@ gaim_account_set_enabled(account, GAIM_GNT_UI, gnt_tree_get_choice(GNT_TREE(widget), key)); } +static void +reset_accounts_win(GntWidget *widget, gpointer null) +{ + accounts.window = NULL; + accounts.tree = NULL; +} + void gg_accounts_show_all() { 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); @@ -582,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); @@ -597,6 +656,8 @@ g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(delete_account_cb), accounts.tree); gnt_box_add_widget(GNT_BOX(accounts.window), box); + + g_signal_connect(G_OBJECT(accounts.window), "destroy", G_CALLBACK(reset_accounts_win), NULL); gnt_widget_show(accounts.window); } @@ -641,7 +702,8 @@ void gg_accounts_uninit() { - gnt_widget_destroy(accounts.window); + if (accounts.window) + gnt_widget_destroy(accounts.window); } /* The following uiops stuff are copied from gtkaccount.c */ Modified: branches/soc-2006-file-loggers/console/gntblist.c =================================================================== --- branches/soc-2006-file-loggers/console/gntblist.c 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/console/gntblist.c 2006-08-09 04:49:19 UTC (rev 16677) @@ -1,18 +1,26 @@ #include <account.h> #include <blist.h> #include <request.h> +#include <savedstatuses.h> #include <server.h> #include <signal.h> +#include <status.h> #include <util.h> #include "gntgaim.h" #include "gntbox.h" +#include "gntcombobox.h" +#include "gntentry.h" #include "gntlabel.h" +#include "gntline.h" #include "gnttree.h" #include "gntblist.h" #include <string.h> +#define PREF_ROOT "/gaim/gnt/blist" +#define TYPING_TIMEOUT 4000 + typedef struct { GntWidget *window; @@ -23,8 +31,29 @@ GntWidget *context; GaimBlistNode *cnode; + + /* XXX: I am KISSing */ + GntWidget *status; /* Dropdown with the statuses */ + GntWidget *statustext; /* Status message */ + int typing; } GGBlist; +typedef enum +{ + STATUS_PRIMITIVE = 0, + STATUS_SAVED +} StatusType; + +typedef struct +{ + StatusType type; + union + { + GaimStatusPrimitive prim; + GaimSavedStatus *saved; + } u; +} StatusBoxItem; + GGBlist *ggblist; static void add_buddy(GaimBuddy *buddy, GGBlist *ggblist); @@ -32,7 +61,9 @@ static void add_chat(GaimChat *chat, GGBlist *ggblist); static void add_node(GaimBlistNode *node, GGBlist *ggblist); static void draw_tooltip(GGBlist *ggblist); +static gboolean remove_typing_cb(gpointer null); static void remove_peripherals(GGBlist *ggblist); +static const char * get_display_name(GaimBlistNode *node); static void new_node(GaimBlistNode *node) @@ -63,7 +94,7 @@ { GGBlist *ggblist = list->ui_data; - if (node->ui_data == NULL) + if (ggblist == NULL || node->ui_data == NULL) return; gnt_tree_remove(GNT_TREE(ggblist->tree), node); @@ -82,6 +113,15 @@ static void node_update(GaimBuddyList *list, GaimBlistNode *node) { + if (list->ui_data == NULL) + return; + + if (node->ui_data != NULL) + { + gnt_tree_change_text(GNT_TREE(ggblist->tree), node, + 0, get_display_name(node)); + } + if (GAIM_BLIST_NODE_IS_BUDDY(node)) { GaimBuddy *buddy = (GaimBuddy*)node; @@ -101,7 +141,7 @@ { } -static GaimBlistUiOps blist_ui_ops = +static GaimBlistUiOps blist_ui_ops = { new_list, new_node, @@ -131,7 +171,7 @@ return; gnt_tree_remove(GNT_TREE(ggblist->tree), group); node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, - gnt_tree_create_row(GNT_TREE(ggblist->tree), group->name), NULL, NULL); + gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), NULL, NULL); } static const char * @@ -175,6 +215,8 @@ strncpy(status, "~", sizeof(status) - 1); } + else if (GAIM_BLIST_NODE_IS_GROUP(node)) + return ((GaimGroup*)node)->name; snprintf(text, sizeof(text) - 1, "%s %s", status, name); @@ -188,6 +230,8 @@ GaimBlistNode *node = (GaimBlistNode *)chat; if (node->ui_data) return; + if (!gaim_account_is_connected(chat->account)) + return; group = gaim_chat_get_group(chat); add_node((GaimBlistNode*)group, ggblist); @@ -274,7 +318,9 @@ gnt_append_menu_action(GntTree *tree, GaimMenuAction *action, gpointer parent) { GList *list; - + if (action == NULL) + return; + gnt_tree_add_row_after(tree, action, gnt_tree_create_row(tree, action->label), parent, NULL); for (list = action->children; list; list = list->next) @@ -351,7 +397,7 @@ add_custom_action(tree, _("View Log"), GAIM_CALLBACK(gg_blist_view_log_cb)), buddy); #endif - + /* Protocol actions */ append_proto_menu(tree, gaim_account_get_connection(gaim_buddy_get_account(buddy)), @@ -380,15 +426,54 @@ { void (*callback)(GaimBlistNode *, gpointer); callback = (void (*)(GaimBlistNode *, gpointer))action->callback; - callback(node, action->data); + if (callback) + callback(node, action->data); + else + return; } remove_context_menu(ggblist); } static void +rename_blist_node(GaimBlistNode *node, const char *newname) +{ + const char *name = newname; + if (name && !*name) + name = NULL; + + if (GAIM_BLIST_NODE_IS_BUDDY(node)) + gaim_blist_alias_buddy((GaimBuddy*)node, name); + else if (GAIM_BLIST_NODE_IS_CHAT(node)) + gaim_blist_alias_chat((GaimChat*)node, name); + else if (GAIM_BLIST_NODE_IS_GROUP(node)) + gaim_blist_rename_group((GaimGroup*)node, name); + else + g_return_if_reached(); +} + +static void gg_blist_rename_node_cb(GaimBlistNode *node, GaimBlistNode *null) { + const char *name = NULL; + char *prompt; + + if (GAIM_BLIST_NODE_IS_BUDDY(node)) + name = gaim_buddy_get_contact_alias((GaimBuddy*)node); + else if (GAIM_BLIST_NODE_IS_CHAT(node)) + name = gaim_chat_get_name((GaimChat*)node); + else if (GAIM_BLIST_NODE_IS_GROUP(node)) + name = ((GaimGroup*)node)->name; + else + g_return_if_reached(); + + prompt = g_strdup_printf(_("Please enter the new name for %s"), name); + + gaim_request_input(node, _("Rename"), prompt, _("Enter empty string to reset the name."), + name, FALSE, FALSE, NULL, _("Rename"), G_CALLBACK(rename_blist_node), + _("Cancel"), NULL, node); + + g_free(prompt); } /* XXX: This still doesn't do anything, because request doesn't have a ui yet */ @@ -472,7 +557,8 @@ window = gnt_vbox_new(FALSE); gnt_box_set_toplevel(GNT_BOX(window), TRUE); gnt_box_set_title(GNT_BOX(window), title); - + + gnt_widget_set_size(context, 0, g_list_length(GNT_TREE(context)->list)); gnt_box_add_widget(GNT_BOX(window), context); /* Set the position for the popup */ @@ -593,6 +679,7 @@ gnt_widget_set_position(box, x, y); GNT_WIDGET_UNSET_FLAGS(box, GNT_WIDGET_CAN_TAKE_FOCUS); + GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_TRANSIENT); gnt_widget_draw(box); g_free(title); @@ -626,7 +713,7 @@ ret = gnt_widget_key_pressed(ggblist->context, text); stop = TRUE; } - + if (text[0] == 27) { if (strcmp(text + 1, GNT_KEY_POPUP) == 0) @@ -677,13 +764,243 @@ remove_context_menu(ggblist); } +static void +size_changed_cb(GntWidget *w, int width, int height) +{ + gaim_prefs_set_int(PREF_ROOT "/size/width", width); + gaim_prefs_set_int(PREF_ROOT "/size/height", height); +} + +static void +save_position_cb(GntWidget *w, int x, int y) +{ + gaim_prefs_set_int(PREF_ROOT "/position/x", x); + gaim_prefs_set_int(PREF_ROOT "/position/y", y); +} + +static void +reset_blist_window(GntWidget *window, gpointer null) +{ + GaimBlistNode *node; + gaim_signals_disconnect_by_handle(gg_blist_get_handle()); + gaim_get_blist()->ui_data = NULL; + + node = gaim_blist_get_root(); + while (node) + { + node->ui_data = NULL; + node = gaim_blist_node_next(node, TRUE); + } + + remove_typing_cb(NULL); + remove_peripherals(ggblist); + g_free(ggblist); + ggblist = NULL; +} + +static void +populate_buddylist() +{ + GaimBlistNode *node; + GaimBuddyList *list; + + list = gaim_get_blist(); + node = gaim_blist_get_root(); + while (node) + { + node_update(list, node); + node = gaim_blist_node_next(node, FALSE); + } +} + +static void +destroy_status_list(GList *list) +{ + g_list_foreach(list, (GFunc)g_free, NULL); + g_list_free(list); +} + +static void +populate_status_dropdown() +{ + int i; + GList *iter; + GList *items = NULL; + + /* First the primitives */ + GaimStatusPrimitive prims[] = {GAIM_STATUS_AVAILABLE, GAIM_STATUS_AWAY, + GAIM_STATUS_INVISIBLE, GAIM_STATUS_OFFLINE, GAIM_STATUS_UNSET}; + + for (i = 0; prims[i] != GAIM_STATUS_UNSET; i++) + { + StatusBoxItem *item = g_new0(StatusBoxItem, 1); + item->type = STATUS_PRIMITIVE; + item->u.prim = prims[i]; + items = g_list_prepend(items, item); + gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, + gaim_primitive_get_name_from_type(prims[i])); + } + + /* Now the popular statuses */ + for (iter = gaim_savedstatuses_get_popular(6); iter; iter = iter->next) + { + StatusBoxItem *item = g_new0(StatusBoxItem, 1); + item->type = STATUS_SAVED; + item->u.saved = iter->data; + items = g_list_prepend(items, item); + gnt_combo_box_add_data(GNT_COMBO_BOX(ggblist->status), item, + gaim_savedstatus_get_title(iter->data)); + } + + /* The keys for the combobox are created here, and never used + * anywhere else. So make sure the keys are freed when the widget + * is destroyed. */ + g_object_set_data_full(G_OBJECT(ggblist->status), "list of statuses", items, (GDestroyNotify)destroy_status_list); +} + void gg_blist_init() { + gaim_prefs_add_none(PREF_ROOT); + gaim_prefs_add_none(PREF_ROOT "/size"); + gaim_prefs_add_int(PREF_ROOT "/size/width", 20); + gaim_prefs_add_int(PREF_ROOT "/size/height", 20); + gaim_prefs_add_none(PREF_ROOT "/position"); + gaim_prefs_add_int(PREF_ROOT "/position/x", 0); + gaim_prefs_add_int(PREF_ROOT "/position/y", 0); + + gg_blist_show(); + + return; +} + +static gboolean +remove_typing_cb(gpointer null) +{ + GaimSavedStatus *current; + const char *message, *newmessage; + GaimStatusPrimitive prim, newprim; + StatusBoxItem *item; + + current = gaim_savedstatus_get_current(); + message = gaim_savedstatus_get_message(current); + prim = gaim_savedstatus_get_type(current); + + newmessage = gnt_entry_get_text(GNT_ENTRY(ggblist->statustext)); + item = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(ggblist->status)); + g_return_val_if_fail(item->type == STATUS_PRIMITIVE, FALSE); + newprim = item->u.prim; + + if (newprim != prim || ((message && !newmessage) || + (!message && newmessage) || + (message && newmessage && g_utf8_collate(message, newmessage) != 0))) + { + GaimSavedStatus *status = gaim_savedstatus_find_transient_by_type_and_message(newprim, newmessage); + /* Holy Crap! That's a LAWNG function name */ + if (status == NULL) + { + status = gaim_savedstatus_new(NULL, newprim); + gaim_savedstatus_set_message(status, newmessage); + } + + gaim_savedstatus_activate(status); + } + + gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree); + if (ggblist->typing) + g_source_remove(ggblist->typing); + ggblist->typing = 0; + return FALSE; +} + +static void +status_selection_changed(GntComboBox *box, StatusBoxItem *old, StatusBoxItem *now, gpointer null) +{ + gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), NULL); + if (now->type == STATUS_SAVED) + { + /* Set the status immediately */ + gaim_savedstatus_activate(now->u.saved); + } + 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); + } + else + g_return_if_reached(); +} + +static gboolean +status_text_changed(GntEntry *entry, const char *text, gpointer null) +{ + if ((text[0] == 27 || (text[0] == '\t' && text[1] == '\0')) && ggblist->typing == 0) + return FALSE; + + if (ggblist->typing) + g_source_remove(ggblist->typing); + ggblist->typing = 0; + + if (text[0] == '\r' && text[1] == 0) + { + /* Set the status only after you press 'Enter' */ + remove_typing_cb(NULL); + return TRUE; + } + + ggblist->typing = g_timeout_add(TYPING_TIMEOUT, (GSourceFunc)remove_typing_cb, NULL); + return FALSE; +} + +static void +savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old) +{ + /* Block the signals we don't want to emit */ + GList *list; + GaimStatusPrimitive prim; + const char *message; + + if (!ggblist) + return; + + g_signal_handlers_block_matched(ggblist->status, G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, status_selection_changed, NULL); + g_signal_handlers_block_matched(ggblist->statustext, G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, status_text_changed, NULL); + + prim = gaim_savedstatus_get_type(now); + message = gaim_savedstatus_get_message(now); + + list = g_object_get_data(G_OBJECT(ggblist->status), "list of statuses"); + for (; list; list = list->next) + { + StatusBoxItem *item = list->data; + if (item->type == STATUS_PRIMITIVE && item->u.prim == prim) + { + gnt_combo_box_set_selected(GNT_COMBO_BOX(ggblist->status), item); + gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), message); + gnt_widget_draw(ggblist->status); + break; + } + } + + g_signal_handlers_unblock_matched(ggblist->status, G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, status_selection_changed, NULL); + g_signal_handlers_unblock_matched(ggblist->statustext, G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, status_text_changed, NULL); +} + +void gg_blist_show() +{ + if (ggblist) + return; + ggblist = g_new0(GGBlist, 1); gaim_get_blist()->ui_data = ggblist; - ggblist->window = gnt_box_new(FALSE, FALSE); + ggblist->window = gnt_vbox_new(FALSE); gnt_widget_set_name(ggblist->window, "buddylist"); gnt_box_set_toplevel(GNT_BOX(ggblist->window), TRUE); gnt_box_set_title(GNT_BOX(ggblist->window), _("Buddy List")); @@ -692,16 +1009,29 @@ 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, 0, getmaxy(stdscr) - 4); + 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_box_add_widget(GNT_BOX(ggblist->window), ggblist->tree); + + gnt_box_add_widget(GNT_BOX(ggblist->window), gnt_hline_new()); + + ggblist->status = gnt_combo_box_new(); + gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->status); + ggblist->statustext = gnt_entry_new(NULL); + gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->statustext); + + populate_status_dropdown(); + gnt_widget_show(ggblist->window); gaim_signal_connect(gaim_blist_get_handle(), "buddy-status-changed", gg_blist_get_handle(), GAIM_CALLBACK(buddy_status_changed), ggblist); gaim_signal_connect(gaim_blist_get_handle(), "buddy-idle-changed", gg_blist_get_handle(), GAIM_CALLBACK(buddy_idle_changed), ggblist); - + #if 0 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", gg_blist_get_handle(), GAIM_CALLBACK(buddy_signed_on), ggblist); @@ -725,10 +1055,28 @@ ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); g_signal_connect_data(G_OBJECT(ggblist->tree), "lost-focus", G_CALLBACK(remove_peripherals), ggblist, 0, G_CONNECT_AFTER | G_CONNECT_SWAPPED); + g_signal_connect(G_OBJECT(ggblist->tree), "size_changed", G_CALLBACK(size_changed_cb), NULL); + g_signal_connect(G_OBJECT(ggblist->window), "position_set", G_CALLBACK(save_position_cb), NULL); + g_signal_connect(G_OBJECT(ggblist->window), "destroy", G_CALLBACK(reset_blist_window), NULL); + + /* Status signals */ + gaim_signal_connect(gaim_savedstatuses_get_handle(), "savedstatus-changed", gg_blist_get_handle(), + GAIM_CALLBACK(savedstatus_changed), NULL); + g_signal_connect(G_OBJECT(ggblist->status), "selection_changed", + G_CALLBACK(status_selection_changed), NULL); + g_signal_connect(G_OBJECT(ggblist->statustext), "key_pressed", + G_CALLBACK(status_text_changed), NULL); + + populate_buddylist(); + + savedstatus_changed(gaim_savedstatus_get_current(), NULL); } void gg_blist_uninit() { + if (ggblist == NULL) + return; + gnt_widget_destroy(ggblist->window); g_free(ggblist); ggblist = NULL; Modified: branches/soc-2006-file-loggers/console/gntblist.h =================================================================== --- branches/soc-2006-file-loggers/console/gntblist.h 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/console/gntblist.h 2006-08-09 04:49:19 UTC (rev 16677) @@ -6,6 +6,8 @@ void gg_blist_uninit(); +void gg_blist_show(); + void gg_blist_get_position(int *x, int *y); void gg_blist_set_position(int x, int y); Modified: branches/soc-2006-file-loggers/console/gntconv.c =================================================================== --- branches/soc-2006-file-loggers/console/gntconv.c 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/console/gntconv.c 2006-08-09 04:49:19 UTC (rev 16677) @@ -1,17 +1,24 @@ #include <string.h> #include <cmds.h> +#include <prefs.h> #include <util.h> #include "gntgaim.h" +#include "gntaccount.h" #include "gntblist.h" #include "gntconv.h" +#include "gntdebug.h" +#include "gntplugin.h" +#include "gntprefs.h" #include "gnt.h" #include "gntbox.h" #include "gntentry.h" #include "gnttextview.h" +#define PREF_ROOT "/gaim/gnt/conversations" + GHashTable *ggconvs; typedef struct _GGConv GGConv; @@ -101,17 +108,20 @@ } else { + char *escape = g_markup_escape_text(text, -1); switch (gaim_conversation_get_type(ggconv->conv)) { case GAIM_CONV_TYPE_IM: - gaim_conv_im_send_with_flags(GAIM_CONV_IM(ggconv->conv), text, GAIM_MESSAGE_SEND); + gaim_conv_im_send_with_flags(GAIM_CONV_IM(ggconv->conv), escape, GAIM_MESSAGE_SEND); break; case GAIM_CONV_TYPE_CHAT: - gaim_conv_chat_send(GAIM_CONV_CHAT(ggconv->conv), text); + gaim_conv_chat_send(GAIM_CONV_CHAT(ggconv->conv), escape); break; default: + g_free(escape); g_return_val_if_reached(FALSE); } + g_free(escape); } gnt_entry_clear(GNT_ENTRY(ggconv->entry)); return TRUE; @@ -142,19 +152,29 @@ } static void +size_changed_cb(GntWidget *w, int width, int height) +{ + gaim_prefs_set_int(PREF_ROOT "/size/width", width); + gaim_prefs_set_int(PREF_ROOT "/size/height", height); +} + +static void +save_position_cb(GntWidget *w, int x, int y) +{ + gaim_prefs_set_int(PREF_ROOT "/position/x", x); + gaim_prefs_set_int(PREF_ROOT "/position/y", y); +} + +static void gg_create_conversation(GaimConversation *conv) { GGConv *ggc = g_hash_table_lookup(ggconvs, conv); char *title; GaimConversationType type; - int x, width; if (ggc) return; - gg_blist_get_position(&x, NULL); - gg_blist_get_size(&width, NULL); - ggc = g_new0(GGConv, 1); g_hash_table_insert(ggconvs, conv, ggc); @@ -172,7 +192,8 @@ ggc->tv = gnt_text_view_new(); gnt_box_add_widget(GNT_BOX(ggc->window), ggc->tv); gnt_widget_set_name(ggc->tv, "conversation-window-textview"); - gnt_widget_set_size(ggc->tv, getmaxx(stdscr) - 3 - x - width, getmaxy(stdscr) - 5); + gnt_widget_set_size(ggc->tv, gaim_prefs_get_int(PREF_ROOT "/size/width"), + gaim_prefs_get_int(PREF_ROOT "/size/height")); ggc->entry = gnt_entry_new(NULL); gnt_box_add_widget(GNT_BOX(ggc->window), ggc->entry); @@ -181,12 +202,13 @@ g_signal_connect(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); - /* XXX: I am assuming the buddylist is on the leftmost corner. - * That may not always be correct, since the windows can be moved. - * It might be an option to remember the position of conv. windows. */ - gnt_widget_set_position(ggc->window, x + width, 0); + gnt_widget_set_position(ggc->window, gaim_prefs_get_int(PREF_ROOT "/position/x"), + gaim_prefs_get_int(PREF_ROOT "/position/y")); gnt_widget_show(ggc->window); + g_signal_connect(G_OBJECT(ggc->tv), "size_changed", G_CALLBACK(size_changed_cb), NULL); + g_signal_connect(G_OBJECT(ggc->window), "position_set", G_CALLBACK(save_position_cb), NULL); + g_free(title); } @@ -201,8 +223,9 @@ GaimMessageFlags flags, time_t mtime) { GGConv *ggconv = g_hash_table_lookup(ggconvs, conv); /* XXX: ggconv = conv->ui_data; should do */ - char *strip; + char *strip, *newline; GntTextFormatFlags fl = 0; + int pos; g_return_if_fail(ggconv != NULL); @@ -221,12 +244,18 @@ if (flags & GAIM_MESSAGE_NICK) fl |= GNT_TEXT_FLAG_UNDERLINE; - strip = gaim_markup_strip_html(message); + pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); + + /* XXX: Remove this workaround when textview can parse messages. */ + newline = gaim_strdup_withhtml(message); + strip = gaim_markup_strip_html(newline); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), strip, fl); gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); - gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); + if (pos <= 1) + gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); + g_free(newline); g_free(strip); if (flags & (GAIM_MESSAGE_RECV | GAIM_MESSAGE_NICK | GAIM_MESSAGE_ERROR)) @@ -460,12 +489,27 @@ return GAIM_CMD_STATUS_OK; } +static GaimCmdRet +cmd_show_window(GaimConversation *conv, const char *cmd, char **args, char **error, gpointer data) +{ + void (*callback)() = data; + callback(); + return GAIM_CMD_STATUS_OK; +} void gg_conversation_init() { ggconvs = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, destroy_ggconv); - /* Xerox */ + gaim_prefs_add_none(PREF_ROOT); + gaim_prefs_add_none(PREF_ROOT "/size"); + gaim_prefs_add_int(PREF_ROOT "/size/width", 70); + gaim_prefs_add_int(PREF_ROOT "/size/height", 20); + gaim_prefs_add_none(PREF_ROOT "/position"); + gaim_prefs_add_int(PREF_ROOT "/position/x", 0); + gaim_prefs_add_int(PREF_ROOT "/position/y", 0); + + /* Xerox the commands */ gaim_cmd_register("say", "S", GAIM_CMD_P_DEFAULT, GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, say_command_cb, _("say <message>: Send a message normally as if you weren't using a command."), NULL); @@ -481,6 +525,23 @@ gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, help_command_cb, _("help <command>: Help on a specific command."), NULL); + + /* Now some commands to bring up some other windows */ + gaim_cmd_register("plugins", "", GAIM_CMD_P_DEFAULT, + GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, + cmd_show_window, _("plugins: Show the plugins window."), gg_plugins_show_all); + gaim_cmd_register("buddylist", "", GAIM_CMD_P_DEFAULT, + GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, + cmd_show_window, _("buddylist: Show the buddylist."), gg_blist_show); + gaim_cmd_register("accounts", "", GAIM_CMD_P_DEFAULT, + GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, + cmd_show_window, _("accounts: Show the accounts window."), gg_accounts_show_all); + 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() Modified: branches/soc-2006-file-loggers/console/gntdebug.c =================================================================== --- branches/soc-2006-file-loggers/console/gntdebug.c 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/console/gntdebug.c 2006-08-09 04:49:19 UTC (rev 16677) @@ -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) @@ -39,9 +38,7 @@ gg_debug_print(GaimDebugLevel level, const char *category, const char *args) { - if (debug.window == NULL) - fprintf(stderr, "%s: %s\n", category, args); - else + if (debug.window) { GntTextFormatFlags flag = GNT_TEXT_FLAG_NORMAL; @@ -63,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); } } @@ -97,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); @@ -105,7 +102,8 @@ void gg_debug_init() { - gg_debug_window_show(); + if (gaim_debug_is_enabled()) + gg_debug_window_show(); } void gg_debug_uninit() Modified: branches/soc-2006-file-loggers/console/gntdebug.h =================================================================== --- branches/soc-2006-file-loggers/console/gntdebug.h 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/console/gntdebug.h 2006-08-09 04:49:19 UTC (rev 16677) @@ -6,3 +6,4 @@ void gg_debug_uninit(); +void gg_debug_window_show(); Modified: branches/soc-2006-file-loggers/console/gntgaim.c =================================================================== --- branches/soc-2006-file-loggers/console/gntgaim.c 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/console/gntgaim.c 2006-08-09 04:49:19 UTC (rev 16677) @@ -140,9 +140,9 @@ char *text; if (terse) { - text = g_strdup_printf(_("Gaim %s. Try `%s -h' for more information.\n"), VERSION, name); + text = g_strdup_printf(_("%s. Try `%s -h' for more information.\n"), VERSION, name); } else { - text = g_strdup_printf(_("Gaim %s\n" + text = g_strdup_printf(_("%s\n" "Usage: %s [OPTION]...\n\n" " -c, --config=DIR use DIR for config files\n" " -d, --debug print debugging messages to stdout\n" @@ -151,6 +151,7 @@ " -v, --version display the current version and exit\n"), VERSION, name); } + gnt_quit(); gaim_print_utf8_to_console(stdout, text); g_free(text); } Copied: branches/soc-2006-file-loggers/console/gntplugin.c (from rev 16676, trunk/console/gntplugin.c) =================================================================== --- branches/soc-2006-file-loggers/console/gntplugin.c (rev 0) +++ branches/soc-2006-file-loggers/console/gntplugin.c 2006-08-09 04:49:19 UTC (rev 16677) @@ -0,0 +1,135 @@ +#include <gnt.h> +#include <gntbox.h> +#include <gntlabel.h> +#include <gntline.h> +#include <gnttree.h> + +#include "notify.h" + +#include "gntgaim.h" +#include "gntplugin.h" + +static struct +{ + GntWidget *tree; + GntWidget *window; + GntWidget *aboot; +} plugins; + +static void +plugin_toggled_cb(GntWidget *tree, GaimPlugin *plugin, gpointer null) +{ + if (gnt_tree_get_choice(GNT_TREE(tree), plugin)) + { + if(!gaim_plugin_load(plugin)) + gaim_notify_error(NULL, "ERROR", "loading plugin failed", NULL); + } + else + { + if (!gaim_plugin_unload(plugin)) + gaim_notify_error(NULL, "ERROR", "unloading plugin failed", NULL); + } + gg_plugins_save_loaded(); +} + +/* Xerox */ +void +gg_plugins_save_loaded(void) +{ + GList *pl; + GList *files = NULL; + GaimPlugin *p; + + for (pl = gaim_plugins_get_loaded(); pl != NULL; pl = pl->next) { + p = pl->data; + + if (p->info->type != GAIM_PLUGIN_PROTOCOL && + p->info->type != GAIM_PLUGIN_LOADER) { + + files = g_list_append(files, p->path); + } + } + + gaim_prefs_set_string_list("/gaim/gnt/plugins/loaded", files); + g_list_free(files); +} + +static void +selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) +{ + GaimPlugin *plugin = current; + char *text; + + /* XXX: Use formatting and stuff */ + gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot)); + text = g_strdup_printf(_("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n"), + plugin->info->name, plugin->info->version, plugin->info->description, + plugin->info->author, plugin->info->homepage, plugin->path); + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(plugins.aboot), + text, GNT_TEXT_FLAG_NORMAL); + gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0); +} + +static void +reset_plugin_window(GntWidget *window, gpointer null) +{ + plugins.window = NULL; + plugins.tree = NULL; + plugins.aboot = NULL; +} + +void gg_plugins_show_all() +{ + GntWidget *window, *tree, *box, *aboot; + GList *iter; + if (plugins.window) + return; + + gaim_plugins_probe(G_MODULE_SUFFIX); + + plugins.window = window = gnt_vbox_new(FALSE); + gnt_box_set_toplevel(GNT_BOX(window), TRUE); + gnt_box_set_title(GNT_BOX(window), _("Plugins")); + gnt_box_set_pad(GNT_BOX(window), 0); + + gnt_box_add_widget(GNT_BOX(window), + gnt_label_new(_("You can (un)load plugins from the following list."))); + gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); + + box = gnt_hbox_new(FALSE); + gnt_box_add_widget(GNT_BOX(window), box); + gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); + + gnt_box_set_pad(GNT_BOX(box), 0); + plugins.tree = tree = gnt_tree_new(); + GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); + gnt_box_add_widget(GNT_BOX(box), tree); + gnt_box_add_widget(GNT_BOX(box), gnt_vline_new()); + + plugins.aboot = aboot = gnt_text_view_new(); + gnt_widget_set_size(aboot, 40, 20); + gnt_box_add_widget(GNT_BOX(box), aboot); + + for (iter = gaim_plugins_get_all(); iter; iter = iter->next) + { + GaimPlugin *plug = iter->data; + + if (plug->info->type != GAIM_PLUGIN_STANDARD || + (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE) || + plug->error) + continue; + + gnt_tree_add_choice(GNT_TREE(tree), plug, + gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL); + gnt_tree_set_choice(GNT_TREE(tree), plug, gaim_plugin_is_loaded(plug)); + } + gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); + g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL); + 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); +} + Copied: branches/soc-2006-file-loggers/console/gntplugin.h (from rev 16676, trunk/console/gntplugin.h) =================================================================== --- branches/soc-2006-file-loggers/console/gntplugin.h (rev 0) +++ branches/soc-2006-file-loggers/console/gntplugin.h 2006-08-09 04:49:19 UTC (rev 16677) @@ -0,0 +1,6 @@ +#include <plugin.h> + +void gg_plugins_show_all(); + +void gg_plugins_save_loaded(); + Modified: branches/soc-2006-file-loggers/console/gntprefs.c =================================================================== --- branches/soc-2006-file-loggers/console/gntprefs.c 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/console/gntprefs.c 2006-08-09 04:49:19 UTC (rev 16677) @@ -1,8 +1,11 @@ #include <prefs.h> +#include "gntgaim.h" #include "gntprefs.h" -#include "gntgaim.h" +#include "gntrequest.h" +#include <string.h> + void gg_prefs_init() { gaim_prefs_add_none("/gaim"); @@ -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); +} + Modified: branches/soc-2006-file-loggers/console/gntprefs.h =================================================================== --- branches/soc-2006-file-loggers/console/gntprefs.h 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/console/gntprefs.h 2006-08-09 04:49:19 UTC (rev 16677) @@ -1,2 +1,4 @@ void gg_prefs_init(); +void gg_prefs_show_all(); + Modified: branches/soc-2006-file-loggers/console/gntrequest.c =================================================================== --- branches/soc-2006-file-loggers/console/gntrequest.c 2006-08-09 04:22:08 UTC (rev 16676) +++ branches/soc-2006-file-loggers/console/gntrequest.c 2006-08-09 04:49:19 UTC (rev 16677) @@ -1,15 +1,19 @@ #include <gnt.h> #include <gntbox.h> #include <gntbutton.h> +#include <gntcheckbox.h> #include <gntcombobox.h> #include <gntentry.h> #include <gntlabel.h> +#include <gntline.h> +#include <gnttree.h> +#include "gntgaim.h" #include "gntrequest.h" static GntWidget * setup_request_window(const char *title, const char *primary, - const char *secondary) + const char *secondary, GaimRequestType type) { GntWidget *window; @@ -24,6 +28,9 @@ if (secondary) gnt_box_add_widget(GNT_BOX(window), gnt_label_new(secondary)); + g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(gaim_request_close), + GINT_TO_POINTER(type)); + return window; } @@ -35,7 +42,7 @@ const char *text; gpointer callback; - box = gnt_hbox_new(TRUE); + box = gnt_hbox_new(FALSE); va_start(list, data); @@ -79,7 +86,7 @@ { GntWidget *window, *box, *entry; - window = setup_request_window(title, primary, secondary); + window = setup_request_window(title, primary, secondary, GAIM_REQUES... [truncated message content] |