Mercurial > pidgin.yaz
changeset 18215:16bf31872b7a
Chat topics in status line of chat infopanes
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 20 Jun 2007 23:33:32 +0000 |
parents | bf0032658576 |
children | af7b944374ba |
files | pidgin/gtkblist.c pidgin/gtkconv.c pidgin/gtkutils.c pidgin/gtkutils.h |
diffstat | 4 files changed, 44 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkblist.c Wed Jun 20 22:39:17 2007 +0000 +++ b/pidgin/gtkblist.c Wed Jun 20 23:33:32 2007 +0000 @@ -151,11 +151,7 @@ if (!gtkblist) return "dim grey"; if (!dim_grey_string[0]) { - GtkStyle *style = gtk_widget_get_style(gtkblist->treeview); - snprintf(dim_grey_string, sizeof(dim_grey_string), "#%02x%02x%02x", - style->text_aa[GTK_STATE_NORMAL].red >> 8, - style->text_aa[GTK_STATE_NORMAL].green >> 8, - style->text_aa[GTK_STATE_NORMAL].blue >> 8); + snprintf(dim_grey_string, sizeof(dim_grey_string), "%s", pidgin_get_dim_grey_string(gtkblist->treeview)); } return dim_grey_string; }
--- a/pidgin/gtkconv.c Wed Jun 20 22:39:17 2007 +0000 +++ b/pidgin/gtkconv.c Wed Jun 20 23:33:32 2007 +0000 @@ -4277,11 +4277,9 @@ hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - gtk_widget_show(hbox); label = gtk_label_new(_("Topic:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); gtkchat->topic_text = gtk_entry_new(); @@ -4293,7 +4291,6 @@ } gtk_box_pack_start(GTK_BOX(hbox), gtkchat->topic_text, TRUE, TRUE, 0); - gtk_widget_show(gtkchat->topic_text); g_signal_connect(G_OBJECT(gtkchat->topic_text), "key_press_event", G_CALLBACK(entry_key_press_cb), gtkconv); } @@ -6165,13 +6162,13 @@ pidgin_themes_smiley_themeize(PIDGIN_CONVERSATION(conv)->imhtml); if ((fields & PIDGIN_CONV_COLORIZE_TITLE) || - (fields & PIDGIN_CONV_SET_TITLE)) + (fields & PIDGIN_CONV_SET_TITLE) || + (fields & PIDGIN_CONV_TOPIC)) { char *title; PurpleConvIm *im = NULL; PurpleAccount *account = purple_conversation_get_account(conv); - PurpleBuddy *buddy; - char *markup; + char *markup = NULL; AtkObject *accessibility_obj; /* I think this is a little longer than it needs to be but I'm lazy. */ char style[51]; @@ -6187,11 +6184,19 @@ else title = g_strdup(purple_conversation_get_title(conv)); - buddy = purple_find_buddy(account, conv->name); - if (buddy) - markup = pidgin_blist_get_name_markup(buddy, FALSE, FALSE); - else - markup = title; + if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { + PurpleBuddy *buddy = purple_find_buddy(account, conv->name); + if (buddy) + markup = pidgin_blist_get_name_markup(buddy, FALSE, FALSE); + else + markup = title; + } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { + PurpleConvChat *chat = PURPLE_CONV_CHAT(conv); + markup = g_strdup_printf("%s\n<span color='%s' size='smaller'>%s</span>", + purple_conversation_get_title(conv), + pidgin_get_dim_grey_string(gtkconv->infopane), + purple_conv_chat_get_topic(chat)); + } gtk_list_store_set(gtkconv->infopane_model, &(gtkconv->infopane_iter), TEXT_COLUMN, markup, -1);
--- a/pidgin/gtkutils.c Wed Jun 20 22:39:17 2007 +0000 +++ b/pidgin/gtkutils.c Wed Jun 20 23:33:32 2007 +0000 @@ -3107,6 +3107,24 @@ pixels[height * rowstride - 9] = 0xC0; } +const char *pidgin_get_dim_grey_string(GtkWidget *widget) { + static char dim_grey_string[8] = ""; + GtkStyle *style; + + if (!widget) + return "dim grey"; + + style = gtk_widget_get_style(widget); + if (!style) + return "dim grey"; + + snprintf(dim_grey_string, sizeof(dim_grey_string), "#%02x%02x%02x", + style->text_aa[GTK_STATE_NORMAL].red >> 8, + style->text_aa[GTK_STATE_NORMAL].green >> 8, + style->text_aa[GTK_STATE_NORMAL].blue >> 8); + return dim_grey_string; +} + #if !GTK_CHECK_VERSION(2,2,0) GtkTreePath * gtk_tree_path_new_from_indices (gint first_index, ...)
--- a/pidgin/gtkutils.h Wed Jun 20 22:39:17 2007 +0000 +++ b/pidgin/gtkutils.h Wed Jun 20 23:33:32 2007 +0000 @@ -572,6 +572,15 @@ */ void pidgin_gdk_pixbuf_make_round(GdkPixbuf *pixbuf); +/** + * Returns an HTML-style color string for use as a dim grey + * string + * + * @param widget The widget to return dim grey for + * @return The dim grey string + */ +const char *pidgin_get_dim_grey_string(GtkWidget *widget); + #if !GTK_CHECK_VERSION(2,2,0) /** * This is copied from Gtk to support Gtk 2.0