pidgin: cfbe335c: Customize/disable the typing notificatio..
sadrul at pidgin.im
sadrul at pidgin.im
Sat Apr 5 15:30:49 EDT 2008
-----------------------------------------------------------------
Revision: cfbe335ca4756596996e71e975e5cf2fe4413d8b
Ancestor: 2d81cb2ed62d87e61e4c97d14a0bb01a45730638
Author: sadrul at pidgin.im
Date: 2008-04-05T12:59:31
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/cfbe335ca4756596996e71e975e5cf2fe4413d8b
Modified files:
ChangeLog pidgin/gtkconv.c pidgin/gtkimhtml.c
ChangeLog:
Customize/disable the typing notification from gtkrc-2.0.
-------------- next part --------------
============================================================
--- ChangeLog b432dbaee743d96fbb077fe16125484062922daa
+++ ChangeLog 44f1b73b09609d921ff24dc4559c8e58d4d95363
@@ -4,6 +4,10 @@ version 2.x.x:
libpurple:
* In MySpaceIM, messages from spambots are discarded (Justin Williams)
+ Pidgin:
+ * The typing notification in the conversation history can be disabled or
+ customized (font, color etc.) in .gtkrc-2.0.
+
version 2.4.1 (03/31/2008):
http://developer.pidgin.im/query?status=closed&milestone=2.4.1
============================================================
--- pidgin/gtkconv.c 55e9ec08b98b4408d72b56f6fb462910444293a3
+++ pidgin/gtkconv.c 651b89698fe87fda60ed41879249bfc8ef593684
@@ -3411,9 +3411,13 @@ update_typing_message(PidginConversation
static void
update_typing_message(PidginConversation *gtkconv, const char *message)
{
- GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml));
+ GtkTextBuffer *buffer;
GtkTextMark *stmark, *enmark;
+ if (g_object_get_data(G_OBJECT(gtkconv->imhtml), "disable-typing-notification"))
+ return;
+
+ buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml));
stmark = gtk_text_buffer_get_mark(buffer, "typing-notification-start");
enmark = gtk_text_buffer_get_mark(buffer, "typing-notification-end");
if (stmark && enmark) {
@@ -4900,6 +4904,40 @@ ignore_middle_click(GtkWidget *widget, G
return FALSE;
}
+static void set_typing_font(GtkWidget *widget, GtkStyle *style, PidginConversation *gtkconv)
+{
+ static PangoFontDescription *font_desc = NULL;
+ static GdkColor *color = NULL;
+ static gboolean enable = TRUE;
+
+ if (font_desc == NULL) {
+ char *string = NULL;
+ gtk_widget_style_get(widget,
+ "typing-notification-font", &string,
+ "typing-notification-color", &color,
+ "typing-notification-enable", &enable,
+ NULL);
+ font_desc = pango_font_description_from_string(string);
+ g_free(string);
+ if (color == NULL) {
+ GdkColor def = {0, 0x8888, 0x8888, 0x8888};
+ color = gdk_color_copy(&def);
+ }
+ }
+
+ gtk_text_buffer_create_tag(GTK_IMHTML(widget)->text_buffer, "TYPING-NOTIFICATION",
+ "foreground-gdk", color,
+ "font-desc", font_desc,
+ NULL);
+
+ if (!enable) {
+ g_object_set_data(G_OBJECT(widget), "disable-typing-notification", GINT_TO_POINTER(TRUE));
+ /* or may be 'gtkconv->disable_typing = TRUE;' instead? */
+ }
+
+ g_signal_handlers_disconnect_by_func(G_OBJECT(widget), set_typing_font, gtkconv);
+}
+
/**************************************************************************
* Conversation UI operations
**************************************************************************/
@@ -4981,12 +5019,7 @@ private_gtkconv_new(PurpleConversation *
g_signal_connect(G_OBJECT(gtkconv->entry), "drag_data_received",
G_CALLBACK(conv_dnd_recv), gtkconv);
- gtk_text_buffer_create_tag(GTK_IMHTML(gtkconv->imhtml)->text_buffer, "TYPING-NOTIFICATION",
- "foreground", "#888888",
- "justification", GTK_JUSTIFY_LEFT, /* XXX: RTL'ify */
- "weight", PANGO_WEIGHT_LIGHT,
- "scale", PANGO_SCALE_SMALL,
- NULL);
+ g_signal_connect(gtkconv->imhtml, "style-set", G_CALLBACK(set_typing_font), gtkconv);
/* Setup the container for the tab. */
gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
============================================================
--- pidgin/gtkimhtml.c 9778a210fbcab6624ed7cd12cb73deb85d3487e4
+++ pidgin/gtkimhtml.c 2fabced73e99ea02011d86594e0fc2c3ec6db69b
@@ -1416,6 +1416,24 @@ static void gtk_imhtml_class_init (GtkIM
_("Color to draw the name of an action message."),
GDK_TYPE_COLOR, G_PARAM_READABLE));
+ /* Customizable typing notification ... sort of. Example:
+ * GtkIMHtml::typing-notification-font = "monospace italic light 8.0"
+ * GtkIMHtml::typing-notification-color = "#ff0000"
+ * GtkIMHtml::typing-notification-enable = 1
+ */
+ gtk_widget_class_install_style_property(widget_class, g_param_spec_boxed("typing-notification-color",
+ _("Typing notification color"),
+ _("The color to use for the typing notification font"),
+ GDK_TYPE_COLOR, G_PARAM_READABLE));
+ gtk_widget_class_install_style_property(widget_class, g_param_spec_string("typing-notification-font",
+ _("Typing notification font"),
+ _("The font to use for the typing notification"),
+ "light 8.0", G_PARAM_READABLE));
+ gtk_widget_class_install_style_property(widget_class, g_param_spec_boolean("typing-notification-enable",
+ _("Enable typing notification"),
+ _("Enable typing notification"),
+ TRUE, G_PARAM_READABLE));
+
binding_set = gtk_binding_set_by_class (parent_class);
gtk_binding_entry_add_signal (binding_set, GDK_b, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_BOLD);
gtk_binding_entry_add_signal (binding_set, GDK_i, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_ITALIC);
More information about the Commits
mailing list