Mercurial > pidgin
comparison src/gtkimhtmltoolbar.c @ 9041:812e7aa7eafa
[gaim-migrate @ 9817]
nosnilmot wrote:
" Yahoo & MSN support a subset of formatting which does
not include sending descriptions with links.
This patch adds a connection flag
GAIM_CONNECTION_NO_URLDESC to allow prpls to specify
this limitation (and modifies Yahoo & MSN to do so)
It also adds GTK_IMHTML_LINKDESC to the
GtkIMHtmlButtons enum (I pondered over this, then
realized it's referred to as "format_functions" in some
places, so probably could be renamed to
GtkIMHtmlOptions or something)
This combination allows the GtkIMHtmlToolbar to
intelligently ask for only a URL if a description is
not supported.
One slightly unfortunate side effect is it makes bug
955538 much more prominent on Yahoo"
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Sun, 23 May 2004 21:40:58 +0000 |
parents | 1bd8bda384e7 |
children | 2fa81d44ee6f |
comparison
equal
deleted
inserted
replaced
9040:3f6d795d67d5 | 9041:812e7aa7eafa |
---|---|
356 do_insert_link_cb(GtkIMHtmlToolbar *toolbar, GaimRequestFields *fields) | 356 do_insert_link_cb(GtkIMHtmlToolbar *toolbar, GaimRequestFields *fields) |
357 { | 357 { |
358 const char *url, *description; | 358 const char *url, *description; |
359 | 359 |
360 url = gaim_request_fields_get_string(fields, "url"); | 360 url = gaim_request_fields_get_string(fields, "url"); |
361 description = gaim_request_fields_get_string(fields, "description"); | 361 if (GTK_IMHTML(toolbar->imhtml)->format_functions & GTK_IMHTML_LINKDESC) |
362 description = gaim_request_fields_get_string(fields, "description"); | |
363 else | |
364 description = NULL; | |
362 | 365 |
363 if (description == NULL) | 366 if (description == NULL) |
364 description = url; | 367 description = url; |
365 | 368 |
366 gtk_imhtml_insert_link(GTK_IMHTML(toolbar->imhtml), | 369 gtk_imhtml_insert_link(GTK_IMHTML(toolbar->imhtml), |
377 { | 380 { |
378 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))) { | 381 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toolbar->link))) { |
379 GaimRequestFields *fields; | 382 GaimRequestFields *fields; |
380 GaimRequestFieldGroup *group; | 383 GaimRequestFieldGroup *group; |
381 GaimRequestField *field; | 384 GaimRequestField *field; |
385 char *msg; | |
382 | 386 |
383 fields = gaim_request_fields_new(); | 387 fields = gaim_request_fields_new(); |
384 | 388 |
385 group = gaim_request_field_group_new(NULL); | 389 group = gaim_request_field_group_new(NULL); |
386 gaim_request_fields_add_group(fields, group); | 390 gaim_request_fields_add_group(fields, group); |
387 | 391 |
388 field = gaim_request_field_string_new("url", _("_URL"), NULL, FALSE); | 392 field = gaim_request_field_string_new("url", _("_URL"), NULL, FALSE); |
389 gaim_request_field_set_required(field, TRUE); | 393 gaim_request_field_set_required(field, TRUE); |
390 gaim_request_field_group_add_field(group, field); | 394 gaim_request_field_group_add_field(group, field); |
391 | 395 |
392 field = gaim_request_field_string_new("description", _("_Description"), | 396 if(GTK_IMHTML(toolbar->imhtml)->format_functions & GTK_IMHTML_LINKDESC) { |
393 NULL, FALSE); | 397 field = gaim_request_field_string_new("description", _("_Description"), |
394 gaim_request_field_group_add_field(group, field); | 398 NULL, FALSE); |
399 gaim_request_field_group_add_field(group, field); | |
400 msg = g_strdup(_("Please enter the URL and description of the " | |
401 "link that you want to insert. The description " | |
402 "is optional.")); | |
403 } else { | |
404 msg = g_strdup(_("Please enter the URL of the " | |
405 "link that you want to insert.")); | |
406 } | |
395 | 407 |
396 toolbar->link_dialog = | 408 toolbar->link_dialog = |
397 gaim_request_fields(toolbar, _("Insert Link"), | 409 gaim_request_fields(toolbar, _("Insert Link"), |
398 NULL, | 410 NULL, |
399 _("Please enter the URL and description of the " | 411 msg, |
400 "link that you want to insert. The description " | |
401 "is optional."), | |
402 fields, | 412 fields, |
403 _("_Insert"), G_CALLBACK(do_insert_link_cb), | 413 _("_Insert"), G_CALLBACK(do_insert_link_cb), |
404 _("Cancel"), G_CALLBACK(cancel_link_cb), | 414 _("Cancel"), G_CALLBACK(cancel_link_cb), |
405 toolbar); | 415 toolbar); |
416 g_free(msg); | |
406 } else { | 417 } else { |
407 close_link_dialog(toolbar); | 418 close_link_dialog(toolbar); |
408 } | 419 } |
409 gtk_widget_grab_focus(toolbar->imhtml); | 420 gtk_widget_grab_focus(toolbar->imhtml); |
410 } | 421 } |