Mercurial > pidgin
changeset 8697:725413cc9fb9
[gaim-migrate @ 9450]
WYSIWYG info editing from Jon Oberheide
We need separate gc flags for conversation HTML and
user info HTML, or something. It seems like there
should be a better way to do that...
Hint hint wink wink nudge nudge
I kick your foot, under the table
You kick me back, I can't say I'm able
To stand for you, or fall for you
Ever again
I wish for, a perfect setting
Wishing that I'm letting you take me
Where you want me, all over again
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 18 Apr 2004 06:22:42 +0000 |
parents | aebfa2b6af6b |
children | f36eee61c85f |
files | COPYRIGHT ChangeLog src/account.c src/connection.c src/dialogs.c src/gtkblist.c src/gtkprivacy.c src/gtkrequest.c src/protocols/jabber/chat.c src/protocols/msn/msn.c src/protocols/oscar/oscar.c src/protocols/yahoo/yahoo.c src/request.c src/request.h |
diffstat | 14 files changed, 104 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/COPYRIGHT Sun Apr 18 05:47:16 2004 +0000 +++ b/COPYRIGHT Sun Apr 18 06:22:42 2004 +0000 @@ -87,6 +87,7 @@ Andrew Molloy Padraig O'Briain Christopher (siege) O'Brien +Jon Oberheide Nathan (pianocomp81) Owens Matt Pandina Ricardo Fernandez Pascual
--- a/ChangeLog Sun Apr 18 05:47:16 2004 +0000 +++ b/ChangeLog Sun Apr 18 06:22:42 2004 +0000 @@ -9,6 +9,7 @@ the outdated -f option that no longer had any effect (Daniel Atallah) * Novell GroupWise protocol support added (Novell) * WYSIWYG improvements (Tim Ringenbach) + * WYSIWYG editing for user info (Jon Oberheide) * Rich-text copy and paste Bug Fixes:
--- a/src/account.c Sun Apr 18 05:47:16 2004 +0000 +++ b/src/account.c Sun Apr 18 06:22:42 2004 +0000 @@ -362,11 +362,14 @@ void gaim_account_request_change_user_info(GaimAccount *account) { + GaimConnection *gc; char primary[256]; g_return_if_fail(account != NULL); g_return_if_fail(gaim_account_is_connected(account)); + gc = gaim_account_get_connection(account); + g_snprintf(primary, sizeof(primary), _("Change user information for %s"), gaim_account_get_username(account)); @@ -374,7 +377,8 @@ gaim_request_input(gaim_account_get_connection(account), NULL, primary, NULL, gaim_account_get_user_info(account), - TRUE, FALSE, + TRUE, FALSE, ((gc != NULL) && + (gc->flags & GAIM_CONNECTION_HTML) ? "html" : NULL), _("Save"), G_CALLBACK(set_user_info_cb), _("Cancel"), NULL, account); }
--- a/src/connection.c Sun Apr 18 05:47:16 2004 +0000 +++ b/src/connection.c Sun Apr 18 06:22:42 2004 +0000 @@ -194,7 +194,7 @@ gaim_connection_destroy(gc); escaped = g_markup_escape_text(username, strlen(username)); primary = g_strdup_printf(_("Enter password for %s"), escaped); - gaim_request_input(gc, NULL, primary, NULL, NULL, FALSE, TRUE, + gaim_request_input(gc, NULL, primary, NULL, NULL, FALSE, TRUE, NULL, _("OK"), G_CALLBACK(request_pass_ok_cb), _("Cancel"), NULL, account); g_free(primary);
--- a/src/dialogs.c Sun Apr 18 05:47:16 2004 +0000 +++ b/src/dialogs.c Sun Apr 18 06:22:42 2004 +0000 @@ -867,7 +867,7 @@ { gaim_request_input(NULL, _("Alias Chat"), NULL, _("Enter an alias for this chat."), - chat->alias, FALSE, FALSE, + chat->alias, FALSE, FALSE, NULL, _("Alias"), G_CALLBACK(alias_chat_cb), _("Cancel"), NULL, chat); } @@ -884,7 +884,7 @@ { gaim_request_input(NULL, _("Alias Contact"), NULL, _("Enter an alias for this contact."), - contact->alias, FALSE, FALSE, + contact->alias, FALSE, FALSE, NULL, _("Alias"), G_CALLBACK(alias_contact_cb), _("Cancel"), NULL, contact); } @@ -903,7 +903,7 @@ char *secondary = g_strdup_printf(_("Enter an alias for %s."), b->name); gaim_request_input(NULL, _("Alias Buddy"), NULL, - secondary, b->alias, FALSE, FALSE, + secondary, b->alias, FALSE, FALSE, NULL, _("Alias"), G_CALLBACK(alias_buddy_cb), _("Cancel"), NULL, b);
--- a/src/gtkblist.c Sun Apr 18 05:47:16 2004 +0000 +++ b/src/gtkblist.c Sun Apr 18 06:22:42 2004 +0000 @@ -2313,7 +2313,7 @@ { gaim_request_input(NULL, _("Rename Group"), _("New group name"), _("Please enter a new name for the selected group."), - g->name, FALSE, FALSE, + g->name, FALSE, FALSE, NULL, _("OK"), G_CALLBACK(rename_group_cb), _("Cancel"), NULL, g); } @@ -4298,7 +4298,7 @@ { gaim_request_input(NULL, _("Add Group"), NULL, _("Please enter the name of the group to be added."), - NULL, FALSE, FALSE, + NULL, FALSE, FALSE, NULL, _("Add"), G_CALLBACK(add_group_cb), _("Cancel"), NULL, NULL); }
--- a/src/gtkprivacy.c Sun Apr 18 05:47:16 2004 +0000 +++ b/src/gtkprivacy.c Sun Apr 18 06:22:42 2004 +0000 @@ -570,7 +570,7 @@ _("Type a user you permit to contact you."), _("Please enter the name of the user you wish to be " "able to contact you."), - NULL, FALSE, FALSE, + NULL, FALSE, FALSE, NULL, _("Permit"), G_CALLBACK(add_permit_block_cb), _("Cancel"), G_CALLBACK(destroy_request_data), data); @@ -608,7 +608,7 @@ gaim_request_input(account, _("Block User"), _("Type a user to block."), _("Please enter the name of the user you wish to block."), - NULL, FALSE, FALSE, + NULL, FALSE, FALSE, NULL, _("Block"), G_CALLBACK(add_permit_block_cb), _("Cancel"), G_CALLBACK(destroy_request_data), data);
--- a/src/gtkrequest.c Sun Apr 18 05:47:16 2004 +0000 +++ b/src/gtkrequest.c Sun Apr 18 06:22:42 2004 +0000 @@ -30,6 +30,8 @@ #include "gtkutils.h" #include "stock.h" #include "ui.h" +#include "gtkimhtml.h" +#include "gtkimhtmltoolbar.h" #include <gdk/gdkkeysyms.h> @@ -56,6 +58,7 @@ GtkWidget *entry; gboolean multiline; + gchar *hint; } input; @@ -93,8 +96,12 @@ gtk_text_buffer_get_start_iter(buffer, &start_iter); gtk_text_buffer_get_end_iter(buffer, &end_iter); - multiline_value = gtk_text_buffer_get_text(buffer, &start_iter, &end_iter, + if ((data->u.input.hint != NULL) && (!strcmp(data->u.input.hint, "html"))) + multiline_value = gtk_imhtml_get_markup(GTK_IMHTML(data->u.input.entry)); + else + multiline_value = gtk_text_buffer_get_text(buffer, &start_iter, &end_iter, FALSE); + value = multiline_value; } else @@ -241,7 +248,7 @@ static void * gaim_gtk_request_input(const char *title, const char *primary, const char *secondary, const char *default_value, - gboolean multiline, gboolean masked, + gboolean multiline, gboolean masked, gchar *hint, const char *ok_text, GCallback ok_cb, const char *cancel_text, GCallback cancel_cb, void *user_data) @@ -317,8 +324,9 @@ /* Entry field. */ data->u.input.multiline = multiline; + data->u.input.hint = (hint == NULL ? NULL : g_strdup(hint)); - if (multiline) { + if ((data->u.input.hint != NULL) && (!strcmp(data->u.input.hint, "html"))) { GtkWidget *sw; sw = gtk_scrolled_window_new(NULL, NULL); @@ -329,36 +337,76 @@ gtk_widget_set_size_request(sw, 320, 130); - gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); + /* Toolbar */ + GtkWidget *toolbar; + toolbar = gtk_imhtmltoolbar_new(); + gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0); + + /* GtkIMHtml */ + entry = gtk_imhtml_new(NULL, NULL); + gtk_imhtml_set_editable(GTK_IMHTML(entry), TRUE); - entry = gtk_text_view_new(); - gtk_text_view_set_editable(GTK_TEXT_VIEW(entry), TRUE); + gtk_imhtml_smiley_shortcuts(GTK_IMHTML(entry), gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")); + gtk_imhtml_html_shortcuts(GTK_IMHTML(entry), gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")); + gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(toolbar), entry); + + if (default_value != NULL) + gtk_imhtml_append_text(GTK_IMHTML(entry), default_value, GTK_IMHTML_NO_SCROLL); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(entry), GTK_WRAP_WORD_CHAR); + gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); + if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(entry)); gtk_container_add(GTK_CONTAINER(sw), entry); - - if (default_value != NULL) { - GtkTextBuffer *buffer; - - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)); - gtk_text_buffer_set_text(buffer, default_value, -1); - } } else { - entry = gtk_entry_new(); + if (multiline) { + GtkWidget *sw; + + sw = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), + GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), + GTK_SHADOW_IN); + + gtk_widget_set_size_request(sw, 320, 130); - gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); + /* GtkTextView */ + entry = gtk_text_view_new(); + gtk_text_view_set_editable(GTK_TEXT_VIEW(entry), TRUE); - gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0); + if (default_value != NULL) { + GtkTextBuffer *buffer; + + buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)); + gtk_text_buffer_set_text(buffer, default_value, -1); + } - if (default_value != NULL) - gtk_entry_set_text(GTK_ENTRY(entry), default_value); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(entry), GTK_WRAP_WORD_CHAR); + + gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); + + if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) + gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(entry)); - if (masked) - gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); + gtk_container_add(GTK_CONTAINER(sw), entry); + } + else { + entry = gtk_entry_new(); + + gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); + + gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0); + + if (default_value != NULL) + gtk_entry_set_text(GTK_ENTRY(entry), default_value); + + if (masked) + gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); + } } gaim_set_accessible_label (entry, label);
--- a/src/protocols/jabber/chat.c Sun Apr 18 05:47:16 2004 +0000 +++ b/src/protocols/jabber/chat.c Sun Apr 18 06:22:42 2004 +0000 @@ -689,7 +689,8 @@ gaim_request_input(gc, _("Enter a Conference Server"), _("Enter a Conference Server"), _("Select a conference server to query"), js->chat_servers ? js->chat_servers->data : "conference.jabber.org", - FALSE, FALSE, _("Find Rooms"), G_CALLBACK(roomlist_ok_cb), _("Cancel"), NULL, js); + FALSE, FALSE, NULL, + _("Find Rooms"), G_CALLBACK(roomlist_ok_cb), _("Cancel"), NULL, js); return js->roomlist; }
--- a/src/protocols/msn/msn.c Sun Apr 18 05:47:16 2004 +0000 +++ b/src/protocols/msn/msn.c Sun Apr 18 06:22:42 2004 +0000 @@ -190,7 +190,7 @@ gaim_request_input(gc, NULL, _("Set your friendly name."), _("This is the name that other MSN buddies will " "see you as."), - gaim_connection_get_display_name(gc), FALSE, FALSE, + gaim_connection_get_display_name(gc), FALSE, FALSE, NULL, _("OK"), G_CALLBACK(msn_act_id), _("Cancel"), NULL, gc); } @@ -201,7 +201,7 @@ MsnSession *session = gc->proto_data; gaim_request_input(gc, NULL, _("Set your home phone number."), NULL, - msn_user_get_home_phone(session->user), FALSE, FALSE, + msn_user_get_home_phone(session->user), FALSE, FALSE, NULL, _("OK"), G_CALLBACK(msn_set_home_phone_cb), _("Cancel"), NULL, gc); } @@ -212,7 +212,7 @@ MsnSession *session = gc->proto_data; gaim_request_input(gc, NULL, _("Set your work phone number."), NULL, - msn_user_get_work_phone(session->user), FALSE, FALSE, + msn_user_get_work_phone(session->user), FALSE, FALSE, NULL, _("OK"), G_CALLBACK(msn_set_work_phone_cb), _("Cancel"), NULL, gc); } @@ -223,7 +223,7 @@ MsnSession *session = gc->proto_data; gaim_request_input(gc, NULL, _("Set your mobile phone number."), NULL, - msn_user_get_mobile_phone(session->user), FALSE, FALSE, + msn_user_get_mobile_phone(session->user), FALSE, FALSE, NULL, _("OK"), G_CALLBACK(msn_set_mobile_phone_cb), _("Cancel"), NULL, gc); } @@ -255,7 +255,7 @@ data->passport = passport; gaim_request_input(gc, NULL, _("Send a mobile message."), NULL, - NULL, TRUE, FALSE, + NULL, TRUE, FALSE, NULL, _("Page"), G_CALLBACK(send_to_mobile_cb), _("Close"), G_CALLBACK(close_mobile_page_cb), data);
--- a/src/protocols/oscar/oscar.c Sun Apr 18 05:47:16 2004 +0000 +++ b/src/protocols/oscar/oscar.c Sun Apr 18 06:22:42 2004 +0000 @@ -2558,7 +2558,7 @@ static void gaim_auth_request_msgprompt(struct name_data *data) { gaim_request_input(data->gc, NULL, _("Authorization Request Message:"), - NULL, _("Please authorize me!"), TRUE, FALSE, + NULL, _("Please authorize me!"), TRUE, FALSE, NULL, _("OK"), G_CALLBACK(gaim_auth_request), _("Cancel"), G_CALLBACK(oscar_free_name_data), data); @@ -2639,7 +2639,7 @@ static void gaim_auth_dontgrant_msgprompt(struct name_data *data) { gaim_request_input(data->gc, NULL, _("Authorization Denied Message:"), - NULL, _("No reason given."), TRUE, FALSE, + NULL, _("No reason given."), TRUE, FALSE, NULL, _("OK"), G_CALLBACK(gaim_auth_dontgrant), _("Cancel"), G_CALLBACK(oscar_free_name_data), data); @@ -6444,7 +6444,7 @@ data->nick = NULL; gaim_request_input(gc, NULL, _("Buddy Comment:"), NULL, - comment_utf8, TRUE, FALSE, + comment_utf8, TRUE, FALSE, NULL, _("OK"), G_CALLBACK(oscar_ssi_editcomment), _("Cancel"), G_CALLBACK(oscar_free_name_data), data); @@ -6540,7 +6540,7 @@ static void oscar_show_format_screenname(GaimConnection *gc) { gaim_request_input(gc, NULL, _("New screen name formatting:"), NULL, - gaim_connection_get_display_name(gc), FALSE, FALSE, + gaim_connection_get_display_name(gc), FALSE, FALSE, NULL, _("OK"), G_CALLBACK(oscar_format_screenname), _("Cancel"), NULL, gc); @@ -6589,7 +6589,7 @@ static void oscar_show_change_email(GaimConnection *gc) { gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, - FALSE, FALSE, + FALSE, FALSE, NULL, _("OK"), G_CALLBACK(oscar_change_email), _("Cancel"), NULL, gc); @@ -6654,7 +6654,7 @@ _("Search for a buddy by e-mail address"), _("Type the e-mail address of the buddy you are " "searching for."), - NULL, FALSE, FALSE, + NULL, FALSE, FALSE, NULL, _("Search"), G_CALLBACK(search_by_email_cb), _("Cancel"), NULL, gc); } @@ -6671,7 +6671,7 @@ { gaim_request_input(gc, NULL, _("Available Message:"), NULL, _("I'm doing work and hoping for a distraction--IM me!"), - TRUE, FALSE, + TRUE, FALSE, NULL, _("OK"), G_CALLBACK(oscar_setavailmsg), _("Cancel"), NULL, gc);
--- a/src/protocols/yahoo/yahoo.c Sun Apr 18 05:47:16 2004 +0000 +++ b/src/protocols/yahoo/yahoo.c Sun Apr 18 06:22:42 2004 +0000 @@ -2500,7 +2500,7 @@ static void yahoo_show_act_id(GaimConnection *gc) { gaim_request_input(gc, NULL, _("Active which ID?"), NULL, - gaim_connection_get_display_name(gc), FALSE, FALSE, + gaim_connection_get_display_name(gc), FALSE, FALSE, NULL, _("OK"), G_CALLBACK(yahoo_act_id), _("Cancel"), NULL, gc); } @@ -2508,7 +2508,7 @@ static void yahoo_show_chat_goto(GaimConnection *gc) { gaim_request_input(gc, NULL, _("Join who in chat?"), NULL, - "", FALSE, FALSE, + "", FALSE, FALSE, NULL, _("OK"), G_CALLBACK(yahoo_chat_goto), _("Cancel"), NULL, gc); }
--- a/src/request.c Sun Apr 18 05:47:16 2004 +0000 +++ b/src/request.c Sun Apr 18 06:22:42 2004 +0000 @@ -1100,7 +1100,7 @@ void * gaim_request_input(void *handle, const char *title, const char *primary, const char *secondary, const char *default_value, - gboolean multiline, gboolean masked, + gboolean multiline, gboolean masked, gchar *hint, const char *ok_text, GCallback ok_cb, const char *cancel_text, GCallback cancel_cb, void *user_data) @@ -1120,7 +1120,7 @@ info->handle = handle; info->ui_handle = ops->request_input(title, primary, secondary, default_value, - multiline, masked, + multiline, masked, hint, ok_text, ok_cb, cancel_text, cancel_cb, user_data);
--- a/src/request.h Sun Apr 18 05:47:16 2004 +0000 +++ b/src/request.h Sun Apr 18 06:22:42 2004 +0000 @@ -171,7 +171,7 @@ { void *(*request_input)(const char *title, const char *primary, const char *secondary, const char *default_value, - gboolean multiline, gboolean masked, + gboolean multiline, gboolean masked, gchar *hint, const char *ok_text, GCallback ok_cb, const char *cancel_text, GCallback cancel_cb, void *user_data); @@ -1070,6 +1070,7 @@ * @param default_value The default value. * @param multiline TRUE if the inputted text can span multiple lines. * @param masked TRUE if the inputted text should be masked in some way. + * @param hint bleh. * @param ok_text The text for the OK button. * @param ok_cb The callback for the OK button. * @param cancel_text The text for the cancel button. @@ -1081,7 +1082,7 @@ void *gaim_request_input(void *handle, const char *title, const char *primary, const char *secondary, const char *default_value, - gboolean multiline, gboolean masked, + gboolean multiline, gboolean masked, gchar *hint, const char *ok_text, GCallback ok_cb, const char *cancel_text, GCallback cancel_cb, void *user_data);