ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00425
[Branch ~notify-osd-developers/notify-osd/main] Rev 404: added newline_to_space() for converting CR to SPACE in title-text, fixes LP: #402247
------------------------------------------------------------
revno: 404
committer: Mirco Müller <mirco.mueller@xxxxxxxxxx>
branch nick: notify-osd
timestamp: Thu 2009-10-01 10:34:39 +0200
message:
added newline_to_space() for converting CR to SPACE in title-text, fixes LP: #402247
modified:
src/bubble.c
src/util.c
src/util.h
--
lp:notify-osd
https://code.launchpad.net/~notify-osd-developers/notify-osd/main
Your team ayatana-commits is subscribed to branch lp:notify-osd.
To unsubscribe from this branch go to https://code.launchpad.net/~notify-osd-developers/notify-osd/main/+edit-subscription.
=== modified file 'src/bubble.c'
--- src/bubble.c 2009-09-28 14:09:27 +0000
+++ src/bubble.c 2009-10-01 08:34:39 +0000
@@ -2306,6 +2306,7 @@
bubble_set_title (Bubble* self,
const gchar* title)
{
+ gchar* text;
BubblePrivate* priv;
if (!self || !IS_BUBBLE (self))
@@ -2316,11 +2317,16 @@
if (priv->title)
g_string_free (priv->title, TRUE);
- priv->title = g_string_new (title);
+ // convert any newline to space
+ text = newline_to_space (title);
+
+ priv->title = g_string_new (text);
g_object_notify (
G_OBJECT (gtk_widget_get_accessible (GET_PRIVATE(self)->widget)),
"accessible-name");
+
+ g_free (text);
}
const gchar*
=== modified file 'src/util.c'
--- src/util.c 2009-09-27 20:48:03 +0000
+++ src/util.c 2009-10-01 08:34:39 +0000
@@ -117,6 +117,28 @@
return text1;
}
+gchar*
+newline_to_space (const gchar *text)
+{
+ gchar *text1;
+
+ text1 = strip_html (text, TAG_MATCH_REGEX, TAG_REPLACE_REGEX);
+
+ static ReplaceMarkupData data[] = {
+ { CHARACTER_NEWLINE_REGEX, " " }
+ };
+
+ ReplaceMarkupData* ptr = data;
+ ReplaceMarkupData* end = data + sizeof(data) / sizeof(ReplaceMarkupData);
+ for (; ptr != end; ++ptr) {
+ gchar* tmp = replace_markup (text1, ptr->regex, ptr->replacement);
+ g_free (text1);
+ text1 = tmp;
+ }
+
+ return text1;
+}
+
gboolean
destroy_cloned_surface (cairo_surface_t* surface)
{
=== modified file 'src/util.h'
--- src/util.h 2009-07-31 13:11:46 +0000
+++ src/util.h 2009-10-01 08:34:39 +0000
@@ -38,7 +38,10 @@
#define WM_NAME_XMONAD "xmonad"
gchar*
-filter_text (const gchar* app_name);
+filter_text (const gchar* text);
+
+gchar*
+newline_to_space (const gchar* text);
cairo_surface_t*
copy_surface (cairo_surface_t* orig);