updated on Sat Jan 14 12:12:45 UTC 2012
[aur-mirror.git] / dates / 0001-Replaced-the-calls-to-the-deprecated-functions-e_sou.patch
blobe7fce46f39ade95ef4d173fb2286c07a60f30953
1 From 7771e0b3d75b4ba04756d6c6ffc03d644df2db5f Mon Sep 17 00:00:00 2001
2 From: Lucas Hermann Negri <lucashnegri@gmail.com>
3 Date: Wed, 13 Oct 2010 18:49:20 -0300
4 Subject: [PATCH] Replaced the calls to the deprecated functions e_source_{set,get}_color
5 with the new API (e_source_{set,peek}_color_spec).
7 ---
8 src/dates_gtk.c | 40 ++++++++++++----------------------------
9 src/dates_main.c | 2 +-
10 src/dates_view.c | 10 ++++------
11 3 files changed, 17 insertions(+), 35 deletions(-)
13 diff --git a/src/dates_gtk.c b/src/dates_gtk.c
14 index 78e71bb..403bc25 100644
15 --- a/src/dates_gtk.c
16 +++ b/src/dates_gtk.c
17 @@ -1016,7 +1016,6 @@ calendar_do_new_dialog (GtkWindow *parent, DatesData *d)
18 GtkTreeIter iter;
19 GError *error = NULL;
20 const gchar *relative_uri;
21 - guint32 new_colour;
23 #ifdef WITH_HILDON
24 GdkColor *hildon_color;
25 @@ -1055,7 +1054,8 @@ calendar_do_new_dialog (GtkWindow *parent, DatesData *d)
26 source = e_source_new (name, relative_uri);
28 #ifdef USE_OWL
29 - new_colour = owl_colour_button_get_colour (OWL_COLOUR_BUTTON (color_button));
30 + guint32 new_colour = owl_colour_button_get_colour (OWL_COLOUR_BUTTON (color_button));
31 + e_source_set_color (source, new_colour);
32 #else
34 #ifdef WITH_HILDON
35 @@ -1063,17 +1063,11 @@ calendar_do_new_dialog (GtkWindow *parent, DatesData *d)
36 #else
37 gtk_color_button_get_color (GTK_COLOR_BUTTON(color_button), &colour);
38 #endif
39 - new_colour = (guint8)(colour.red >> 8);
40 - new_colour <<= 8;
41 - new_colour |= (guint8)(colour.green >> 8);
42 - new_colour <<= 8;
43 - new_colour |= (guint8)(colour.blue >> 8);
44 - new_colour <<= 8;
45 + gchar *n_color = gdk_color_to_string (&colour);
46 + e_source_set_color_spec (source, n_color);
47 + g_free(n_color);
48 #endif
50 - /* Set the colour */
51 - e_source_set_color (source, new_colour);
53 /* Set the group for the source */
54 e_source_set_group (source, group);
55 e_source_group_add_source (group, source, 0);
56 @@ -1169,7 +1163,6 @@ calendar_do_edit_dialog (GtkWindow *parent, ESource *source, DatesData *d)
57 ESourceGroup *group;
59 GdkColor colour;
60 - guint32 raw_colour;
62 const gchar *name = NULL;
63 const gchar *uri = NULL;
64 @@ -1335,12 +1328,8 @@ calendar_do_edit_dialog (GtkWindow *parent, ESource *source, DatesData *d)
65 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
67 /* Get the colour from the the source */
68 - e_source_get_color (source, &raw_colour);
70 - /* Munge this into something usable */
71 - colour.red = (guint16)(((raw_colour & 0xff0000) >> 16) << 8);
72 - colour.green = (guint16)(((raw_colour & 0xff00) >> 8) << 8);
73 - colour.blue = (guint16)(((raw_colour & 0xff) << 8));
74 + const gchar* spec = e_source_peek_color_spec(source);
75 + gdk_color_parse(spec, &colour);
77 /* Now we need to allocate the colour */
78 gdk_colormap_alloc_color (gdk_colormap_get_system (), &colour, TRUE, TRUE);
79 @@ -1440,26 +1429,21 @@ calendar_do_edit_dialog (GtkWindow *parent, ESource *source, DatesData *d)
80 * Next we need to pack the GDK colour into guint32
81 * for eds
83 - guint32 new_colour = 0;
85 GError *error = NULL;
86 #ifdef USE_OWL
87 - new_colour = owl_colour_button_get_colour (OWL_COLOUR_BUTTON (color_button));
88 + guint32 new_colour = owl_colour_button_get_colour (OWL_COLOUR_BUTTON (color_button));
89 + e_source_set_color (source, new_colour);
90 #else
91 #ifdef WITH_HILDON
92 hildon_color_button_get_color (HILDON_COLOR_BUTTON(color_button), &colour);
93 #else
94 gtk_color_button_get_color (GTK_COLOR_BUTTON(color_button), &colour);
95 #endif
96 - new_colour = (guint8)(colour.red >> 8);
97 - new_colour <<= 8;
98 - new_colour |= (guint8)(colour.green >> 8);
99 - new_colour <<= 8;
100 - new_colour |= (guint8)(colour.blue >> 8);
101 - new_colour <<= 8;
102 + gchar *n_color = gdk_color_to_string (&colour);
103 + e_source_set_color_spec (source, n_color);
104 + g_free(n_color);
105 #endif
106 - /* Update the colour */
107 - e_source_set_color (source, new_colour);
109 /* And the name */
110 e_source_set_name (source, (gtk_entry_get_text (GTK_ENTRY (name_entry))));
111 diff --git a/src/dates_main.c b/src/dates_main.c
112 index ce05fe8..1f7770d 100644
113 --- a/src/dates_main.c
114 +++ b/src/dates_main.c
115 @@ -112,7 +112,7 @@ dates_load_calendars (DatesData *d)
116 system_source = e_source_new (_("Personal"), "system");
118 /* Default Evolution colour */
119 - e_source_set_color (system_source, 0xBECEDD);
120 + e_source_set_color_spec (system_source, "#BECEDD");
122 /* Set the group for the source and put it in the group */
123 e_source_set_group (system_source, local_group);
124 diff --git a/src/dates_view.c b/src/dates_view.c
125 index d65db2f..9d28a15 100644
126 --- a/src/dates_view.c
127 +++ b/src/dates_view.c
128 @@ -4846,7 +4846,6 @@ dates_view_add_calendar (DatesView *view, ECal *ecal)
129 DatesViewPrivate *priv = DATES_VIEW_GET_PRIVATE (view);
130 DatesViewCalendar *cal;
131 ESource *source;
132 - guint32 colour;
133 /* GError *error = NULL;*/
135 g_return_if_fail (E_IS_CAL (ecal));
136 @@ -4876,12 +4875,11 @@ dates_view_add_calendar (DatesView *view, ECal *ecal)
137 cal->text_gc = gdk_gc_new (
138 GDK_DRAWABLE (priv->main->window));
140 - if (e_source_get_color (source, &colour)) {
141 + const gchar* spec = e_source_peek_color_spec (source);
142 + if (spec) {
143 GdkColor gcolour, dgcolour, tgcolour;
144 - gcolour.red = ((colour & 0xFF0000) >> 16) * 0x101;
145 - gcolour.green = ((colour & 0xFF00) >> 8) * 0x101;
146 - gcolour.blue = (colour & 0xFF) * 0x101;
148 + gdk_color_parse(spec, &gcolour);
150 /* This is simplified sRGB -> LAB conversion; we do not need it
151 * entirely precise, as we are only going to chose between
152 * black or white text based on the L value.
154 1.7.3.1