Patch by ThomasThurman to display the text and author of an incoming tweet in the notification bubble.
diff -u twitux-ORIGINAL/src/twitux-app.c twitux-0.62/src/twitux-app.c --- twitux-ORIGINAL/src/twitux-app.c 2008-04-29 14:35:43.000000000 -0400 +++ twitux-0.62/src/twitux-app.c 2009-01-15 16:06:18.000000000 -0500 @@ -1059,11 +1059,9 @@ } void -twitux_app_show_notification (gint tweets) +twitux_app_show_notification (gchar *msg) { TwituxAppPriv *priv; - gchar *msg; - gchar *s; gboolean notify; priv = GET_PRIV (app); @@ -1076,14 +1074,6 @@ if (!notify || !gtk_status_icon_is_embedded (priv->status_icon)) return; - if (tweets > 1) { - s = _("tweets"); - } else { - s = _("tweet"); - } - - msg = g_strdup_printf (_("You have %i new %s."), tweets, s); - if (priv->notification!= NULL) { notify_notification_close (priv->notification, NULL); } @@ -1098,8 +1088,6 @@ notify_notification_set_timeout (priv->notification, 3000); notify_notification_show (priv->notification, NULL); - - g_free (msg); } void diff -u twitux-ORIGINAL/src/twitux-app.h twitux-0.62/src/twitux-app.h --- twitux-ORIGINAL/src/twitux-app.h 2008-04-20 15:48:08.000000000 -0400 +++ twitux-0.62/src/twitux-app.h 2009-01-15 01:37:15.000000000 -0500 @@ -64,7 +64,7 @@ void twitux_app_set_statusbar_msg (gchar *message); void twitux_app_set_friends (GList *friends); void twitux_app_add_friend (TwituxUser *user); -void twitux_app_show_notification (gint tweets); +void twitux_app_show_notification (gchar *msg); void twitux_app_state_on_connection (gboolean connected); diff -u twitux-ORIGINAL/src/twitux-parser.c twitux-0.62/src/twitux-parser.c --- twitux-ORIGINAL/src/twitux-parser.c 2008-04-20 15:48:08.000000000 -0400 +++ twitux-0.62/src/twitux-parser.c 2009-01-15 16:27:03.000000000 -0500 @@ -66,6 +66,8 @@ static void strtotime (const char *time, struct tm *post); static gchar *parser_convert_time (const char *datetime); +static gboolean display_notification (gpointer tweet); + /* id of the newest tweet showed */ static gint last_id = 0; @@ -179,6 +181,13 @@ return user; } +static gboolean +display_notification (gpointer tweet) +{ + twitux_app_show_notification (tweet); + g_free (tweet); + return FALSE; +} /* Parse a timeline XML file */ gboolean @@ -200,6 +209,8 @@ gboolean count = TRUE; gboolean s_username; + gint tweet_display_delay = 0; + const int tweet_display_interval = 5; /* parse the xml */ doc = parser_twitux_parse (cache_file_uri, &root_element); @@ -260,6 +271,14 @@ "</small>", NULL); + if (sid > last_id && show_notification) + { + g_timeout_add_seconds (tweet_display_delay, + display_notification, + g_strdup (tweet)); + tweet_display_delay += tweet_display_interval; + } + /* Append to ListStore */ gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, @@ -297,12 +316,6 @@ } /* end of loop */ - /* Show UI notification */ - if (show_notification && (nTwitts > 0) && - (last_id != lastTweet)) { - twitux_app_show_notification (nTwitts); - } - /* Remember last id showed */ if (lastTweet > 0) { last_id = lastTweet;