Ticket #162 (defect)

Opened 8 months ago

Last modified 21 hours ago

Incorrect line wrapping in libnotify or notification-daemon

Status: closed (fixed)

Reported by: zebob Assigned to: chipx86
Priority: high Milestone:
Component: notification-daemon Version:
Severity: major Keywords:
Cc: D-BUS Version: 1.1.20
Patch Included: 0 OS/Distro Version: Fedora 9/Rawhide

Line wrapping is incorrectly handled: If the final line of a message has more than 50 characters and less than 65 characters, then the end of the line is truncated (i.e. not visible) at the word across the 50th character. Il the final line has more than 65 characters, everything is ok because the line is wrapped at the word across the 50th character.

This causes various message being truncated in gnome-power-manager notification translations.

Please investigate this ASAP.

Attachments

notify_fix.patch (0.6 kB) - added by zebob on 03/21/08 09:19:39.

Change History

03/21/08 09:19:39: Modified by zebob

  • attachment notify_fix.patch added.

03/21/08 09:20:10: Modified by zebob

I got it. The problem is located in theme.c (trunk/notification-daemon/src/themes/standard/theme.c) :

void
set_notification_text(GtkWindow *nw, const char *summary, const char *body)
{
    char *str;
    WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata");
    g_assert(windata != NULL);

    str = g_strdup_printf("<b><big>%s</big></b>", summary);
    gtk_label_set_markup(GTK_LABEL(windata->summary_label), str);
    g_free(str);

    sexy_url_label_set_markup(SEXY_URL_LABEL(windata->body_label), body);

    if (body == NULL || *body == '\0')
        gtk_widget_hide(windata->body_label);
    else
        gtk_widget_show(windata->body_label);

    update_content_hbox_visibility(windata);

    gtk_widget_set_size_request(
        ((body != NULL && *body == '\0')
         ? windata->body_label : windata->summary_label),
        WIDTH - (IMAGE_SIZE + IMAGE_PADDING) - 10,
        -1);
}

Currently gtk_widget_set_size_request returns windata->body_label if body is not null and is empty : this is illogical, it should return windata->body_label if body is not null and is not empty. Like this IMHO :

    gtk_widget_set_size_request(
        ((body != NULL && *body != '\0')
         ? windata->body_label : windata->summary_label),
        WIDTH - (IMAGE_SIZE + IMAGE_PADDING) - 10,
        -1);

03/22/08 08:16:35: Modified by zebob

oops, in fact this bugs is a duplicate of #154 #158 and #159 .

04/09/08 13:38:42: Modified by pacho

The patch will be applied in ubuntu soon, can this also be applied here in upstream?

Thanks a lot

11/20/08 01:43:35: Modified by chipx86

Committing a patch based on this patch that fixes some other issues.

Also, see bugs 154, 158 and 159 for other repro cases and screenshots.

11/20/08 01:44:14: Modified by chipx86

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in r3020.