[gnome-calendar/ui-rewrite] project: replace GdkColor by GdkRGBA
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/ui-rewrite] project: replace GdkColor by GdkRGBA
- Date: Mon, 20 Oct 2014 14:19:45 +0000 (UTC)
commit e83240838b6dae789ed5f0f69503ba65db550d7a
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Mon Oct 20 12:05:14 2014 -0200
project: replace GdkColor by GdkRGBA
Fixes bug #738553
src/e-cell-renderer-color.c | 8 ++++----
src/gcal-edit-dialog.c | 16 ++++++++--------
src/gcal-manager.c | 2 +-
src/gcal-new-event-widget.c | 14 +++++++-------
src/gcal-utils.c | 11 ++++++-----
src/gcal-utils.h | 2 +-
6 files changed, 27 insertions(+), 26 deletions(-)
---
diff --git a/src/e-cell-renderer-color.c b/src/e-cell-renderer-color.c
index 4bbb131..c96e40b 100644
--- a/src/e-cell-renderer-color.c
+++ b/src/e-cell-renderer-color.c
@@ -37,7 +37,7 @@ enum {
};
struct _ECellRendererColorPrivate {
- GdkColor *color;
+ GdkRGBA *color;
};
G_DEFINE_TYPE (
@@ -154,7 +154,7 @@ cell_renderer_color_set_property (GObject *object,
switch (property_id) {
case PROP_COLOR:
if (priv->color != NULL)
- gdk_color_free (priv->color);
+ gdk_rgba_free (priv->color);
priv->color = g_value_dup_boxed (value);
return;
}
@@ -189,7 +189,7 @@ cell_renderer_color_finalize (GObject *object)
priv = E_CELL_RENDERER_COLOR_GET_PRIVATE (object);
if (priv->color != NULL)
- gdk_color_free (priv->color);
+ gdk_rgba_free (priv->color);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_cell_renderer_color_parent_class)->finalize (object);
@@ -219,7 +219,7 @@ e_cell_renderer_color_class_init (ECellRendererColorClass *class)
"color",
"Color Info",
"The color to render",
- GDK_TYPE_COLOR,
+ GDK_TYPE_RGBA,
G_PARAM_READWRITE));
}
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 7a28508..96c667d 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -411,7 +411,7 @@ gcal_edit_dialog_calendar_selected (GtkWidget *menu_item,
GtkListStore *sources_model;
GtkTreeIter *iter;
- GdkColor *color;
+ GdkRGBA *color;
GdkPixbuf *pix;
GtkWidget *cal_image;
@@ -433,7 +433,7 @@ gcal_edit_dialog_calendar_selected (GtkWidget *menu_item,
cal_image = gtk_image_new_from_pixbuf (pix);
gtk_button_set_image (GTK_BUTTON (priv->calendar_button), cal_image);
- gdk_color_free (color);
+ gdk_rgba_free (color);
g_object_unref (pix);
}
@@ -456,7 +456,7 @@ gcal_edit_dialog_set_calendar_selected (GcalEditDialog *dialog)
{
/* Walk through the list, reading each row */
gchar *uid;
- GdkColor *color;
+ GdkRGBA *color;
GtkWidget *cal_image;
GdkPixbuf *pix;
@@ -475,14 +475,14 @@ gcal_edit_dialog_set_calendar_selected (GcalEditDialog *dialog)
cal_image = gtk_image_new_from_pixbuf (pix);
gtk_button_set_image (GTK_BUTTON (priv->calendar_button), cal_image);
- gdk_color_free (color);
+ gdk_rgba_free (color);
g_free (uid);
g_object_unref (pix);
return;
}
- gdk_color_free (color);
+ gdk_rgba_free (color);
g_free (uid);
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (sources_model),
@@ -1011,7 +1011,7 @@ gcal_edit_dialog_set_manager (GcalEditDialog *dialog,
gchar *uid;
gchar *name;
gboolean active;
- GdkColor *color;
+ GdkRGBA *color;
GtkWidget *cal_image;
GdkPixbuf *pix;
@@ -1026,7 +1026,7 @@ gcal_edit_dialog_set_manager (GcalEditDialog *dialog,
{
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (sources_model),
&iter);
- gdk_color_free (color);
+ gdk_rgba_free (color);
g_free (name);
g_free (uid);
continue;
@@ -1054,7 +1054,7 @@ gcal_edit_dialog_set_manager (GcalEditDialog *dialog,
gtk_container_add (GTK_CONTAINER (menu), item);
g_object_unref (pix);
- gdk_color_free (color);
+ gdk_rgba_free (color);
g_free (name);
g_free (uid);
diff --git a/src/gcal-manager.c b/src/gcal-manager.c
index 731140f..4075177 100644
--- a/src/gcal-manager.c
+++ b/src/gcal-manager.c
@@ -570,7 +570,7 @@ gcal_manager_set_subscriber (GcalManager *manager,
* @manager: a #GcalManager
* @base_uri: URI defining the ESourceGroup the client will belongs
* @relative_uri: URI, relative to the base URI
- * @color: a string representing a color parseable for gdk_color_parse
+ * @color: a string representing a color parseable for gdk_rgba_parse
*
* Add a new calendar by its URI.
* The calendar is enabled by default
diff --git a/src/gcal-new-event-widget.c b/src/gcal-new-event-widget.c
index e360800..485c60a 100644
--- a/src/gcal-new-event-widget.c
+++ b/src/gcal-new-event-widget.c
@@ -43,7 +43,7 @@ item_activated (GtkWidget *item,
gchar *uid;
gchar *color_name;
- GdkColor color;
+ GdkRGBA color;
GdkPixbuf *pix;
GtkWidget *image;
@@ -53,7 +53,7 @@ item_activated (GtkWidget *item,
uid = g_object_get_data (G_OBJECT (item), "calendar-uid");
color_name = g_object_get_data (G_OBJECT (item), "color");
- gdk_color_parse (color_name, &color);
+ gdk_rgba_parse (&color, color_name);
pix = gcal_get_pixbuf_from_color (&color, 16);
image = gtk_image_new_from_pixbuf (pix);
@@ -133,7 +133,7 @@ gcal_new_event_widget_set_calendars (GcalNewEventWidget *widget,
gchar *uid;
gchar *name;
gboolean active;
- GdkColor *color;
+ GdkRGBA *color;
GtkWidget *box;
GtkWidget *name_label;
@@ -157,7 +157,7 @@ gcal_new_event_widget_set_calendars (GcalNewEventWidget *widget,
g_object_set_data_full (G_OBJECT (item),
"calendar-uid", uid, g_free);
g_object_set_data_full (G_OBJECT (item),
- "color", gdk_color_to_string (color), g_free);
+ "color", gdk_rgba_to_string (color), g_free);
g_signal_connect (item,
"activate",
G_CALLBACK (item_activated),
@@ -176,7 +176,7 @@ gcal_new_event_widget_set_calendars (GcalNewEventWidget *widget,
g_object_unref (pix);
g_free (name);
- gdk_color_free (color);
+ gdk_rgba_free (color);
valid = gtk_tree_model_iter_next (sources_model, &iter);
}
@@ -195,7 +195,7 @@ gcal_new_event_widget_set_default_calendar (GcalNewEventWidget *widget,
gchar *uid;
gchar *color_name;
- GdkColor color;
+ GdkRGBA color;
GdkPixbuf *pix;
GtkWidget *image;
@@ -215,7 +215,7 @@ gcal_new_event_widget_set_default_calendar (GcalNewEventWidget *widget,
}
}
- gdk_color_parse (color_name, &color);
+ gdk_rgba_parse (&color, color_name);
pix = gcal_get_pixbuf_from_color (&color, 16);
image = gtk_image_new_from_pixbuf (pix);
gtk_button_set_image (GTK_BUTTON (priv->calendar_button), image);
diff --git a/src/gcal-utils.c b/src/gcal-utils.c
index 116e615..9bbe094 100644
--- a/src/gcal-utils.c
+++ b/src/gcal-utils.c
@@ -235,7 +235,7 @@ gcal_get_month_name (gint i)
}
GdkPixbuf*
-gcal_get_pixbuf_from_color (GdkColor *color,
+gcal_get_pixbuf_from_color (GdkRGBA *color,
gint size)
{
cairo_surface_t *surface;
@@ -246,10 +246,11 @@ gcal_get_pixbuf_from_color (GdkColor *color,
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
cr = cairo_create (surface);
- cairo_set_source_rgb (cr,
- color->red / 65535.0,
- color->green / 65535.0,
- color->blue / 65535.0);
+ cairo_set_source_rgba (cr,
+ color->red,
+ color->green,
+ color->blue,
+ color->alpha);
cairo_rectangle (cr, 0, 0, size, size);
cairo_fill (cr);
cairo_destroy (cr);
diff --git a/src/gcal-utils.h b/src/gcal-utils.h
index b546151..3168955 100644
--- a/src/gcal-utils.h
+++ b/src/gcal-utils.h
@@ -67,7 +67,7 @@ gchar* gcal_get_weekday (gint
gchar* gcal_get_month_name (gint i);
-GdkPixbuf* gcal_get_pixbuf_from_color (GdkColor *color,
+GdkPixbuf* gcal_get_pixbuf_from_color (GdkRGBA *color,
gint size);
gint gcal_compare_event_widget_by_date (gconstpointer a,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]