Tree @upstream/3.1.3 (Download .tar.gz)
- ..
- empathy-account-chooser.c
- empathy-account-chooser.h
- empathy-account-widget-aim.ui
- empathy-account-widget-generic.ui
- empathy-account-widget-groupwise.ui
- empathy-account-widget-icq.ui
- empathy-account-widget-irc.c
- empathy-account-widget-irc.h
- empathy-account-widget-irc.ui
- empathy-account-widget-jabber.ui
- empathy-account-widget-local-xmpp.ui
- empathy-account-widget-msn.ui
- empathy-account-widget-private.h
- empathy-account-widget-sip.c
- empathy-account-widget-sip.h
- empathy-account-widget-sip.ui
- empathy-account-widget-yahoo.ui
- empathy-account-widget.c
- empathy-account-widget.h
- empathy-avatar-chooser.c
- empathy-avatar-chooser.h
- empathy-avatar-image.c
- empathy-avatar-image.h
- empathy-call-utils.c
- empathy-call-utils.h
- empathy-cell-renderer-activatable.c
- empathy-cell-renderer-activatable.h
- empathy-cell-renderer-expander.c
- empathy-cell-renderer-expander.h
- empathy-cell-renderer-text.c
- empathy-cell-renderer-text.h
- empathy-chat-text-view.c
- empathy-chat-text-view.h
- empathy-chat-view.c
- empathy-chat-view.h
- empathy-chat.c
- empathy-chat.h
- empathy-chat.ui
- empathy-contact-blocking-dialog.c
- empathy-contact-blocking-dialog.h
- empathy-contact-blocking-dialog.ui
- empathy-contact-dialogs.c
- empathy-contact-dialogs.h
- empathy-contact-dialogs.ui
- empathy-contact-list-store.c
- empathy-contact-list-store.h
- empathy-contact-list-view.c
- empathy-contact-list-view.h
- empathy-contact-menu.c
- empathy-contact-menu.h
- empathy-contact-search-dialog.c
- empathy-contact-search-dialog.h
- empathy-contact-selector-dialog.c
- empathy-contact-selector-dialog.h
- empathy-contact-selector-dialog.ui
- empathy-contact-selector.c
- empathy-contact-selector.h
- empathy-contact-widget.c
- empathy-contact-widget.h
- empathy-contact-widget.ui
- empathy-geometry.c
- empathy-geometry.h
- empathy-groups-widget.c
- empathy-groups-widget.h
- empathy-images.h
- empathy-individual-dialogs.c
- empathy-individual-dialogs.h
- empathy-individual-edit-dialog.c
- empathy-individual-edit-dialog.h
- empathy-individual-information-dialog.c
- empathy-individual-information-dialog.h
- empathy-individual-linker.c
- empathy-individual-linker.h
- empathy-individual-menu.c
- empathy-individual-menu.h
- empathy-individual-store.c
- empathy-individual-store.h
- empathy-individual-view.c
- empathy-individual-view.h
- empathy-individual-widget.c
- empathy-individual-widget.h
- empathy-individual-widget.ui
- empathy-input-text-view.c
- empathy-input-text-view.h
- empathy-irc-network-chooser-dialog.c
- empathy-irc-network-chooser-dialog.h
- empathy-irc-network-chooser.c
- empathy-irc-network-chooser.h
- empathy-irc-network-dialog.c
- empathy-irc-network-dialog.h
- empathy-linking-dialog.c
- empathy-linking-dialog.h
- empathy-live-search.c
- empathy-live-search.h
- empathy-location-manager.c
- empathy-location-manager.h
- empathy-log-window.c
- empathy-log-window.h
- empathy-log-window.ui
- empathy-new-call-dialog.c
- empathy-new-call-dialog.h
- empathy-new-message-dialog.c
- empathy-new-message-dialog.h
- empathy-notify-manager.c
- empathy-notify-manager.h
- empathy-password-dialog.c
- empathy-password-dialog.h
- empathy-persona-store.c
- empathy-persona-store.h
- empathy-persona-view.c
- empathy-persona-view.h
- empathy-plist.c
- empathy-plist.h
- empathy-presence-chooser.c
- empathy-presence-chooser.h
- empathy-protocol-chooser.c
- empathy-protocol-chooser.h
- empathy-search-bar.c
- empathy-search-bar.h
- empathy-search-bar.ui
- empathy-share-my-desktop.c
- empathy-share-my-desktop.h
- empathy-smiley-manager.c
- empathy-smiley-manager.h
- empathy-sound-manager.c
- empathy-sound-manager.h
- empathy-spell.c
- empathy-spell.h
- empathy-status-preset-dialog.c
- empathy-status-preset-dialog.h
- empathy-status-preset-dialog.ui
- empathy-string-parser.c
- empathy-string-parser.h
- empathy-theme-adium.c
- empathy-theme-adium.h
- empathy-theme-boxes.c
- empathy-theme-boxes.h
- empathy-theme-irc.c
- empathy-theme-irc.h
- empathy-theme-manager.c
- empathy-theme-manager.h
- empathy-tls-dialog.c
- empathy-tls-dialog.h
- empathy-ui-utils.c
- empathy-ui-utils.h
- Makefile.am
- Makefile.in
- totem-subtitle-encoding.c
- totem-subtitle-encoding.h
empathy-theme-irc.c @upstream/3.1.3 — raw · history · blame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Copyright (C) 2007 Imendio AB * Copyright (C) 2008 Collabora Ltd. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA * * Authors: Xavier Claessens <xclaesse@gmail.com> */ #include "config.h" #include <glib/gi18n-lib.h> #include <libempathy/empathy-utils.h> #include "empathy-theme-irc.h" #include "empathy-ui-utils.h" #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyThemeIrc) typedef struct { gpointer dummy; } EmpathyThemeIrcPriv; G_DEFINE_TYPE (EmpathyThemeIrc, empathy_theme_irc, EMPATHY_TYPE_CHAT_TEXT_VIEW); static void theme_irc_create_tags (EmpathyThemeIrc *theme) { GtkTextBuffer *buffer; buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (theme)); gtk_text_buffer_create_tag (buffer, EMPATHY_THEME_IRC_TAG_NICK_SELF, NULL); gtk_text_buffer_create_tag (buffer, EMPATHY_THEME_IRC_TAG_NICK_OTHER, NULL); gtk_text_buffer_create_tag (buffer, EMPATHY_THEME_IRC_TAG_NICK_HIGHLIGHT, NULL); } static void theme_irc_append_message (EmpathyChatTextView *view, EmpathyMessage *message) { GtkTextBuffer *buffer; const gchar *name; const gchar *nick_tag; GtkTextIter iter; gchar *tmp; EmpathyContact *contact; buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); contact = empathy_message_get_sender (message); name = empathy_contact_get_alias (contact); if (empathy_message_get_tptype (message) == TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION) { tmp = g_strdup_printf (" * %s %s", empathy_contact_get_alias (contact), empathy_message_get_body (message)); empathy_chat_text_view_append_body (view, tmp, EMPATHY_CHAT_TEXT_VIEW_TAG_ACTION); g_free (tmp); return; } if (empathy_contact_is_user (contact)) { nick_tag = EMPATHY_THEME_IRC_TAG_NICK_SELF; } else { if (empathy_message_should_highlight (message)) { nick_tag = EMPATHY_THEME_IRC_TAG_NICK_HIGHLIGHT; } else { nick_tag = EMPATHY_THEME_IRC_TAG_NICK_OTHER; } } gtk_text_buffer_get_end_iter (buffer, &iter); /* The nickname. */ tmp = g_strdup_printf ("%s: ", name); gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, tmp, -1, "cut", nick_tag, NULL); g_free (tmp); /* The text body. */ empathy_chat_text_view_append_body (view, empathy_message_get_body (message), EMPATHY_CHAT_TEXT_VIEW_TAG_BODY); } static void empathy_theme_irc_class_init (EmpathyThemeIrcClass *class) { GObjectClass *object_class; EmpathyChatTextViewClass *chat_text_view_class; object_class = G_OBJECT_CLASS (class); chat_text_view_class = EMPATHY_CHAT_TEXT_VIEW_CLASS (class); chat_text_view_class->append_message = theme_irc_append_message; g_type_class_add_private (object_class, sizeof (EmpathyThemeIrcPriv)); } static void empathy_theme_irc_init (EmpathyThemeIrc *theme) { EmpathyThemeIrcPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (theme, EMPATHY_TYPE_THEME_IRC, EmpathyThemeIrcPriv); theme->priv = priv; theme_irc_create_tags (theme); /* Define margin */ g_object_set (theme, "left-margin", 3, "right-margin", 3, NULL); } EmpathyThemeIrc * empathy_theme_irc_new (void) { return g_object_new (EMPATHY_TYPE_THEME_IRC, NULL); } |