diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2007-12-29 23:49:21 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2007-12-29 23:49:21 +0800 |
commit | 98d76879d49bbe8acddaa0b3f056ea556bda6b70 (patch) | |
tree | d3a4656697bfc1aed894dc89011a3e5f1e91f899 /libempathy-gtk/empathy-theme.c | |
parent | 9c0af71c275a1e1a1fcbec99b90ab62acfecf67a (diff) | |
download | gsoc2013-empathy-98d76879d49bbe8acddaa0b3f056ea556bda6b70.tar gsoc2013-empathy-98d76879d49bbe8acddaa0b3f056ea556bda6b70.tar.gz gsoc2013-empathy-98d76879d49bbe8acddaa0b3f056ea556bda6b70.tar.bz2 gsoc2013-empathy-98d76879d49bbe8acddaa0b3f056ea556bda6b70.tar.lz gsoc2013-empathy-98d76879d49bbe8acddaa0b3f056ea556bda6b70.tar.xz gsoc2013-empathy-98d76879d49bbe8acddaa0b3f056ea556bda6b70.tar.zst gsoc2013-empathy-98d76879d49bbe8acddaa0b3f056ea556bda6b70.zip |
Simplify chat theme system
svn path=/trunk/; revision=507
Diffstat (limited to 'libempathy-gtk/empathy-theme.c')
-rw-r--r-- | libempathy-gtk/empathy-theme.c | 87 |
1 files changed, 13 insertions, 74 deletions
diff --git a/libempathy-gtk/empathy-theme.c b/libempathy-gtk/empathy-theme.c index c465ae69a..1895b8ccb 100644 --- a/libempathy-gtk/empathy-theme.c +++ b/libempathy-gtk/empathy-theme.c @@ -31,7 +31,6 @@ #include "empathy-chat.h" #include "empathy-preferences.h" -#include "empathy-theme-utils.h" #include "empathy-theme.h" #include "empathy-smiley-manager.h" @@ -67,13 +66,6 @@ enum { PROP_SHOW_AVATARS }; -enum { - UPDATED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - static void empathy_theme_class_init (EmpathyThemeClass *class) { @@ -85,8 +77,7 @@ empathy_theme_class_init (EmpathyThemeClass *class) object_class->get_property = theme_get_property; object_class->set_property = theme_set_property; - class->setup_with_view = NULL; - class->view_cleared = NULL; + class->update_view = NULL; class->append_message = NULL; class->append_event = NULL; class->append_timestamp = NULL; @@ -99,16 +90,6 @@ empathy_theme_class_init (EmpathyThemeClass *class) TRUE, G_PARAM_READWRITE)); - signals[UPDATED] = - g_signal_new ("updated", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_LAST, - 0, - NULL, NULL, - empathy_marshal_VOID__VOID, - G_TYPE_NONE, - 0); - g_type_class_add_private (object_class, sizeof (EmpathyThemePriv)); } @@ -168,7 +149,8 @@ theme_set_property (GObject *object, switch (param_id) { case PROP_SHOW_AVATARS: - priv->show_avatars = g_value_get_boolean (value); + empathy_theme_set_show_avatars (EMPATHY_THEME (object), + g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); @@ -178,7 +160,6 @@ theme_set_property (GObject *object, void empathy_theme_maybe_append_date_and_time (EmpathyTheme *theme, - EmpathyThemeContext *context, EmpathyChatView *view, EmpathyMessage *message) { @@ -207,61 +188,24 @@ empathy_theme_maybe_append_date_and_time (EmpathyTheme *theme, } if (append_time || append_date) { - empathy_theme_append_timestamp (theme, context, - view, message, + empathy_theme_append_timestamp (theme, view, message, append_date, append_time); } } -EmpathyTheme * -empathy_theme_new (void) -{ - EmpathyTheme *theme; - - theme = g_object_new (EMPATHY_TYPE_THEME, NULL); - - return theme; -} - -EmpathyThemeContext * -empathy_theme_setup_with_view (EmpathyTheme *theme, - EmpathyChatView *view) -{ - if (!EMPATHY_THEME_GET_CLASS(theme)->setup_with_view) { - g_error ("Theme must override setup_with_view"); - } - - return EMPATHY_THEME_GET_CLASS(theme)->setup_with_view (theme, view); -} - void -empathy_theme_detach_from_view (EmpathyTheme *theme, - EmpathyThemeContext *context, - EmpathyChatView *view) +empathy_theme_update_view (EmpathyTheme *theme, + EmpathyChatView *view) { - if (!EMPATHY_THEME_GET_CLASS(theme)->detach_from_view) { - g_error ("Theme must override detach_from_view"); - } - - return EMPATHY_THEME_GET_CLASS(theme)->detach_from_view (theme, context, - view); -} - -void -empathy_theme_view_cleared (EmpathyTheme *theme, - EmpathyThemeContext *context, - EmpathyChatView *view) -{ - if (!EMPATHY_THEME_GET_CLASS(theme)->view_cleared) { - return; + if (!EMPATHY_THEME_GET_CLASS(theme)->update_view) { + g_error ("Theme must override update_view"); } - EMPATHY_THEME_GET_CLASS(theme)->view_cleared (theme, context, view); + return EMPATHY_THEME_GET_CLASS(theme)->update_view (theme, view); } void empathy_theme_append_message (EmpathyTheme *theme, - EmpathyThemeContext *context, EmpathyChatView *view, EmpathyMessage *message) { @@ -270,8 +214,7 @@ empathy_theme_append_message (EmpathyTheme *theme, return; } - EMPATHY_THEME_GET_CLASS(theme)->append_message (theme, context, view, - message); + EMPATHY_THEME_GET_CLASS(theme)->append_message (theme, view, message); } static void @@ -309,7 +252,6 @@ theme_insert_text_with_emoticons (GtkTextBuffer *buf, void empathy_theme_append_text (EmpathyTheme *theme, - EmpathyThemeContext *context, EmpathyChatView *view, const gchar *body, const gchar *tag, @@ -410,7 +352,6 @@ empathy_theme_append_text (EmpathyTheme *theme, void empathy_theme_append_event (EmpathyTheme *theme, - EmpathyThemeContext *context, EmpathyChatView *view, const gchar *str) { @@ -418,25 +359,23 @@ empathy_theme_append_event (EmpathyTheme *theme, return; } - EMPATHY_THEME_GET_CLASS(theme)->append_event (theme, context, view, str); + EMPATHY_THEME_GET_CLASS(theme)->append_event (theme, view, str); } void empathy_theme_append_spacing (EmpathyTheme *theme, - EmpathyThemeContext *context, EmpathyChatView *view) { if (!EMPATHY_THEME_GET_CLASS(theme)->append_spacing) { return; } - EMPATHY_THEME_GET_CLASS(theme)->append_spacing (theme, context, view); + EMPATHY_THEME_GET_CLASS(theme)->append_spacing (theme, view); } void empathy_theme_append_timestamp (EmpathyTheme *theme, - EmpathyThemeContext *context, EmpathyChatView *view, EmpathyMessage *message, gboolean show_date, @@ -446,7 +385,7 @@ empathy_theme_append_timestamp (EmpathyTheme *theme, return; } - EMPATHY_THEME_GET_CLASS(theme)->append_timestamp (theme, context, view, + EMPATHY_THEME_GET_CLASS(theme)->append_timestamp (theme, view, message, show_date, show_time); } |