=== modified file 'src/Makefile.am' --- old/src/Makefile.am 2009-02-19 13:55:09 +0000 +++ new/src/Makefile.am 2009-03-18 14:37:13 +0000 @@ -22,6 +22,7 @@ dbus.c \ dnd.c \ apport.c \ + util.c \ ../egg/egg-fixed.c \ ../egg/egg-units.c \ ../egg/egg-timeline.c \ === modified file 'src/bubble.c' --- old/src/bubble.c 2009-03-17 11:32:50 +0000 +++ new/src/bubble.c 2009-03-18 14:48:06 +0000 @@ -42,6 +42,7 @@ #include "defaults.h" #include "stack.h" #include "dbus.h" +#include "util.h" G_DEFINE_TYPE (Bubble, bubble, G_TYPE_OBJECT); @@ -147,7 +148,7 @@ /* top-left, right of the corner */ cairo_move_to (cr, x + radius, y); - /* top-right, left of the corner */ + /* top-right, left of the corner */ cairo_line_to (cr, x + width - radius, y); @@ -160,12 +161,12 @@ -90.0f * G_PI / 180.0f, 0.0f * G_PI / 180.0f); - /* bottom-right, above the corner */ + /* bottom-right, above the corner */ cairo_line_to (cr, x + width, y + height - radius); - /* bottom-right, left of the corner */ + /* bottom-right, left of the corner */ cairo_arc (cr, x + width - radius, y + height - radius, @@ -178,7 +179,7 @@ x + radius, y + height); - /* bottom-left, above the corner */ + /* bottom-left, above the corner */ cairo_arc (cr, x + radius, y + height - radius, @@ -248,7 +249,7 @@ static cairo_surface_t* blur_image_surface (cairo_surface_t* surface, gint radius, - gdouble sigma /* pass 0.0f for auto-calculation */) + gdouble sigma /* pass 0.0f for auto-calculation */) { static cairo_user_data_key_t data_key; pixman_fixed_t* params = NULL; @@ -1176,10 +1177,10 @@ screen_changed_handler (GtkWidget* window, GdkScreen* old_screen, gpointer data) -{ +{ GdkScreen* screen = gtk_widget_get_screen (window); GdkColormap* colormap = gdk_screen_get_rgba_colormap (screen); - + if (!colormap) colormap = gdk_screen_get_rgb_colormap (screen); @@ -1937,7 +1938,7 @@ g_signal_connect (G_OBJECT (window), "expose-event", G_CALLBACK (expose_handler), - this); + this); /* "clear" input-mask, set title/icon/attributes */ gtk_widget_set_app_paintable (window, TRUE); @@ -2032,10 +2033,11 @@ bubble_set_title (Bubble* self, const gchar* title) { + gchar* text; + gchar* new_title; gboolean success; - gchar* text; + BubblePrivate* priv; GError* error = NULL; - BubblePrivate* priv; if (!self || !IS_BUBBLE (self)) return; @@ -2046,23 +2048,18 @@ g_string_free (priv->title, TRUE); /* filter out any HTML/markup if possible */ - success = pango_parse_markup (title, + text = filter_text (title); + success = pango_parse_markup (text, -1, - 0, /* no accel-marker needed */ - NULL, /* no PangoAttr needed */ - &text, - NULL, /* no accel-marker-return needed */ + 0, /* no accel-marker needed */ + NULL, /* No PangoAttr needed */ + &new_title, + NULL, /* No accel-marker-return needed */ &error); - /* if parsing worked out set the "filtered" text ...*/ - if (success) - { - priv->title = g_string_new (text); - g_free ((gpointer) text); - } - /* ... other pass it as-is */ - else - priv->title = g_string_new (title); + priv->title = g_string_new (new_title); + g_free (text); + g_free (new_title); } const gchar* @@ -2337,7 +2334,7 @@ g_return_if_fail (IS_BUBBLE (bubble)); bubble_refresh (bubble); -} +} static void bubble_start_glow_effect (Bubble *self, @@ -2381,7 +2378,7 @@ bubble_show (Bubble* self) { BubblePrivate* priv; - + if (!self || !IS_BUBBLE (self)) return; @@ -2419,7 +2416,7 @@ gint x = 0; gint y = 0; BubblePrivate* priv; - + /* sanity check */ if (!self || !IS_BUBBLE (self)) return FALSE; @@ -2535,7 +2532,7 @@ dbus_send_close_signal (bubble_get_sender (bubble), bubble_get_id (bubble), 1); - g_signal_emit (bubble, g_bubble_signals[TIMED_OUT], 0); + g_signal_emit (bubble, g_bubble_signals[TIMED_OUT], 0); } @@ -2617,7 +2614,7 @@ gtk_window_set_opacity (bubble_get_window (self), 0.0f); - bubble_show (self); + bubble_show (self); } void @@ -3036,7 +3033,7 @@ self, priv->title_width); - priv->body_width = + priv->body_width = EM2PIXELS (defaults_get_bubble_width (d), d) - 2 * EM2PIXELS (defaults_get_margin_size (d), d); @@ -3194,7 +3191,7 @@ !(priv->icon_only)) { priv->layout = LAYOUT_ICON_TITLE; - return; + return; } /* icon/avatar + title + body/message layout-case, e.g. IM-message */ === added file 'src/util.c' --- old/src/util.c 1970-01-01 00:00:00 +0000 +++ new/src/util.c 2009-03-18 14:41:06 +0000 @@ -0,0 +1,41 @@ +/******************************************************************************* + **3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 + ** 10 20 30 40 50 60 70 80 + ** + ** notify-osd + ** + ** bubble.c - implements all the rendering of a notification bubble + ** + ** Copyright 2009 Canonical Ltd. + ** + ** Authors: + ** Cody Russell + ** + ** This program is free software: you can redistribute it and/or modify it + ** under the terms of the GNU General Public License version 3, as published + ** by the Free Software Foundation. + ** + ** This program is distributed in the hope that it will be useful, but + ** WITHOUT ANY WARRANTY; without even the implied warranties of + ** MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + ** PURPOSE. See the GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License along + ** with this program. If not, see . + ** + *******************************************************************************/ + +#include + +gchar* +filter_text (const gchar *text) +{ + gchar *ret; + GRegex *regex; + + regex = g_regex_new ("<(.|\n)*?>", 0, 0, NULL); + + ret = g_regex_replace (regex, text, -1, 0, "", 0, NULL); + + return ret; +} === added file 'src/util.h' --- old/src/util.h 1970-01-01 00:00:00 +0000 +++ new/src/util.h 2009-03-18 14:40:48 +0000 @@ -0,0 +1,29 @@ +/******************************************************************************* +**3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 +** 10 20 30 40 50 60 70 80 +** +** notify-osd +** +** apport.h - apport hooks for triggering bug-reports on non-spec notifications +** +** Copyright 2009 Canonical Ltd. +** +** Authors: +** Cody Russell +** +** This program is free software: you can redistribute it and/or modify it +** under the terms of the GNU General Public License version 3, as published +** by the Free Software Foundation. +** +** This program is distributed in the hope that it will be useful, but +** WITHOUT ANY WARRANTY; without even the implied warranties of +** MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +** PURPOSE. See the GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License along +** with this program. If not, see . +** +*******************************************************************************/ + +gchar* +filter_text (const gchar* app_name);