im.pidgin.pidgin: 9b60657732e2c9dfce01b3f77e91a1bead862eab
wabz at pidgin.im
wabz at pidgin.im
Mon Dec 3 02:10:49 EST 2007
-----------------------------------------------------------------
Revision: 9b60657732e2c9dfce01b3f77e91a1bead862eab
Ancestor: c8311f90dd1011e5d2d3ab22927f6db16ce52880
Author: wabz at pidgin.im
Date: 2007-12-03T07:01:32
Branch: im.pidgin.pidgin
Modified files:
ChangeLog ChangeLog.API doc/finch.1.in finch/gntblist.c
finch/gntconv.c finch/libgnt/gntstyle.c
finch/libgnt/gntstyle.h
ChangeLog:
Add color to the conversation window to indicate various message attributes
-------------- next part --------------
============================================================
--- ChangeLog 52ecde304b0f22711911b4ad514d4f5b1bfd26c0
+++ ChangeLog c8386a4a6bc4ccdb2e3a96fda7f932590a7d3dae
@@ -1,13 +1,17 @@ Pidgin and Finch: The Pimpin' Penguin IM
Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
-version 2.3.1 (??/??/????):
+version 2.3.2 (??/??/????):
libpurple:
* Fixed various problems with loss of status messages when going
or returning from idle on MySpaceIM.
Finch:
- * Color is used in the buddylist to indicate status. Look at the sample
- gntrc file in the man-page for details.
+ * Color is used in the buddylist to indicate status, and the conversation
+ window to indicate various message attributes. Look at the sample gntrc
+ file in the man-page for details.
+ * The default keybinding for dump-screen is now M-D and uses a file
+ request dialog. M-d will properly delete-forward-word, and M-f has been
+ fixed to imitate readline's behavior.
version 2.3.0 (11/24/2007):
http://developer.pidgin.im/query?status=closed&milestone=2.3.0
============================================================
--- ChangeLog.API e79b673ea18efa03e5f01a1a24a652f8064c0929
+++ ChangeLog.API 9683c67b225c5ecb8c26cce27fe568dee7623b86
@@ -1,6 +1,6 @@ Pidgin and Finch: The Pimpin' Penguin IM
Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
-version 2.3.1 (??/??/????):
+version 2.3.2 (??/??/????):
Finch:
libgnt:
* Added gnt_tree_set_row_color to set the color for a row in a tree.
@@ -8,6 +8,8 @@ version 2.3.1 (??/??/????):
* Added gnt_color_add_pair to define a new color.
* Added gnt_colors_get_color to get an ncurses color value from a
string.
+ * Added gnt_style_get_color to get a color pair from an entry in
+ ~/.gntrc
version 2.3.0 (11/24/2007):
libpurple:
============================================================
--- doc/finch.1.in 10c696423b33a1805e2d44bbc2b6218449c677c7
+++ doc/finch.1.in c1ef62cc62b2b753ef522bdd488f4837946f0abb
@@ -145,6 +145,16 @@ color-offline = red; black
.br
color-offline = red; black
.br
+color-message-sent = cyan; default
+.br
+color-message-received = red; default
+.br
+color-message-highlight = black; green
+.br
+color-message-action = yellow; default
+.br
+color-timestamp = blue; default
+.br
#See below for details on color
.br
[general]
@@ -237,6 +247,8 @@ urgent = green; black
.br
urgent = green; black
.br
+urgent = green; black
+.br
.br
# Remap some keys for GntEntry
============================================================
--- finch/gntblist.c ff210da5db9b1629954713a9f045de56eb272731
+++ finch/gntblist.c 6fa9c197e5d4186ab7c4e768de76aa894fbcce29
@@ -1768,37 +1768,18 @@ redraw_blist(const char *name, PurplePre
draw_tooltip(ggblist);
}
-static int
-get_color(char *key)
-{
-#if GLIB_CHECK_VERSION(2,6,0)
- int fg = 0, bg = 0;
- gsize n;
- char **vals;
- vals = gnt_style_get_string_list(NULL, key, &n);
- if (vals && n == 2) {
- fg = gnt_colors_get_color(vals[0]);
- bg = gnt_colors_get_color(vals[1]);
- return gnt_color_add_pair(fg, bg);
- }
- return 0;
-#else
- return 0;
-#endif
-}
-
void finch_blist_init()
{
- color_available = get_color("color-available");
+ color_available = gnt_style_get_color(NULL, "color-available");
if (!color_available)
color_available = gnt_color_add_pair(COLOR_GREEN, -1);
- color_away = get_color("color-away");
+ color_away = gnt_style_get_color(NULL, "color-away");
if (!color_away)
color_away = gnt_color_add_pair(COLOR_BLUE, -1);
- color_idle = get_color("color-idle");
+ color_idle = gnt_style_get_color(NULL, "color-idle");
if (!color_idle)
color_idle = gnt_color_add_pair(COLOR_CYAN, -1);
- color_offline = get_color("color-offline");
+ color_offline = gnt_style_get_color(NULL, "color-offline");
if (!color_offline)
color_offline = gnt_color_add_pair(COLOR_RED, -1);
============================================================
--- finch/gntconv.c a87d1b684fc91395da3b3c4ea34ace843667d796
+++ finch/gntconv.c 4f7e532f5f3cede52d639053829583ac357e9148
@@ -49,6 +49,7 @@
#include "gntmenu.h"
#include "gntmenuitem.h"
#include "gntmenuitemcheck.h"
+#include "gntstyle.h"
#include "gnttextview.h"
#include "gnttree.h"
#include "gntutils.h"
@@ -64,6 +65,12 @@ static void generate_send_to_menu(FinchC
const char *message, PurpleMessageFlags flags, time_t mtime);
static void generate_send_to_menu(FinchConv *ggc);
+static int color_message_receive;
+static int color_message_send;
+static int color_message_highlight;
+static int color_message_action;
+static int color_timestamp;
+
static PurpleBlistNode *
get_conversation_blist_node(PurpleConversation *conv)
{
@@ -753,8 +760,10 @@ finch_write_common(PurpleConversation *c
/* Unnecessary to print the timestamp for delayed message */
if (purple_prefs_get_bool("/finch/conversations/timestamps"))
gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
- purple_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM);
+ purple_utf8_strftime("(%H:%M:%S)", localtime(&mtime)), gnt_color_pair(color_timestamp));
+ gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), " ", GNT_TEXT_FLAG_NORMAL);
+
if (flags & PURPLE_MESSAGE_AUTO_RESP)
gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
_("<AUTO-REPLY> "), GNT_TEXT_FLAG_BOLD);
@@ -764,22 +773,31 @@ finch_write_common(PurpleConversation *c
{
char * name = NULL;
- if (purple_message_meify((char*)message, -1))
- name = g_strdup_printf("*** %s ", who);
- else
- name = g_strdup_printf("%s: ", who);
-
- gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
- name, GNT_TEXT_FLAG_BOLD);
+ if (purple_message_meify((char*)message, -1)) {
+ name = g_strdup_printf("*** %s", who);
+ gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
+ name, gnt_color_pair(color_message_action));
+ } else {
+ name = g_strdup_printf("%s", who);
+ if (flags & PURPLE_MESSAGE_SEND)
+ gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
+ name, gnt_color_pair(color_message_send));
+ else
+ if (flags & PURPLE_MESSAGE_NICK) {
+ gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
+ name, gnt_color_pair(color_message_highlight));
+ } else {
+ gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
+ name, gnt_color_pair(color_message_receive));
+ }
+ }
+ gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), ": ", GNT_TEXT_FLAG_NORMAL);
g_free(name);
- }
- else
+ } else
fl = GNT_TEXT_FLAG_DIM;
if (flags & PURPLE_MESSAGE_ERROR)
fl |= GNT_TEXT_FLAG_BOLD;
- if (flags & PURPLE_MESSAGE_NICK)
- fl |= GNT_TEXT_FLAG_UNDERLINE;
/* XXX: Remove this workaround when textview can parse messages. */
newline = purple_strdup_withhtml(message);
@@ -1126,6 +1144,21 @@ void finch_conversation_init()
void finch_conversation_init()
{
+ color_message_send = gnt_style_get_color(NULL, "color-message-sent");
+ if (!color_message_send)
+ color_message_send = gnt_color_add_pair(COLOR_CYAN, -1);
+ color_message_receive = gnt_style_get_color(NULL, "color-message-received");
+ if (!color_message_receive)
+ color_message_receive = gnt_color_add_pair(COLOR_RED, -1);
+ color_message_highlight = gnt_style_get_color(NULL, "color-message-highlight");
+ if (!color_message_highlight)
+ color_message_highlight = gnt_color_add_pair(COLOR_GREEN, -1);
+ color_timestamp = gnt_style_get_color(NULL, "color-timestamp");
+ if (!color_timestamp)
+ color_timestamp = gnt_color_add_pair(COLOR_BLUE, -1);
+ color_message_action = gnt_style_get_color(NULL, "color-message-action");
+ if (!color_message_action)
+ color_message_action = gnt_color_add_pair(COLOR_YELLOW, -1);
purple_prefs_add_none(PREF_ROOT);
purple_prefs_add_none(PREF_ROOT "/size");
purple_prefs_add_int(PREF_ROOT "/size/width", 70);
============================================================
--- finch/libgnt/gntstyle.c b41472476767b5735b597c60dcc002b9a008ce60
+++ finch/libgnt/gntstyle.c 24349a177d65f52478d52b3a22354ed5f00f750e
@@ -59,6 +59,25 @@ char *gnt_style_get_from_name(const char
#endif
}
+int
+gnt_style_get_color(char *group, char *key)
+{
+#if GLIB_CHECK_VERSION(2,6,0)
+ int fg = 0, bg = 0;
+ gsize n;
+ char **vals;
+ vals = gnt_style_get_string_list(group, key, &n);
+ if (vals && n == 2) {
+ fg = gnt_colors_get_color(vals[0]);
+ bg = gnt_colors_get_color(vals[1]);
+ return gnt_color_add_pair(fg, bg);
+ }
+ return 0;
+#else
+ return 0;
+#endif
+}
+
char **gnt_style_get_string_list(const char *group, const char *key, gsize *length)
{
#if GLIB_CHECK_VERSION(2,6,0)
============================================================
--- finch/libgnt/gntstyle.h ff5c4fa89e5784532c873567a90d7258f51ee5d1
+++ finch/libgnt/gntstyle.h 525e5c2149cb4c420f207d99966c4e584d165d8a
@@ -74,11 +74,24 @@ char *gnt_style_get_from_name(const char
*
* @return NULL terminated string array. The array should be freed with g_strfreev().
*
- * @since 2.3.1 (gnt), 2.3.1 (pidgin)
+ * @since 2.3.2
*/
char **gnt_style_get_string_list(const char *group, const char *key, gsize *length);
/**
+ * Get the value of a color pair in ~/.gntrc.
+ *
+ * @param group The name of the group in the keyfile. If @c NULL, the prgname
+ * will be used first, if available. Otherwise, "general" will be used.
+ * @param key The key
+ *
+ * @return The value of the color as an int, or 0 on error.
+ *
+ * @since 2.3.2
+ */
+int gnt_style_get_color(char *group, char *key);
+
+/**
* Parse a boolean preference. For example, if 'value' is "false" (ignoring case)
* or "0", the return value will be @c FALSE, otherwise @c TRUE.
*
More information about the Commits
mailing list