diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-02 21:40:16 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-02 21:56:38 +0800 |
commit | 87f41f93a0c79b428e0eff6f9f843fce005b82ae (patch) | |
tree | 794474b3a25b6901cb5e8f942805774a52f13198 /libempathy-gtk | |
parent | 7f2b924f50433a6240bb8feaf95b423cb6124b12 (diff) | |
download | gsoc2013-empathy-87f41f93a0c79b428e0eff6f9f843fce005b82ae.tar gsoc2013-empathy-87f41f93a0c79b428e0eff6f9f843fce005b82ae.tar.gz gsoc2013-empathy-87f41f93a0c79b428e0eff6f9f843fce005b82ae.tar.bz2 gsoc2013-empathy-87f41f93a0c79b428e0eff6f9f843fce005b82ae.tar.lz gsoc2013-empathy-87f41f93a0c79b428e0eff6f9f843fce005b82ae.tar.xz gsoc2013-empathy-87f41f93a0c79b428e0eff6f9f843fce005b82ae.tar.zst gsoc2013-empathy-87f41f93a0c79b428e0eff6f9f843fce005b82ae.zip |
Stop using EmpathyChatView
https://bugzilla.gnome.org/show_bug.cgi?id=679255
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 66 | ||||
-rw-r--r-- | libempathy-gtk/empathy-chat.h | 4 | ||||
-rw-r--r-- | libempathy-gtk/empathy-search-bar.c | 18 | ||||
-rw-r--r-- | libempathy-gtk/empathy-search-bar.h | 4 | ||||
-rw-r--r-- | libempathy-gtk/empathy-theme-adium.c | 146 | ||||
-rw-r--r-- | libempathy-gtk/empathy-theme-adium.h | 56 | ||||
-rw-r--r-- | libempathy-gtk/empathy-theme-manager.c | 5 | ||||
-rw-r--r-- | libempathy-gtk/empathy-theme-manager.h | 4 | ||||
-rw-r--r-- | libempathy-gtk/empathy-webkit-utils.c | 3 |
9 files changed, 160 insertions, 146 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index e638bc394..d6e462725 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -724,7 +724,7 @@ chat_command_msg_cb (GObject *source, DEBUG ("Failed to get channel: %s", error->message); g_error_free (error); - empathy_chat_view_append_event (data->chat->view, + empathy_theme_adium_append_event (data->chat->view, _("Failed to open private chat")); goto OUT; } @@ -772,7 +772,7 @@ static void chat_command_clear (EmpathyChat *chat, GStrv strv) { - empathy_chat_view_clear (chat->view); + empathy_theme_adium_clear (chat->view); } static void @@ -782,13 +782,13 @@ chat_command_topic (EmpathyChat *chat, EmpathyChatPriv *priv = GET_PRIV (chat); if (!empathy_tp_chat_supports_subject (priv->tp_chat)) { - empathy_chat_view_append_event (chat->view, + empathy_theme_adium_append_event (chat->view, _("Topic not supported on this conversation")); return; } if (!empathy_tp_chat_can_set_subject (priv->tp_chat)) { - empathy_chat_view_append_event (chat->view, + empathy_theme_adium_append_event (chat->view, _("You are not allowed to change the topic")); return; } @@ -965,7 +965,7 @@ whois_got_contact_cb (GObject *source, EMPATHY_CLIENT_FACTORY (source), result, NULL); if (contact == NULL) { - empathy_chat_view_append_event (chat->view, _("Invalid contact ID")); + empathy_theme_adium_append_event (chat->view, _("Invalid contact ID")); goto out; } @@ -1110,7 +1110,7 @@ chat_command_show_help (EmpathyChat *chat, } str = g_strdup_printf (_("Usage: %s"), _(item->help)); - empathy_chat_view_append_event (chat->view, str); + empathy_theme_adium_append_event (chat->view, str); g_free (str); } @@ -1132,7 +1132,7 @@ chat_command_help (EmpathyChat *chat, if (commands[i].help == NULL) { continue; } - empathy_chat_view_append_event (chat->view, + empathy_theme_adium_append_event (chat->view, _(commands[i].help)); } return; @@ -1153,7 +1153,7 @@ chat_command_help (EmpathyChat *chat, } } - empathy_chat_view_append_event (chat->view, + empathy_theme_adium_append_event (chat->view, _("Unknown command")); } @@ -1279,7 +1279,7 @@ chat_send (EmpathyChat *chat, } if (!second_slash) { - empathy_chat_view_append_event (chat->view, + empathy_theme_adium_append_event (chat->view, _("Unknown command; see /help for the available" " commands")); return; @@ -1475,7 +1475,7 @@ chat_message_received (EmpathyChat *chat, empathy_message_get_supersedes (message), empathy_message_get_body (message)); - empathy_chat_view_edit_message (chat->view, message); + empathy_theme_adium_edit_message (chat->view, message); } else { gboolean should_highlight = chat_should_highlight (chat, message); @@ -1488,7 +1488,7 @@ chat_message_received (EmpathyChat *chat, empathy_contact_get_alias (sender), empathy_contact_get_handle (sender)); - empathy_chat_view_append_message (chat->view, message, should_highlight); + empathy_theme_adium_append_message (chat->view, message, should_highlight); if (empathy_message_is_incoming (message)) { priv->unread_messages++; @@ -1521,7 +1521,7 @@ chat_message_acknowledged_cb (EmpathyTpChat *tp_chat, { EmpathyChatPriv *priv = GET_PRIV (chat); - empathy_chat_view_message_acknowledged (chat->view, + empathy_theme_adium_message_acknowledged (chat->view, message); if (!empathy_message_is_edit (message)) { @@ -1567,9 +1567,9 @@ append_balance_error (EmpathyChat *chat, } if (str_markup != NULL) - empathy_chat_view_append_event_markup (chat->view, str_markup, str); + empathy_theme_adium_append_event_markup (chat->view, str_markup, str); else - empathy_chat_view_append_event (chat->view, str); + empathy_theme_adium_append_event (chat->view, str); g_free (str); g_free (str_markup); @@ -1625,7 +1625,7 @@ chat_send_error_cb (EmpathyTpChat *tp_chat, str = g_strdup_printf (_("Error sending message: %s"), error); } - empathy_chat_view_append_event (chat->view, str); + empathy_theme_adium_append_event (chat->view, str); g_free (str); } @@ -1705,7 +1705,7 @@ chat_subject_changed_cb (EmpathyChat *chat) } if (str != NULL) { - empathy_chat_view_append_event (EMPATHY_CHAT (chat)->view, str); + empathy_theme_adium_append_event (EMPATHY_CHAT (chat)->view, str); g_free (str); } } @@ -2028,7 +2028,7 @@ chat_input_key_press_event_cb (GtkWidget *widget, g_string_append (message, empathy_contact_get_alias (l->data)); g_string_append (message, " - "); } - empathy_chat_view_append_event (chat->view, message->str); + empathy_theme_adium_append_event (chat->view, message->str); g_string_free (message, TRUE); } @@ -2089,7 +2089,7 @@ chat_input_has_focus_notify_cb (GtkWidget *widget, GParamSpec *pspec, EmpathyChat *chat) { - empathy_chat_view_focus_toggled (chat->view, gtk_widget_has_focus (widget)); + empathy_theme_adium_focus_toggled (chat->view, gtk_widget_has_focus (widget)); } static void @@ -2572,7 +2572,7 @@ got_filtered_messages_cb (GObject *manager, if (!tpl_log_manager_get_filtered_events_finish (TPL_LOG_MANAGER (manager), result, &messages, &error)) { DEBUG ("%s. Aborting.", error->message); - empathy_chat_view_append_event (chat->view, + empathy_theme_adium_append_event (chat->view, _("Failed to retrieve recent logs")); g_error_free (error); goto out; @@ -2603,14 +2603,14 @@ got_filtered_messages_cb (GObject *manager, "sender", empathy_message_get_sender (message), NULL); - empathy_chat_view_append_message (chat->view, syn_msg, + empathy_theme_adium_append_message (chat->view, syn_msg, chat_should_highlight (chat, syn_msg)); - empathy_chat_view_edit_message (chat->view, message); + empathy_theme_adium_edit_message (chat->view, message); g_object_unref (syn_msg); } else { /* append the latest message */ - empathy_chat_view_append_message (chat->view, message, + empathy_theme_adium_append_message (chat->view, message, chat_should_highlight (chat, message)); } @@ -2629,7 +2629,7 @@ out: empathy_chat_messages_read (chat); /* Turn back on scrolling */ - empathy_chat_view_scroll (chat->view, TRUE); + empathy_theme_adium_scroll (chat->view, TRUE); g_object_unref (chat); tp_weak_ref_destroy (wr); @@ -2647,7 +2647,7 @@ chat_add_logs (EmpathyChat *chat) } /* Turn off scrolling temporarily */ - empathy_chat_view_scroll (chat->view, FALSE); + empathy_theme_adium_scroll (chat->view, FALSE); /* Add messages from last conversation */ if (priv->handle_type == TP_HANDLE_TYPE_ROOM) @@ -2782,7 +2782,7 @@ chat_members_changed_cb (EmpathyTpChat *tp_chat, str = build_part_message (reason, name, actor, message); } - empathy_chat_view_append_event (chat->view, str); + empathy_theme_adium_append_event (chat->view, str); g_free (str); } @@ -2804,7 +2804,7 @@ chat_member_renamed_cb (EmpathyTpChat *tp_chat, str = g_strdup_printf (_("%s is now known as %s"), empathy_contact_get_alias (old_contact), empathy_contact_get_alias (new_contact)); - empathy_chat_view_append_event (chat->view, str); + empathy_theme_adium_append_event (chat->view, str); g_free (str); } @@ -2988,7 +2988,7 @@ chat_invalidated_cb (EmpathyTpChat *tp_chat, priv->tp_chat = NULL; g_object_notify (G_OBJECT (chat), "tp-chat"); - empathy_chat_view_append_event (chat->view, _("Disconnected")); + empathy_theme_adium_append_event (chat->view, _("Disconnected")); gtk_widget_set_sensitive (chat->input_text_view, FALSE); chat_update_contacts_visibility (chat, FALSE); @@ -3345,7 +3345,7 @@ chat_constructed (GObject *object) tp_proxy_has_interface_by_id (conn, TP_IFACE_QUARK_CONNECTION_INTERFACE_AVATARS); - empathy_chat_view_set_show_avatars (chat->view, + empathy_theme_adium_set_show_avatars (chat->view, supports_avatars); } @@ -4076,7 +4076,7 @@ empathy_chat_set_tp_chat (EmpathyChat *chat, if (chat->input_text_view) { gtk_widget_set_sensitive (chat->input_text_view, TRUE); if (priv->block_events_timeout_id == 0) { - empathy_chat_view_append_event (chat->view, _("Connected")); + empathy_theme_adium_append_event (chat->view, _("Connected")); } } @@ -4199,7 +4199,7 @@ empathy_chat_clear (EmpathyChat *chat) { g_return_if_fail (EMPATHY_IS_CHAT (chat)); - empathy_chat_view_clear (chat->view); + empathy_theme_adium_clear (chat->view); } void @@ -4207,7 +4207,7 @@ empathy_chat_scroll_down (EmpathyChat *chat) { g_return_if_fail (EMPATHY_IS_CHAT (chat)); - empathy_chat_view_scroll_down (chat->view); + empathy_theme_adium_scroll_down (chat->view); } void @@ -4230,10 +4230,10 @@ empathy_chat_cut (EmpathyChat *chat) static gboolean copy_from_chat_view (EmpathyChat *chat) { - if (!empathy_chat_view_get_has_selection (chat->view)) + if (!empathy_theme_adium_get_has_selection (chat->view)) return FALSE; - empathy_chat_view_copy_clipboard (chat->view); + empathy_theme_adium_copy_clipboard (chat->view); return TRUE; } diff --git a/libempathy-gtk/empathy-chat.h b/libempathy-gtk/empathy-chat.h index 00da3d641..d81b56f48 100644 --- a/libempathy-gtk/empathy-chat.h +++ b/libempathy-gtk/empathy-chat.h @@ -34,7 +34,7 @@ #include <libempathy/empathy-message.h> #include <libempathy/empathy-tp-chat.h> -#include "empathy-chat-view.h" +#include <libempathy-gtk/empathy-theme-adium.h> G_BEGIN_DECLS @@ -54,7 +54,7 @@ struct _EmpathyChat { EmpathyChatPriv *priv; /* Protected */ - EmpathyChatView *view; + EmpathyThemeAdium *view; GtkWidget *input_text_view; }; diff --git a/libempathy-gtk/empathy-search-bar.c b/libempathy-gtk/empathy-search-bar.c index d23380d4d..769276b13 100644 --- a/libempathy-gtk/empathy-search-bar.c +++ b/libempathy-gtk/empathy-search-bar.c @@ -27,7 +27,7 @@ #include <libempathy/empathy-utils.h> -#include "empathy-chat-view.h" +#include "empathy-theme-adium.h" #include "empathy-search-bar.h" #include "empathy-ui-utils.h" @@ -38,7 +38,7 @@ G_DEFINE_TYPE (EmpathySearchBar, empathy_search_bar, GTK_TYPE_BOX); typedef struct _EmpathySearchBarPriv EmpathySearchBarPriv; struct _EmpathySearchBarPriv { - EmpathyChatView *chat_view; + EmpathyThemeAdium *chat_view; GtkWidget *search_entry; @@ -53,7 +53,7 @@ struct _EmpathySearchBarPriv }; GtkWidget * -empathy_search_bar_new (EmpathyChatView *view) +empathy_search_bar_new (EmpathyThemeAdium *view) { EmpathySearchBar *self = g_object_new (EMPATHY_TYPE_SEARCH_BAR, NULL); @@ -73,7 +73,7 @@ empathy_search_bar_update_buttons (EmpathySearchBar *self, EmpathySearchBarPriv* priv = GET_PRIV (self); /* update previous / next buttons */ - empathy_chat_view_find_abilities (priv->chat_view, search, match_case, + empathy_theme_adium_find_abilities (priv->chat_view, search, match_case, &can_go_backward, &can_go_forward); gtk_widget_set_sensitive (priv->search_previous, @@ -94,7 +94,7 @@ empathy_search_bar_update (EmpathySearchBar *self) GTK_TOGGLE_BUTTON (priv->search_match_case)); /* highlight & search */ - empathy_chat_view_highlight (priv->chat_view, search, match_case); + empathy_theme_adium_highlight (priv->chat_view, search, match_case); /* update the buttons */ empathy_search_bar_update_buttons (self, search, match_case); @@ -121,7 +121,7 @@ empathy_search_bar_hide (EmpathySearchBar *self) { EmpathySearchBarPriv *priv = GET_PRIV (self); - empathy_chat_view_highlight (priv->chat_view, "", FALSE); + empathy_theme_adium_highlight (priv->chat_view, "", FALSE); gtk_widget_hide (GTK_WIDGET (self)); /* give the focus back to the focus-chain with the chat view */ @@ -145,17 +145,17 @@ empathy_search_bar_search (EmpathySearchBar *self, GTK_TOGGLE_BUTTON (priv->search_match_case)); /* highlight & search */ - empathy_chat_view_highlight (priv->chat_view, search, match_case); + empathy_theme_adium_highlight (priv->chat_view, search, match_case); if (next) { - found = empathy_chat_view_find_next (priv->chat_view, + found = empathy_theme_adium_find_next (priv->chat_view, search, new_search, match_case); } else { - found = empathy_chat_view_find_previous (priv->chat_view, + found = empathy_theme_adium_find_previous (priv->chat_view, search, new_search, match_case); diff --git a/libempathy-gtk/empathy-search-bar.h b/libempathy-gtk/empathy-search-bar.h index 4b07f92c2..afda250b2 100644 --- a/libempathy-gtk/empathy-search-bar.h +++ b/libempathy-gtk/empathy-search-bar.h @@ -23,7 +23,7 @@ #include <glib.h> #include <glib-object.h> -#include "empathy-chat-view.h" +#include "empathy-theme-adium.h" G_BEGIN_DECLS @@ -56,7 +56,7 @@ struct _EmpathySearchBarClass }; GType empathy_search_bar_get_type (void) G_GNUC_CONST; -GtkWidget * empathy_search_bar_new (EmpathyChatView *view); +GtkWidget * empathy_search_bar_new (EmpathyThemeAdium *view); void empathy_search_bar_show (EmpathySearchBar *searchbar); void empathy_search_bar_hide (EmpathySearchBar *searchbar); void empathy_search_bar_paste_clipboard (EmpathySearchBar *searchbar); diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c index c00e38298..5cd306520 100644 --- a/libempathy-gtk/empathy-theme-adium.c +++ b/libempathy-gtk/empathy-theme-adium.c @@ -108,8 +108,6 @@ struct _EmpathyAdiumData GPtrArray *strings_to_free; }; -static void theme_adium_iface_init (EmpathyChatViewIface *iface); - static gchar * adium_info_dup_path_for_variant (GHashTable *info, const gchar *variant); @@ -120,10 +118,8 @@ enum PROP_VARIANT, }; -G_DEFINE_TYPE_WITH_CODE (EmpathyThemeAdium, empathy_theme_adium, - WEBKIT_TYPE_WEB_VIEW, - G_IMPLEMENT_INTERFACE (EMPATHY_TYPE_CHAT_VIEW, - theme_adium_iface_init)); +G_DEFINE_TYPE (EmpathyThemeAdium, empathy_theme_adium, + WEBKIT_TYPE_WEB_VIEW) enum { @@ -746,11 +742,9 @@ theme_adium_append_html (EmpathyThemeAdium *self, } static void -theme_adium_append_event_escaped (EmpathyChatView *view, +theme_adium_append_event_escaped (EmpathyThemeAdium *self, const gchar *escaped) { - EmpathyThemeAdium *self = EMPATHY_THEME_ADIUM (view); - theme_adium_append_html (self, "appendMessage", self->priv->data->status_html, escaped, NULL, NULL, NULL, NULL, "event", empathy_time_get_current (), FALSE, FALSE); @@ -837,12 +831,11 @@ theme_adium_remove_all_focus_marks (EmpathyThemeAdium *self) theme_adium_remove_focus_marks (self, nodes); } -static void -theme_adium_append_message (EmpathyChatView *view, +void +empathy_theme_adium_append_message (EmpathyThemeAdium *self, EmpathyMessage *msg, gboolean should_highlight) { - EmpathyThemeAdium *self = EMPATHY_THEME_ADIUM (view); EmpathyContact *sender; TpMessage *tp_msg; TpAccount *account; @@ -1050,11 +1043,10 @@ theme_adium_append_message (EmpathyChatView *view, g_string_free (message_classes, TRUE); } -static void -theme_adium_append_event (EmpathyChatView *view, +void +empathy_theme_adium_append_event (EmpathyThemeAdium *self, const gchar *str) { - EmpathyThemeAdium *self = EMPATHY_THEME_ADIUM (view); gchar *str_escaped; if (self->priv->pages_loading != 0) @@ -1064,23 +1056,22 @@ theme_adium_append_event (EmpathyChatView *view, } str_escaped = g_markup_escape_text (str, -1); - theme_adium_append_event_escaped (view, str_escaped); + theme_adium_append_event_escaped (self, str_escaped); g_free (str_escaped); } -static void -theme_adium_append_event_markup (EmpathyChatView *view, +void +empathy_theme_adium_append_event_markup (EmpathyThemeAdium *self, const gchar *markup_text, const gchar *fallback_text) { - theme_adium_append_event_escaped (view, markup_text); + theme_adium_append_event_escaped (self, markup_text); } -static void -theme_adium_edit_message (EmpathyChatView *view, +void +empathy_theme_adium_edit_message (EmpathyThemeAdium *self, EmpathyMessage *message) { - EmpathyThemeAdium *self = EMPATHY_THEME_ADIUM (view); WebKitDOMDocument *doc; WebKitDOMElement *span; gchar *id, *parsed_body; @@ -1098,11 +1089,11 @@ theme_adium_edit_message (EmpathyChatView *view, empathy_message_get_supersedes (message)); /* we don't pass a token here, because doing so will return another * <span> element, and we don't want nested <span> elements */ - parsed_body = theme_adium_parse_body (EMPATHY_THEME_ADIUM (view), + parsed_body = theme_adium_parse_body (self, empathy_message_get_body (message), NULL); /* find the element */ - doc = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (view)); + doc = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (self)); span = webkit_dom_document_get_element_by_id (doc, id); if (span == NULL) @@ -1180,36 +1171,32 @@ finally: g_free (parsed_body); } -static void -theme_adium_scroll (EmpathyChatView *view, +void +empathy_theme_adium_scroll (EmpathyThemeAdium *self, gboolean allow_scrolling) { - EmpathyThemeAdium *self = EMPATHY_THEME_ADIUM (view); - self->priv->allow_scrolling = allow_scrolling; if (allow_scrolling) - empathy_chat_view_scroll_down (view); + empathy_theme_adium_scroll_down (self); } -static void -theme_adium_scroll_down (EmpathyChatView *view) +void +empathy_theme_adium_scroll_down (EmpathyThemeAdium *self) { - webkit_web_view_execute_script (WEBKIT_WEB_VIEW (view), "alignChat(true);"); + webkit_web_view_execute_script (WEBKIT_WEB_VIEW (self), "alignChat(true);"); } -static gboolean -theme_adium_get_has_selection (EmpathyChatView *view) +gboolean +empathy_theme_adium_get_has_selection (EmpathyThemeAdium *self) { - return webkit_web_view_has_selection (WEBKIT_WEB_VIEW (view)); + return webkit_web_view_has_selection (WEBKIT_WEB_VIEW (self)); } -static void -theme_adium_clear (EmpathyChatView *view) +void +empathy_theme_adium_clear (EmpathyThemeAdium *self) { - EmpathyThemeAdium *self = EMPATHY_THEME_ADIUM (view); - - theme_adium_load_template (EMPATHY_THEME_ADIUM (view)); + theme_adium_load_template (self); /* Clear last contact to avoid trying to add a 'joined' * message when we don't have an insertion point. */ @@ -1220,30 +1207,30 @@ theme_adium_clear (EmpathyChatView *view) } } -static gboolean -theme_adium_find_previous (EmpathyChatView *view, +gboolean +empathy_theme_adium_find_previous (EmpathyThemeAdium *self, const gchar *search_criteria, gboolean new_search, gboolean match_case) { /* FIXME: Doesn't respect new_search */ - return webkit_web_view_search_text (WEBKIT_WEB_VIEW (view), + return webkit_web_view_search_text (WEBKIT_WEB_VIEW (self), search_criteria, match_case, FALSE, TRUE); } -static gboolean -theme_adium_find_next (EmpathyChatView *view, +gboolean +empathy_theme_adium_find_next (EmpathyThemeAdium *self, const gchar *search_criteria, gboolean new_search, gboolean match_case) { /* FIXME: Doesn't respect new_search */ - return webkit_web_view_search_text (WEBKIT_WEB_VIEW (view), + return webkit_web_view_search_text (WEBKIT_WEB_VIEW (self), search_criteria, match_case, TRUE, TRUE); } -static void -theme_adium_find_abilities (EmpathyChatView *view, +void +empathy_theme_adium_find_abilities (EmpathyThemeAdium *self, const gchar *search_criteria, gboolean match_case, gboolean *can_do_previous, @@ -1257,22 +1244,22 @@ theme_adium_find_abilities (EmpathyChatView *view, *can_do_next = TRUE; } -static void -theme_adium_highlight (EmpathyChatView *view, +void +empathy_theme_adium_highlight (EmpathyThemeAdium *self, const gchar *text, gboolean match_case) { - webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW (view)); - webkit_web_view_mark_text_matches (WEBKIT_WEB_VIEW (view), + webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW (self)); + webkit_web_view_mark_text_matches (WEBKIT_WEB_VIEW (self), text, match_case, 0); - webkit_web_view_set_highlight_text_matches (WEBKIT_WEB_VIEW (view), + webkit_web_view_set_highlight_text_matches (WEBKIT_WEB_VIEW (self), TRUE); } -static void -theme_adium_copy_clipboard (EmpathyChatView *view) +void +empathy_theme_adium_copy_clipboard (EmpathyThemeAdium *self) { - webkit_web_view_copy_clipboard (WEBKIT_WEB_VIEW (view)); + webkit_web_view_copy_clipboard (WEBKIT_WEB_VIEW (self)); } static void @@ -1315,30 +1302,27 @@ theme_adium_remove_acked_message_unread_mark_foreach (gpointer data, theme_adium_remove_mark_from_message (self, id); } -static void -theme_adium_focus_toggled (EmpathyChatView *view, +void +empathy_theme_adium_focus_toggled (EmpathyThemeAdium *self, gboolean has_focus) { - EmpathyThemeAdium *self = EMPATHY_THEME_ADIUM (view); - self->priv->has_focus = has_focus; if (!self->priv->has_focus) { /* We've lost focus, so let's make sure all the acked * messages have lost their unread marker. */ g_queue_foreach (&self->priv->acked_messages, - theme_adium_remove_acked_message_unread_mark_foreach, view); + theme_adium_remove_acked_message_unread_mark_foreach, self); g_queue_clear (&self->priv->acked_messages); self->priv->has_unread_message = FALSE; } } -static void -theme_adium_message_acknowledged (EmpathyChatView *view, +void +empathy_theme_adium_message_acknowledged (EmpathyThemeAdium *self, EmpathyMessage *message) { - EmpathyThemeAdium *self = (EmpathyThemeAdium *) view; TpMessage *tp_msg; guint32 id; gboolean valid; @@ -1397,43 +1381,19 @@ theme_adium_button_press_event (GtkWidget *widget, empathy_theme_adium_parent_class)->button_press_event (widget, event); } -static void -theme_adium_set_show_avatars (EmpathyChatView *view, +void +empathy_theme_adium_set_show_avatars (EmpathyThemeAdium *self, gboolean show_avatars) { - EmpathyThemeAdium *self = EMPATHY_THEME_ADIUM (view); - self->priv->show_avatars = show_avatars; } static void -theme_adium_iface_init (EmpathyChatViewIface *iface) -{ - iface->append_message = theme_adium_append_message; - iface->append_event = theme_adium_append_event; - iface->append_event_markup = theme_adium_append_event_markup; - iface->edit_message = theme_adium_edit_message; - iface->scroll = theme_adium_scroll; - iface->scroll_down = theme_adium_scroll_down; - iface->get_has_selection = theme_adium_get_has_selection; - iface->clear = theme_adium_clear; - iface->find_previous = theme_adium_find_previous; - iface->find_next = theme_adium_find_next; - iface->find_abilities = theme_adium_find_abilities; - iface->highlight = theme_adium_highlight; - iface->copy_clipboard = theme_adium_copy_clipboard; - iface->focus_toggled = theme_adium_focus_toggled; - iface->message_acknowledged = theme_adium_message_acknowledged; - iface->set_show_avatars = theme_adium_set_show_avatars; -} - -static void theme_adium_load_finished_cb (WebKitWebView *view, WebKitWebFrame *frame, gpointer user_data) { EmpathyThemeAdium *self = EMPATHY_THEME_ADIUM (view); - EmpathyChatView *chat_view = EMPATHY_CHAT_VIEW (view); GList *l; DEBUG ("Page loaded"); @@ -1450,16 +1410,16 @@ theme_adium_load_finished_cb (WebKitWebView *view, switch (item->type) { case QUEUED_MESSAGE: - theme_adium_append_message (chat_view, item->msg, + empathy_theme_adium_append_message (self, item->msg, item->should_highlight); break; case QUEUED_EDIT: - theme_adium_edit_message (chat_view, item->msg); + empathy_theme_adium_edit_message (self, item->msg); break; case QUEUED_EVENT: - theme_adium_append_event (chat_view, item->str); + empathy_theme_adium_append_event (self, item->str); break; } diff --git a/libempathy-gtk/empathy-theme-adium.h b/libempathy-gtk/empathy-theme-adium.h index d518c01b1..f1ad48ec8 100644 --- a/libempathy-gtk/empathy-theme-adium.h +++ b/libempathy-gtk/empathy-theme-adium.h @@ -23,7 +23,7 @@ #include <webkit/webkitwebview.h> -#include "empathy-chat-view.h" +#include <libempathy/empathy-message.h> G_BEGIN_DECLS @@ -76,6 +76,60 @@ void empathy_theme_adium_set_variant (EmpathyThemeAdium *theme, const gchar *variant); void empathy_theme_adium_show_inspector (EmpathyThemeAdium *theme); +void empathy_theme_adium_append_message (EmpathyThemeAdium *self, + EmpathyMessage *msg, + gboolean should_highlight); + +void empathy_theme_adium_append_event (EmpathyThemeAdium *self, + const gchar *str); + +void empathy_theme_adium_append_event_markup (EmpathyThemeAdium *self, + const gchar *markup_text, + const gchar *fallback_text); + +void empathy_theme_adium_edit_message (EmpathyThemeAdium *self, + EmpathyMessage *message); + +void empathy_theme_adium_scroll (EmpathyThemeAdium *self, + gboolean allow_scrolling); + +void empathy_theme_adium_scroll_down (EmpathyThemeAdium *self); + +gboolean empathy_theme_adium_get_has_selection (EmpathyThemeAdium *self); + +void empathy_theme_adium_clear (EmpathyThemeAdium *self); + +gboolean empathy_theme_adium_find_previous (EmpathyThemeAdium *self, + const gchar *search_criteria, + gboolean new_search, + gboolean match_case); + +gboolean empathy_theme_adium_find_next (EmpathyThemeAdium *self, + const gchar *search_criteria, + gboolean new_search, + gboolean match_case); + +void empathy_theme_adium_find_abilities (EmpathyThemeAdium *self, + const gchar *search_criteria, + gboolean match_case, + gboolean *can_do_previous, + gboolean *can_do_next); + +void empathy_theme_adium_highlight (EmpathyThemeAdium *self, + const gchar *text, + gboolean match_case); + +void empathy_theme_adium_copy_clipboard (EmpathyThemeAdium *self); + +void empathy_theme_adium_focus_toggled (EmpathyThemeAdium *self, + gboolean has_focus); + +void empathy_theme_adium_message_acknowledged (EmpathyThemeAdium *self, + EmpathyMessage *message); + +void empathy_theme_adium_set_show_avatars (EmpathyThemeAdium *self, + gboolean show_avatars); + /* not methods functions */ gboolean empathy_adium_path_is_valid (const gchar *path); diff --git a/libempathy-gtk/empathy-theme-manager.c b/libempathy-gtk/empathy-theme-manager.c index a74b3c823..7d21b7960 100644 --- a/libempathy-gtk/empathy-theme-manager.c +++ b/libempathy-gtk/empathy-theme-manager.c @@ -34,7 +34,6 @@ #include <libempathy/empathy-utils.h> #include "empathy-theme-manager.h" -#include "empathy-chat-view.h" #include "empathy-theme-adium.h" #define DEBUG_FLAG EMPATHY_DEBUG_OTHER @@ -189,13 +188,13 @@ theme_manager_notify_adium_variant_cb (GSettings *gsettings_chat, } } -EmpathyChatView * +EmpathyThemeAdium * empathy_theme_manager_create_view (EmpathyThemeManager *self) { g_return_val_if_fail (EMPATHY_IS_THEME_MANAGER (self), NULL); if (self->priv->adium_data != NULL) - return EMPATHY_CHAT_VIEW (theme_manager_create_adium_view (self)); + return theme_manager_create_adium_view (self); g_return_val_if_reached (NULL); } diff --git a/libempathy-gtk/empathy-theme-manager.h b/libempathy-gtk/empathy-theme-manager.h index d4d755ba0..812b02616 100644 --- a/libempathy-gtk/empathy-theme-manager.h +++ b/libempathy-gtk/empathy-theme-manager.h @@ -24,7 +24,7 @@ #define __EMPATHY_THEME_MANAGER_H__ #include <glib-object.h> -#include "empathy-chat-view.h" +#include "empathy-theme-adium.h" G_BEGIN_DECLS @@ -69,7 +69,7 @@ struct _EmpathyThemeManagerClass GType empathy_theme_manager_get_type (void) G_GNUC_CONST; EmpathyThemeManager * empathy_theme_manager_dup_singleton (void); GList * empathy_theme_manager_get_adium_themes (void); -EmpathyChatView * empathy_theme_manager_create_view (EmpathyThemeManager *self); +EmpathyThemeAdium * empathy_theme_manager_create_view (EmpathyThemeManager *self); gchar * empathy_theme_manager_find_theme (const gchar *name); gchar * empathy_theme_manager_dup_theme_name_from_path (const gchar *path); diff --git a/libempathy-gtk/empathy-webkit-utils.c b/libempathy-gtk/empathy-webkit-utils.c index cac9af9d8..8be551af8 100644 --- a/libempathy-gtk/empathy-webkit-utils.c +++ b/libempathy-gtk/empathy-webkit-utils.c @@ -25,6 +25,7 @@ #include "empathy-webkit-utils.h" #include "empathy-smiley-manager.h" #include "empathy-ui-utils.h" +#include "empathy-theme-adium.h" #define BORING_DPI_DEFAULT 96 @@ -261,7 +262,7 @@ empathy_webkit_context_menu_for_event (WebKitWebView *view, gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item); g_signal_connect_swapped (item, "activate", - G_CALLBACK (empathy_chat_view_clear), + G_CALLBACK (empathy_theme_adium_clear), view); } |