1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2007 Imendio AB
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
25 #include <glib/gi18n.h>
28 #include <libempathy/empathy-debug.h>
30 #include "empathy-ui-utils.h"
31 #include "empathy-main-window.h"
32 #include "empathy-theme-utils.h"
33 #include "empathy-theme-boxes.h"
35 #define DEBUG_DOMAIN "FancyTheme"
38 #define HEADER_PADDING 2
40 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_THEME_BOXES, EmpathyThemeBoxesPriv))
42 typedef struct _EmpathyThemeBoxesPriv EmpathyThemeBoxesPriv;
44 struct _EmpathyThemeBoxesPriv {
45 gchar *header_foreground;
46 gchar *header_background;
47 gchar *header_line_background;
48 gchar *text_foreground;
49 gchar *text_background;
50 gchar *action_foreground;
51 gchar *highlight_foreground;
52 gchar *time_foreground;
53 gchar *event_foreground;
54 gchar *invite_foreground;
55 gchar *link_foreground;
58 static void theme_boxes_finalize (GObject *object);
59 static void theme_boxes_get_property (GObject *object,
63 static void theme_boxes_set_property (GObject *object,
67 static void theme_boxes_define_theme_tags (EmpathyTheme *theme,
68 EmpathyChatView *view);
69 static EmpathyThemeContext *
70 theme_boxes_setup_with_view (EmpathyTheme *theme,
71 EmpathyChatView *view);
72 static void theme_boxes_detach_from_view (EmpathyTheme *theme,
73 EmpathyThemeContext *context,
74 EmpathyChatView *view);
75 static void theme_boxes_view_cleared (EmpathyTheme *theme,
76 EmpathyThemeContext *context,
77 EmpathyChatView *view);
79 static void theme_boxes_append_message (EmpathyTheme *theme,
80 EmpathyThemeContext *context,
81 EmpathyChatView *view,
82 EmpathyMessage *message);
83 static void theme_boxes_append_event (EmpathyTheme *theme,
84 EmpathyThemeContext *context,
85 EmpathyChatView *view,
87 static void theme_boxes_append_timestamp (EmpathyTheme *theme,
88 EmpathyThemeContext *context,
89 EmpathyChatView *view,
90 EmpathyMessage *message,
93 static void theme_boxes_append_spacing (EmpathyTheme *theme,
94 EmpathyThemeContext *context,
95 EmpathyChatView *view);
99 PROP_HEADER_FOREGROUND,
100 PROP_HEADER_BACKGROUND,
101 PROP_HEADER_LINE_BACKGROUND,
102 PROP_TEXT_FOREGROUND,
103 PROP_TEXT_BACKGROUND,
104 PROP_ACTION_FOREGROUND,
105 PROP_HIGHLIGHT_FOREGROUND,
106 PROP_TIME_FOREGROUND,
107 PROP_EVENT_FOREGROUND,
108 PROP_INVITE_FOREGROUND,
117 G_DEFINE_TYPE (EmpathyThemeBoxes, empathy_theme_boxes, EMPATHY_TYPE_THEME);
120 empathy_theme_boxes_class_init (EmpathyThemeBoxesClass *class)
122 GObjectClass *object_class;
123 EmpathyThemeClass *theme_class;
125 object_class = G_OBJECT_CLASS (class);
126 theme_class = EMPATHY_THEME_CLASS (class);
128 object_class->finalize = theme_boxes_finalize;
129 object_class->get_property = theme_boxes_get_property;
130 object_class->set_property = theme_boxes_set_property;
132 theme_class->setup_with_view = theme_boxes_setup_with_view;
133 theme_class->detach_from_view = theme_boxes_detach_from_view;
134 theme_class->view_cleared = theme_boxes_view_cleared;
135 theme_class->append_message = theme_boxes_append_message;
136 theme_class->append_event = theme_boxes_append_event;
137 theme_class->append_timestamp = theme_boxes_append_timestamp;
138 theme_class->append_spacing = theme_boxes_append_spacing;
140 g_object_class_install_property (object_class,
141 PROP_HEADER_FOREGROUND,
142 g_param_spec_string ("header-foreground",
148 g_object_class_install_property (object_class,
149 PROP_HEADER_BACKGROUND,
150 g_param_spec_string ("header-background",
156 g_object_class_install_property (object_class,
157 PROP_HEADER_LINE_BACKGROUND,
158 g_param_spec_string ("header-line-background",
165 g_object_class_install_property (object_class,
166 PROP_TEXT_FOREGROUND,
167 g_param_spec_string ("text-foreground",
173 g_object_class_install_property (object_class,
174 PROP_TEXT_BACKGROUND,
175 g_param_spec_string ("text-background",
181 g_object_class_install_property (object_class,
182 PROP_ACTION_FOREGROUND,
183 g_param_spec_string ("action-foreground",
189 g_object_class_install_property (object_class,
190 PROP_HIGHLIGHT_FOREGROUND,
191 g_param_spec_string ("highlight-foreground",
197 g_object_class_install_property (object_class,
198 PROP_TIME_FOREGROUND,
199 g_param_spec_string ("time-foreground",
205 g_object_class_install_property (object_class,
206 PROP_EVENT_FOREGROUND,
207 g_param_spec_string ("event-foreground",
213 g_object_class_install_property (object_class,
214 PROP_INVITE_FOREGROUND,
215 g_param_spec_string ("invite-foreground",
221 g_object_class_install_property (object_class,
222 PROP_LINK_FOREGROUND,
223 g_param_spec_string ("link-foreground",
229 g_type_class_add_private (object_class, sizeof (EmpathyThemeBoxesPriv));
233 empathy_theme_boxes_init (EmpathyThemeBoxes *theme)
235 EmpathyThemeBoxesPriv *priv;
237 priv = GET_PRIV (theme);
241 theme_boxes_finalize (GObject *object)
243 EmpathyThemeBoxesPriv *priv;
245 priv = GET_PRIV (object);
247 g_free (priv->header_foreground);
248 g_free (priv->header_background);
249 g_free (priv->header_line_background);
250 g_free (priv->text_foreground);
251 g_free (priv->text_background);
252 g_free (priv->action_foreground);
253 g_free (priv->highlight_foreground);
254 g_free (priv->time_foreground);
255 g_free (priv->event_foreground);
256 g_free (priv->invite_foreground);
257 g_free (priv->link_foreground);
259 (G_OBJECT_CLASS (empathy_theme_boxes_parent_class)->finalize) (object);
263 theme_boxes_get_property (GObject *object,
268 EmpathyThemeBoxesPriv *priv;
270 priv = GET_PRIV (object);
273 case PROP_HEADER_FOREGROUND:
274 g_value_set_string (value, priv->header_foreground);
276 case PROP_HEADER_BACKGROUND:
277 g_value_set_string (value, priv->header_background);
279 case PROP_HEADER_LINE_BACKGROUND:
280 g_value_set_string (value, priv->header_line_background);
282 case PROP_TEXT_FOREGROUND:
283 g_value_set_string (value, priv->text_foreground);
285 case PROP_TEXT_BACKGROUND:
286 g_value_set_string (value, priv->text_background);
288 case PROP_ACTION_FOREGROUND:
289 g_value_set_string (value, priv->action_foreground);
291 case PROP_HIGHLIGHT_FOREGROUND:
292 g_value_set_string (value, priv->highlight_foreground);
294 case PROP_TIME_FOREGROUND:
295 g_value_set_string (value, priv->time_foreground);
297 case PROP_EVENT_FOREGROUND:
298 g_value_set_string (value, priv->event_foreground);
300 case PROP_INVITE_FOREGROUND:
301 g_value_set_string (value, priv->invite_foreground);
303 case PROP_LINK_FOREGROUND:
304 g_value_set_string (value, priv->link_foreground);
307 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
312 theme_boxes_set_property (GObject *object,
317 EmpathyThemeBoxesPriv *priv;
319 priv = GET_PRIV (object);
322 case PROP_HEADER_FOREGROUND:
323 g_free (priv->header_foreground);
324 priv->header_foreground = g_value_dup_string (value);
326 case PROP_HEADER_BACKGROUND:
327 g_free (priv->header_background);
328 priv->header_background = g_value_dup_string (value);
330 case PROP_HEADER_LINE_BACKGROUND:
331 g_free (priv->header_line_background);
332 priv->header_line_background = g_value_dup_string (value);
334 case PROP_TEXT_FOREGROUND:
335 g_free (priv->text_foreground);
336 priv->text_foreground = g_value_dup_string (value);
338 case PROP_TEXT_BACKGROUND:
339 g_free (priv->text_background);
340 priv->text_background = g_value_dup_string (value);
342 case PROP_ACTION_FOREGROUND:
343 g_free (priv->action_foreground);
344 priv->action_foreground = g_value_dup_string (value);
346 case PROP_HIGHLIGHT_FOREGROUND:
347 g_free (priv->highlight_foreground);
348 priv->highlight_foreground = g_value_dup_string (value);
350 case PROP_TIME_FOREGROUND:
351 g_free (priv->time_foreground);
352 priv->time_foreground = g_value_dup_string (value);
354 case PROP_EVENT_FOREGROUND:
355 g_free (priv->event_foreground);
356 priv->event_foreground = g_value_dup_string (value);
358 case PROP_INVITE_FOREGROUND:
359 g_free (priv->invite_foreground);
360 priv->invite_foreground = g_value_dup_string (value);
362 case PROP_LINK_FOREGROUND:
363 g_free (priv->link_foreground);
364 priv->link_foreground = g_value_dup_string (value);
367 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
373 theme_boxes_define_theme_tags (EmpathyTheme *theme, EmpathyChatView *view)
375 EmpathyThemeBoxesPriv *priv;
376 GtkTextBuffer *buffer;
377 GtkTextTagTable *table;
380 priv = GET_PRIV (theme);
382 buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
383 table = gtk_text_buffer_get_tag_table (buffer);
385 tag = empathy_theme_utils_init_tag_by_name (table, "fancy-spacing");
388 "pixels-above-lines", 8,
390 empathy_theme_utils_add_tag (table, tag);
392 tag = empathy_theme_utils_init_tag_by_name (table,
395 "weight", PANGO_WEIGHT_BOLD,
396 "pixels-above-lines", HEADER_PADDING,
397 "pixels-below-lines", HEADER_PADDING,
399 if (priv->header_foreground) {
401 "foreground", priv->header_foreground,
402 "paragraph-background", priv->header_background,
405 empathy_theme_utils_add_tag (table, tag);
407 tag = empathy_theme_utils_init_tag_by_name (table, "fancy-header-line");
411 if (priv->header_line_background) {
413 "paragraph-background", priv->header_line_background,
417 empathy_theme_utils_add_tag (table, tag);
419 tag = empathy_theme_utils_init_tag_by_name (table, "fancy-body");
421 "pixels-above-lines", 4,
423 if (priv->text_background) {
425 "paragraph-background", priv->text_background,
429 if (priv->text_foreground) {
431 "foreground", priv->text_foreground,
434 empathy_theme_utils_add_tag (table, tag);
436 tag = empathy_theme_utils_init_tag_by_name (table, "fancy-action");
438 "style", PANGO_STYLE_ITALIC,
439 "pixels-above-lines", 4,
442 if (priv->text_background) {
444 "paragraph-background", priv->text_background,
448 if (priv->action_foreground) {
450 "foreground", priv->action_foreground,
454 empathy_theme_utils_add_tag (table, tag);
456 tag = empathy_theme_utils_init_tag_by_name (table,
459 "weight", PANGO_WEIGHT_BOLD,
460 "pixels-above-lines", 4,
462 if (priv->text_background) {
464 "paragraph-background", priv->text_background,
469 if (priv->highlight_foreground) {
471 "foreground", priv->highlight_foreground,
474 empathy_theme_utils_add_tag (table, tag);
476 tag = empathy_theme_utils_init_tag_by_name (table, "fancy-time");
478 "justification", GTK_JUSTIFY_CENTER,
480 if (priv->time_foreground) {
482 "foreground", priv->time_foreground,
485 empathy_theme_utils_add_tag (table, tag);
487 tag = empathy_theme_utils_init_tag_by_name (table, "fancy-event");
489 "justification", GTK_JUSTIFY_LEFT,
491 if (priv->event_foreground) {
493 "foreground", priv->event_foreground,
496 empathy_theme_utils_add_tag (table, tag);
498 tag = empathy_theme_utils_init_tag_by_name (table, "invite");
499 if (priv->invite_foreground) {
501 "foreground", priv->invite_foreground,
504 empathy_theme_utils_add_tag (table, tag);
506 tag = empathy_theme_utils_init_tag_by_name (table, "fancy-link");
508 "underline", PANGO_UNDERLINE_SINGLE,
510 if (priv->link_foreground) {
512 "foreground", priv->link_foreground,
515 empathy_theme_utils_add_tag (table, tag);
519 theme_boxes_fixup_tag_table (EmpathyTheme *theme, EmpathyChatView *view)
521 GtkTextBuffer *buffer;
523 buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
525 /* "Fancy" style tags. */
526 empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-header");
527 empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-header-line");
528 empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-body");
529 empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-action");
530 empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-highlight");
531 empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-spacing");
532 empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-time");
533 empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-event");
534 empathy_theme_utils_ensure_tag_by_name (buffer, "fancy-link");
538 BlockType last_block_type;
539 time_t last_timestamp;
542 static EmpathyThemeContext *
543 theme_boxes_setup_with_view (EmpathyTheme *theme, EmpathyChatView *view)
545 EmpathyThemeBoxesPriv *priv;
547 g_return_val_if_fail (EMPATHY_IS_THEME_BOXES (theme), NULL);
549 priv = GET_PRIV (theme);
551 theme_boxes_fixup_tag_table (theme, view);
553 theme_boxes_define_theme_tags (theme, view);
555 empathy_chat_view_set_margin (view, MARGIN);
561 theme_boxes_detach_from_view (EmpathyTheme *theme,
562 EmpathyThemeContext *context,
563 EmpathyChatView *view)
565 /* FIXME: Free the context */
569 theme_boxes_view_cleared (EmpathyTheme *theme,
570 EmpathyThemeContext *context,
571 EmpathyChatView *view)
573 /* FIXME: clear the context data */
577 table_size_allocate_cb (GtkWidget *view,
578 GtkAllocation *allocation,
583 gtk_widget_get_size_request (box, NULL, &height);
585 width = allocation->width;
588 gtk_text_view_get_right_margin (GTK_TEXT_VIEW (view)) - \
589 gtk_text_view_get_left_margin (GTK_TEXT_VIEW (view));
591 width -= 2 * HEADER_PADDING;
593 gtk_widget_set_size_request (box, width, height);
597 theme_boxes_maybe_append_header (EmpathyTheme *theme,
598 EmpathyThemeContext *context,
599 EmpathyChatView *view,
602 EmpathyThemeBoxesPriv *priv;
603 EmpathyContact *contact;
604 GdkPixbuf *avatar = NULL;
605 GtkTextBuffer *buffer;
609 GtkWidget *label1, *label2;
610 GtkTextChildAnchor *anchor;
617 gboolean parse_success;
620 priv = GET_PRIV (theme);
622 contact = empathy_message_get_sender (msg);
623 from_self = empathy_contact_is_user (contact);
624 buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
626 empathy_debug (DEBUG_DOMAIN, "Maybe add fancy header");
628 name = empathy_contact_get_name (contact);
632 /* Only insert a header if the previously inserted block is not the same
633 * as this one. This catches all the different cases:
635 if (empathy_chat_view_get_last_block_type (view) != BLOCK_TYPE_SELF &&
636 empathy_chat_view_get_last_block_type (view) != BLOCK_TYPE_OTHER) {
639 else if (from_self &&
640 empathy_chat_view_get_last_block_type (view) == BLOCK_TYPE_OTHER) {
643 else if (!from_self &&
644 empathy_chat_view_get_last_block_type (view) == BLOCK_TYPE_SELF) {
647 else if (!from_self &&
648 (!empathy_chat_view_get_last_contact (view) ||
649 !empathy_contact_equal (contact, empathy_chat_view_get_last_contact (view)))) {
657 empathy_theme_append_spacing (theme, context, view);
659 gtk_text_buffer_get_end_iter (buffer, &iter);
660 gtk_text_buffer_insert_with_tags_by_name (buffer,
667 gtk_text_buffer_get_end_iter (buffer, &iter);
668 anchor = gtk_text_buffer_create_child_anchor (buffer, &iter);
670 box = gtk_hbox_new (FALSE, 0);
673 avatar = empathy_chat_view_get_avatar_pixbuf_with_cache (contact);
674 if (avatar && empathy_theme_get_show_avatars (theme)) {
677 image = gtk_image_new_from_pixbuf (avatar);
679 gtk_box_pack_start (GTK_BOX (box), image,
684 g_signal_connect_object (view, "size-allocate",
685 G_CALLBACK (table_size_allocate_cb),
688 str = g_strdup_printf ("<b>%s</b>", name);
690 label1 = g_object_new (GTK_TYPE_LABEL,
696 parse_success = gdk_color_parse (priv->header_foreground, &color);
699 gtk_widget_modify_fg (label1, GTK_STATE_NORMAL, &color);
704 time = empathy_message_get_timestamp (msg);
706 tmp = empathy_time_to_string_local (time,
707 EMPATHY_TIME_FORMAT_DISPLAY_SHORT);
708 str = g_strdup_printf ("<i>%s</i>", tmp);
711 label2 = g_object_new (GTK_TYPE_LABEL,
718 gtk_widget_modify_fg (label2, GTK_STATE_NORMAL, &color);
723 gtk_misc_set_alignment (GTK_MISC (label1), 0.0, 0.5);
724 gtk_misc_set_alignment (GTK_MISC (label2), 1.0, 0.5);
726 gtk_box_pack_start (GTK_BOX (box), label1, TRUE, TRUE, 0);
727 gtk_box_pack_start (GTK_BOX (box), label2, TRUE, TRUE, 0);
729 gtk_text_view_add_child_at_anchor (GTK_TEXT_VIEW (view),
733 gtk_widget_show_all (box);
735 gtk_text_buffer_get_end_iter (buffer, &iter);
737 gtk_text_iter_backward_char (&start);
738 gtk_text_buffer_apply_tag_by_name (buffer,
742 gtk_text_buffer_insert_with_tags_by_name (buffer,
749 gtk_text_buffer_get_end_iter (buffer, &iter);
750 gtk_text_buffer_insert_with_tags_by_name (buffer,
759 theme_boxes_append_message (EmpathyTheme *theme,
760 EmpathyThemeContext *context,
761 EmpathyChatView *view,
762 EmpathyMessage *message)
764 EmpathyContact *sender;
766 empathy_theme_maybe_append_date_and_time (theme, context, view, message);
767 theme_boxes_maybe_append_header (theme, context, view, message);
769 sender = empathy_message_get_sender (message);
771 if (empathy_message_get_type (message) == EMPATHY_MESSAGE_TYPE_ACTION) {
774 body = g_strdup_printf (" * %s %s",
775 empathy_contact_get_name (sender),
776 empathy_message_get_body (message));
777 empathy_theme_append_text (theme, context, view, body,
778 "fancy-action", "fancy-link");
780 empathy_theme_append_text (theme, context, view,
781 empathy_message_get_body (message),
782 "fancy-body", "fancy-link");
785 if (empathy_contact_is_user (sender)) {
786 empathy_chat_view_set_last_block_type (view, BLOCK_TYPE_SELF);
787 empathy_chat_view_set_last_contact (view, NULL);
789 empathy_chat_view_set_last_block_type (view, BLOCK_TYPE_OTHER);
790 empathy_chat_view_set_last_contact (view, sender);
795 theme_boxes_append_event (EmpathyTheme *theme,
796 EmpathyThemeContext *context,
797 EmpathyChatView *view,
800 GtkTextBuffer *buffer;
804 buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
806 empathy_theme_maybe_append_date_and_time (theme, context, view, NULL);
808 gtk_text_buffer_get_end_iter (buffer, &iter);
810 msg = g_strdup_printf (" - %s\n", str);
812 gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
818 empathy_chat_view_set_last_block_type (view, BLOCK_TYPE_EVENT);
822 theme_boxes_append_timestamp (EmpathyTheme *theme,
823 EmpathyThemeContext *context,
824 EmpathyChatView *view,
825 EmpathyMessage *message,
829 GtkTextBuffer *buffer;
839 buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
841 date = empathy_message_get_date_and_time (message, ×tamp);
843 str = g_string_new (NULL);
845 if (show_time || show_date) {
846 empathy_theme_append_spacing (theme,
850 g_string_append (str, "- ");
856 g_date_strftime (buf, 256, _("%A %d %B %Y"), date);
857 g_string_append (str, buf);
860 g_string_append (str, ", ");
869 tmp = empathy_time_to_string_local (timestamp, EMPATHY_TIME_FORMAT_DISPLAY_SHORT);
870 g_string_append (str, tmp);
874 if (show_time || show_date) {
875 g_string_append (str, " -\n");
877 gtk_text_buffer_get_end_iter (buffer, &iter);
878 gtk_text_buffer_insert_with_tags_by_name (buffer,
884 empathy_chat_view_set_last_block_type (view, BLOCK_TYPE_TIME);
885 empathy_chat_view_set_last_timestamp (view, timestamp);
888 g_string_free (str, TRUE);
893 theme_boxes_append_spacing (EmpathyTheme *theme,
894 EmpathyThemeContext *context,
895 EmpathyChatView *view)
897 GtkTextBuffer *buffer;
900 g_return_if_fail (EMPATHY_IS_THEME (theme));
901 g_return_if_fail (EMPATHY_IS_CHAT_VIEW (view));
903 buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
905 gtk_text_buffer_get_end_iter (buffer, &iter);
906 gtk_text_buffer_insert_with_tags_by_name (buffer,
916 theme_boxes_setup_clean (EmpathyTheme *theme)
919 "header-foreground", "black",
920 "header-background", "#efefdf",
921 "header_line_background", "#e3e3d3",
922 "action_foreground", "brown4",
923 "time_foreground", "darkgrey",
924 "event_foreground", "darkgrey",
925 "invite_foreground", "sienna",
926 "link_foreground","#49789e",
931 theme_boxes_gdk_color_to_hex (GdkColor *gdk_color, gchar *str_color)
933 g_snprintf (str_color, 10,
936 gdk_color->green >> 8,
937 gdk_color->blue >> 8);
941 theme_boxes_setup_themed (EmpathyTheme *theme)
943 EmpathyThemeBoxesPriv *priv;
948 priv = GET_PRIV (theme);
950 widget = gtk_entry_new ();
951 style = gtk_widget_get_style (widget);
952 gtk_widget_destroy (widget);
954 theme_boxes_gdk_color_to_hex (&style->base[GTK_STATE_SELECTED], color);
957 "action-foreground", color,
958 "link-foreground", color,
961 theme_boxes_gdk_color_to_hex (&style->bg[GTK_STATE_SELECTED], color);
964 "header-background", color,
967 theme_boxes_gdk_color_to_hex (&style->dark[GTK_STATE_SELECTED], color);
970 "header_line-background", color,
973 theme_boxes_gdk_color_to_hex (&style->fg[GTK_STATE_SELECTED], color);
976 "header-foreground", color,
981 theme_boxes_theme_changed_cb (GtkWidget *widget,
982 GtkStyle *previous_style,
985 theme_boxes_setup_themed (EMPATHY_THEME (user_data));
987 g_signal_emit_by_name (G_OBJECT (user_data), "updated");
991 theme_boxes_setup_blue (EmpathyTheme *theme)
994 "header_foreground", "black",
995 "header_background", "#88a2b4",
996 "header_line_background", "#7f96a4",
997 "text_foreground", "black",
998 "text_background", "#adbdc8",
999 "highlight_foreground", "black",
1000 "action_foreground", "brown4",
1001 "time_foreground", "darkgrey",
1002 "event_foreground", "#7f96a4",
1003 "invite_foreground", "sienna",
1004 "link_foreground", "#49789e",
1009 empathy_theme_boxes_new (const gchar *name)
1011 EmpathyTheme *theme;
1012 EmpathyThemeBoxesPriv *priv;
1014 theme = g_object_new (EMPATHY_TYPE_THEME_BOXES, NULL);
1015 priv = GET_PRIV (theme);
1017 if (strcmp (name, "clean") == 0) {
1018 theme_boxes_setup_clean (theme);
1020 else if (strcmp (name, "simple") == 0) {
1021 /* FIXME: Make an actual accessor function */
1022 g_signal_connect (empathy_main_window_show (),
1024 G_CALLBACK (theme_boxes_theme_changed_cb),
1027 theme_boxes_setup_themed (theme);
1029 else if (strcmp (name, "blue") == 0) {
1030 theme_boxes_setup_blue (theme);