project: use cairo_surface_t when possible
We can avoid an entire roundtrip from surface > pixbuf > surface if we simply pass the surface to GtkImage. We also save quite a bunch of debug lines.
This commit is contained in:
+13
-9
@@ -153,13 +153,15 @@ fill_sources_menu (GcalEditDialog *dialog)
|
|||||||
ESource *source;
|
ESource *source;
|
||||||
GMenuItem *item;
|
GMenuItem *item;
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
|
cairo_surface_t *surface;
|
||||||
GdkPixbuf *pix;
|
GdkPixbuf *pix;
|
||||||
|
|
||||||
source = E_SOURCE (aux->data);
|
source = E_SOURCE (aux->data);
|
||||||
|
|
||||||
/* retrieve color */
|
/* retrieve color */
|
||||||
get_color_name_from_source (source, &color);
|
get_color_name_from_source (source, &color);
|
||||||
pix = get_circle_pixbuf_from_color (&color, 16);;
|
surface = get_circle_surface_from_color (&color, 16);
|
||||||
|
pix = gdk_pixbuf_get_from_surface (surface, 0, 0, 16, 16);
|
||||||
|
|
||||||
/* menu item */
|
/* menu item */
|
||||||
item = g_menu_item_new (e_source_get_display_name (source), "select-calendar");
|
item = g_menu_item_new (e_source_get_display_name (source), "select-calendar");
|
||||||
@@ -178,6 +180,7 @@ fill_sources_menu (GcalEditDialog *dialog)
|
|||||||
|
|
||||||
g_menu_append_item (dialog->sources_menu, item);
|
g_menu_append_item (dialog->sources_menu, item);
|
||||||
|
|
||||||
|
g_clear_pointer (&surface, cairo_surface_destroy);
|
||||||
g_object_unref (pix);
|
g_object_unref (pix);
|
||||||
g_object_unref (item);
|
g_object_unref (item);
|
||||||
}
|
}
|
||||||
@@ -217,18 +220,19 @@ on_calendar_selected (GSimpleAction *action,
|
|||||||
if (g_strcmp0 (e_source_get_uid (source), uid) == 0)
|
if (g_strcmp0 (e_source_get_uid (source), uid) == 0)
|
||||||
{
|
{
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
GdkPixbuf *pix;
|
cairo_surface_t *surface;
|
||||||
|
|
||||||
/* retrieve color */
|
/* retrieve color */
|
||||||
get_color_name_from_source (source, &color);
|
get_color_name_from_source (source, &color);
|
||||||
|
|
||||||
pix = get_circle_pixbuf_from_color (&color, 16);
|
surface = get_circle_surface_from_color (&color, 16);
|
||||||
gtk_image_set_from_pixbuf (GTK_IMAGE (self->source_image), pix);
|
gtk_image_set_from_surface (GTK_IMAGE (self->source_image), surface);
|
||||||
g_object_unref (pix);
|
|
||||||
|
|
||||||
self->selected_source = source;
|
self->selected_source = source;
|
||||||
|
|
||||||
gtk_label_set_label (GTK_LABEL (self->subtitle_label), e_source_get_display_name (source));
|
gtk_label_set_label (GTK_LABEL (self->subtitle_label), e_source_get_display_name (source));
|
||||||
|
|
||||||
|
g_clear_pointer (&surface, cairo_surface_destroy);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1062,7 +1066,7 @@ gcal_edit_dialog_set_event (GcalEditDialog *dialog,
|
|||||||
{
|
{
|
||||||
GDateTime *date_start;
|
GDateTime *date_start;
|
||||||
GDateTime *date_end;
|
GDateTime *date_end;
|
||||||
GdkPixbuf *pix;
|
cairo_surface_t *surface;
|
||||||
ESource *source;
|
ESource *source;
|
||||||
const gchar *summary;
|
const gchar *summary;
|
||||||
gboolean all_day;
|
gboolean all_day;
|
||||||
@@ -1095,9 +1099,9 @@ gcal_edit_dialog_set_event (GcalEditDialog *dialog,
|
|||||||
gtk_entry_set_text (GTK_ENTRY (dialog->summary_entry), summary);
|
gtk_entry_set_text (GTK_ENTRY (dialog->summary_entry), summary);
|
||||||
|
|
||||||
/* dialog titlebar's title & subtitle */
|
/* dialog titlebar's title & subtitle */
|
||||||
pix = get_circle_pixbuf_from_color (gcal_event_get_color (event), 16);
|
surface = get_circle_surface_from_color (gcal_event_get_color (event), 16);
|
||||||
gtk_image_set_from_pixbuf (GTK_IMAGE (dialog->source_image), pix);
|
gtk_image_set_from_surface (GTK_IMAGE (dialog->source_image), surface);
|
||||||
g_object_unref (pix);
|
g_clear_pointer (&surface, cairo_surface_destroy);
|
||||||
|
|
||||||
gtk_label_set_label (GTK_LABEL (dialog->subtitle_label), e_source_get_display_name (source));
|
gtk_label_set_label (GTK_LABEL (dialog->subtitle_label), e_source_get_display_name (source));
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ create_row_for_source (GcalManager *manager,
|
|||||||
ESource *source,
|
ESource *source,
|
||||||
gboolean writable)
|
gboolean writable)
|
||||||
{
|
{
|
||||||
|
cairo_surface_t *surface;
|
||||||
GtkWidget *row, *box, *icon, *label, *selected_icon;
|
GtkWidget *row, *box, *icon, *label, *selected_icon;
|
||||||
GdkPixbuf *circle_pixbuf;
|
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
gchar *tooltip, *parent_name;
|
gchar *tooltip, *parent_name;
|
||||||
|
|
||||||
@@ -87,8 +87,8 @@ create_row_for_source (GcalManager *manager,
|
|||||||
|
|
||||||
/* The icon with the source color */
|
/* The icon with the source color */
|
||||||
get_color_name_from_source (source, &color);
|
get_color_name_from_source (source, &color);
|
||||||
circle_pixbuf = get_circle_pixbuf_from_color (&color, 16);
|
surface = get_circle_surface_from_color (&color, 16);
|
||||||
icon = gtk_image_new_from_pixbuf (circle_pixbuf);
|
icon = gtk_image_new_from_surface (surface);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (box), icon);
|
gtk_container_add (GTK_CONTAINER (box), icon);
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ create_row_for_source (GcalManager *manager,
|
|||||||
gtk_widget_show (box);
|
gtk_widget_show (box);
|
||||||
gtk_widget_show (row);
|
gtk_widget_show (row);
|
||||||
|
|
||||||
g_clear_object (&circle_pixbuf);
|
g_clear_pointer (&surface, cairo_surface_destroy);
|
||||||
g_free (parent_name);
|
g_free (parent_name);
|
||||||
g_free (tooltip);
|
g_free (tooltip);
|
||||||
|
|
||||||
@@ -176,8 +176,8 @@ static void
|
|||||||
select_row (GcalQuickAddPopover *self,
|
select_row (GcalQuickAddPopover *self,
|
||||||
GtkListBoxRow *row)
|
GtkListBoxRow *row)
|
||||||
{
|
{
|
||||||
|
cairo_surface_t *surface;
|
||||||
GtkWidget *icon;
|
GtkWidget *icon;
|
||||||
GdkPixbuf *circle_pixbuf;
|
|
||||||
ESource *source;
|
ESource *source;
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
|
|
||||||
@@ -200,8 +200,8 @@ select_row (GcalQuickAddPopover *self,
|
|||||||
gtk_label_set_label (GTK_LABEL (self->calendar_name_label), e_source_get_display_name (source));
|
gtk_label_set_label (GTK_LABEL (self->calendar_name_label), e_source_get_display_name (source));
|
||||||
|
|
||||||
get_color_name_from_source (source, &color);
|
get_color_name_from_source (source, &color);
|
||||||
circle_pixbuf = get_circle_pixbuf_from_color (&color, 16);
|
surface = get_circle_surface_from_color (&color, 16);
|
||||||
gtk_image_set_from_pixbuf (GTK_IMAGE (self->color_image), circle_pixbuf);
|
gtk_image_set_from_surface (GTK_IMAGE (self->color_image), surface);
|
||||||
|
|
||||||
/* Return to the events page */
|
/* Return to the events page */
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "events");
|
gtk_stack_set_visible_child_name (GTK_STACK (self->stack), "events");
|
||||||
@@ -210,7 +210,7 @@ select_row (GcalQuickAddPopover *self,
|
|||||||
if (gtk_widget_get_visible (GTK_WIDGET (self)))
|
if (gtk_widget_get_visible (GTK_WIDGET (self)))
|
||||||
gtk_entry_grab_focus_without_selecting (GTK_ENTRY (self->summary_entry));
|
gtk_entry_grab_focus_without_selecting (GTK_ENTRY (self->summary_entry));
|
||||||
|
|
||||||
g_clear_object (&circle_pixbuf);
|
g_clear_pointer (&surface, cairo_surface_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -348,8 +348,8 @@ on_source_changed (GcalManager *manager,
|
|||||||
ESource *source,
|
ESource *source,
|
||||||
GcalQuickAddPopover *self)
|
GcalQuickAddPopover *self)
|
||||||
{
|
{
|
||||||
|
cairo_surface_t *surface;
|
||||||
GtkWidget *row, *color_icon, *name_label;
|
GtkWidget *row, *color_icon, *name_label;
|
||||||
GdkPixbuf *circle_pixbuf;
|
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
|
|
||||||
row = get_row_for_source (self, source);
|
row = get_row_for_source (self, source);
|
||||||
@@ -378,10 +378,10 @@ on_source_changed (GcalManager *manager,
|
|||||||
|
|
||||||
/* Setup the source color, in case it changed */
|
/* Setup the source color, in case it changed */
|
||||||
get_color_name_from_source (source, &color);
|
get_color_name_from_source (source, &color);
|
||||||
circle_pixbuf = get_circle_pixbuf_from_color (&color, 16);
|
surface = get_circle_surface_from_color (&color, 16);
|
||||||
gtk_image_set_from_pixbuf (GTK_IMAGE (color_icon), circle_pixbuf);
|
gtk_image_set_from_surface (GTK_IMAGE (color_icon), surface);
|
||||||
|
|
||||||
g_clear_object (&circle_pixbuf);
|
g_clear_pointer (&surface, cairo_surface_destroy);
|
||||||
|
|
||||||
/* Also setup the row name, in case we just changed the source name */
|
/* Also setup the row name, in case we just changed the source name */
|
||||||
gtk_label_set_text (GTK_LABEL (name_label), e_source_get_display_name (source));
|
gtk_label_set_text (GTK_LABEL (name_label), e_source_get_display_name (source));
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ make_row_for_event (GcalSearchView *view,
|
|||||||
{
|
{
|
||||||
GDateTime *local_datetime;
|
GDateTime *local_datetime;
|
||||||
GDateTime *date_start;
|
GDateTime *date_start;
|
||||||
GdkPixbuf *pixbuf;
|
cairo_surface_t *surface;
|
||||||
|
|
||||||
GtkWidget *row;
|
GtkWidget *row;
|
||||||
GtkWidget *grid;
|
GtkWidget *grid;
|
||||||
@@ -311,10 +311,10 @@ make_row_for_event (GcalSearchView *view,
|
|||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
|
|
||||||
/* get event color */
|
/* get event color */
|
||||||
pixbuf = gcal_get_pixbuf_from_color (gcal_event_get_color (event), 16);
|
surface = gcal_get_surface_from_color (gcal_event_get_color (event), 16);
|
||||||
|
|
||||||
/* make an image of the color */
|
/* make an image of the color */
|
||||||
image = gtk_image_new_from_pixbuf (pixbuf);
|
image = gtk_image_new_from_surface (surface);
|
||||||
|
|
||||||
/* grid & box*/
|
/* grid & box*/
|
||||||
row = gtk_list_box_row_new ();
|
row = gtk_list_box_row_new ();
|
||||||
@@ -397,7 +397,7 @@ make_row_for_event (GcalSearchView *view,
|
|||||||
gtk_widget_show_all (row);
|
gtk_widget_show_all (row);
|
||||||
|
|
||||||
g_clear_pointer (&local_datetime, g_date_time_unref);
|
g_clear_pointer (&local_datetime, g_date_time_unref);
|
||||||
g_object_unref (pixbuf);
|
g_clear_pointer (&surface, cairo_surface_destroy);
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,6 +203,8 @@ get_result_metas_cb (GcalShellSearchProvider *search_provider,
|
|||||||
g_variant_builder_init (&abuilder, G_VARIANT_TYPE ("aa{sv}"));
|
g_variant_builder_init (&abuilder, G_VARIANT_TYPE ("aa{sv}"));
|
||||||
for (i = 0; i < g_strv_length (results); i++)
|
for (i = 0; i < g_strv_length (results); i++)
|
||||||
{
|
{
|
||||||
|
cairo_surface_t *surface;
|
||||||
|
|
||||||
uuid = results[i];
|
uuid = results[i];
|
||||||
event = g_hash_table_lookup (priv->events, uuid);
|
event = g_hash_table_lookup (priv->events, uuid);
|
||||||
|
|
||||||
@@ -210,7 +212,8 @@ get_result_metas_cb (GcalShellSearchProvider *search_provider,
|
|||||||
g_variant_builder_add (&builder, "{sv}", "id", g_variant_new_string (uuid));
|
g_variant_builder_add (&builder, "{sv}", "id", g_variant_new_string (uuid));
|
||||||
g_variant_builder_add (&builder, "{sv}", "name", g_variant_new_string (gcal_event_get_summary (event)));
|
g_variant_builder_add (&builder, "{sv}", "name", g_variant_new_string (gcal_event_get_summary (event)));
|
||||||
|
|
||||||
gicon = get_circle_pixbuf_from_color (gcal_event_get_color (event), 128);
|
surface = get_circle_surface_from_color (gcal_event_get_color (event), 96);
|
||||||
|
gicon = gdk_pixbuf_get_from_surface (surface, 0, 0, 96, 96);
|
||||||
icon_variant = g_icon_serialize (G_ICON (gicon));
|
icon_variant = g_icon_serialize (G_ICON (gicon));
|
||||||
g_variant_builder_add (&builder, "{sv}", "icon", icon_variant);
|
g_variant_builder_add (&builder, "{sv}", "icon", icon_variant);
|
||||||
g_object_unref (gicon);
|
g_object_unref (gicon);
|
||||||
@@ -228,6 +231,8 @@ get_result_metas_cb (GcalShellSearchProvider *search_provider,
|
|||||||
|
|
||||||
g_variant_builder_add (&builder, "{sv}", "description", g_variant_new_string (desc));
|
g_variant_builder_add (&builder, "{sv}", "description", g_variant_new_string (desc));
|
||||||
g_variant_builder_add_value (&abuilder, g_variant_builder_end (&builder));
|
g_variant_builder_add_value (&abuilder, g_variant_builder_end (&builder));
|
||||||
|
|
||||||
|
g_clear_pointer (&surface, cairo_surface_destroy);
|
||||||
}
|
}
|
||||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(aa{sv})", &abuilder));
|
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(aa{sv})", &abuilder));
|
||||||
|
|
||||||
|
|||||||
@@ -569,7 +569,7 @@ source_color_changed (GObject *source,
|
|||||||
GtkImage *icon)
|
GtkImage *icon)
|
||||||
{
|
{
|
||||||
ESourceSelectable *extension;
|
ESourceSelectable *extension;
|
||||||
GdkPixbuf *pixbuf;
|
cairo_surface_t *surface;
|
||||||
GdkRGBA out_color;
|
GdkRGBA out_color;
|
||||||
|
|
||||||
extension = E_SOURCE_SELECTABLE (source);
|
extension = E_SOURCE_SELECTABLE (source);
|
||||||
@@ -582,9 +582,9 @@ source_color_changed (GObject *source,
|
|||||||
|
|
||||||
if (gdk_rgba_parse (&out_color, e_source_selectable_get_color (extension)))
|
if (gdk_rgba_parse (&out_color, e_source_selectable_get_color (extension)))
|
||||||
{
|
{
|
||||||
pixbuf = get_circle_pixbuf_from_color (&out_color, 24);
|
surface = get_circle_surface_from_color (&out_color, 24);
|
||||||
gtk_image_set_from_pixbuf (GTK_IMAGE (icon), pixbuf);
|
gtk_image_set_from_surface (GTK_IMAGE (icon), surface);
|
||||||
g_object_unref (pixbuf);
|
g_clear_pointer (&surface, cairo_surface_destroy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,10 +610,10 @@ static GtkWidget*
|
|||||||
make_row_from_source (GcalSourceDialog *dialog,
|
make_row_from_source (GcalSourceDialog *dialog,
|
||||||
ESource *source)
|
ESource *source)
|
||||||
{
|
{
|
||||||
|
cairo_surface_t *surface;
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
GtkWidget *bottom_label;
|
GtkWidget *bottom_label;
|
||||||
GtkWidget *top_label;
|
GtkWidget *top_label;
|
||||||
GdkPixbuf *pixbuf;
|
|
||||||
GtkWidget *icon;
|
GtkWidget *icon;
|
||||||
GtkWidget *row;
|
GtkWidget *row;
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
@@ -632,9 +632,9 @@ make_row_from_source (GcalSourceDialog *dialog,
|
|||||||
|
|
||||||
/* source color icon */
|
/* source color icon */
|
||||||
get_color_name_from_source (source, &color);
|
get_color_name_from_source (source, &color);
|
||||||
pixbuf = get_circle_pixbuf_from_color (&color, 24);
|
surface = get_circle_surface_from_color (&color, 24);
|
||||||
icon = GTK_WIDGET (gtk_builder_get_object (builder, "icon"));
|
icon = GTK_WIDGET (gtk_builder_get_object (builder, "icon"));
|
||||||
gtk_image_set_from_pixbuf (GTK_IMAGE (icon), pixbuf);
|
gtk_image_set_from_surface (GTK_IMAGE (icon), surface);
|
||||||
|
|
||||||
/* source name label */
|
/* source name label */
|
||||||
top_label = GTK_WIDGET (gtk_builder_get_object (builder, "title"));
|
top_label = GTK_WIDGET (gtk_builder_get_object (builder, "title"));
|
||||||
@@ -650,8 +650,8 @@ make_row_from_source (GcalSourceDialog *dialog,
|
|||||||
bottom_label = GTK_WIDGET (gtk_builder_get_object (builder, "subtitle"));
|
bottom_label = GTK_WIDGET (gtk_builder_get_object (builder, "subtitle"));
|
||||||
gtk_label_set_label (GTK_LABEL (bottom_label), parent_name);
|
gtk_label_set_label (GTK_LABEL (bottom_label), parent_name);
|
||||||
|
|
||||||
|
g_clear_pointer (&surface, cairo_surface_destroy);
|
||||||
g_object_unref (builder);
|
g_object_unref (builder);
|
||||||
g_object_unref (pixbuf);
|
|
||||||
g_free (parent_name);
|
g_free (parent_name);
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
|
|||||||
+8
-17
@@ -187,13 +187,12 @@ gcal_get_month_name (gint i)
|
|||||||
*
|
*
|
||||||
* Returns: (Transfer full): An instance of {@link GdkPixbuf} to be freed with g_object_unref()
|
* Returns: (Transfer full): An instance of {@link GdkPixbuf} to be freed with g_object_unref()
|
||||||
**/
|
**/
|
||||||
GdkPixbuf*
|
cairo_surface_t*
|
||||||
gcal_get_pixbuf_from_color (GdkRGBA *color,
|
gcal_get_surface_from_color (GdkRGBA *color,
|
||||||
gint size)
|
gint size)
|
||||||
{
|
{
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
GdkPixbuf *pix;
|
|
||||||
|
|
||||||
/* TODO: review size here, maybe not hardcoded */
|
/* TODO: review size here, maybe not hardcoded */
|
||||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
|
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
|
||||||
@@ -207,22 +206,17 @@ gcal_get_pixbuf_from_color (GdkRGBA *color,
|
|||||||
cairo_rectangle (cr, 0, 0, size, size);
|
cairo_rectangle (cr, 0, 0, size, size);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
pix = gdk_pixbuf_get_from_surface (surface,
|
|
||||||
0, 0,
|
return surface;
|
||||||
size, size);
|
|
||||||
cairo_surface_destroy (surface);
|
|
||||||
return pix;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkPixbuf*
|
cairo_surface_t*
|
||||||
get_circle_pixbuf_from_color (GdkRGBA *color,
|
get_circle_surface_from_color (GdkRGBA *color,
|
||||||
gint size)
|
gint size)
|
||||||
{
|
{
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
GdkPixbuf *pix;
|
|
||||||
|
|
||||||
/* TODO: review size here, maybe not hardcoded */
|
|
||||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
|
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
|
||||||
cr = cairo_create (surface);
|
cr = cairo_create (surface);
|
||||||
|
|
||||||
@@ -234,11 +228,8 @@ get_circle_pixbuf_from_color (GdkRGBA *color,
|
|||||||
cairo_arc (cr, size / 2.0, size / 2.0, size / 2.0, 0., 2 * M_PI);
|
cairo_arc (cr, size / 2.0, size / 2.0, size / 2.0, 0., 2 * M_PI);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
pix = gdk_pixbuf_get_from_surface (surface,
|
|
||||||
0, 0,
|
return surface;
|
||||||
size, size);
|
|
||||||
cairo_surface_destroy (surface);
|
|
||||||
return pix;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
+2
-2
@@ -73,10 +73,10 @@ gchar* gcal_get_weekday (gint
|
|||||||
|
|
||||||
gchar* gcal_get_month_name (gint i);
|
gchar* gcal_get_month_name (gint i);
|
||||||
|
|
||||||
GdkPixbuf* gcal_get_pixbuf_from_color (GdkRGBA *color,
|
cairo_surface_t*gcal_get_surface_from_color (GdkRGBA *color,
|
||||||
gint size);
|
gint size);
|
||||||
|
|
||||||
GdkPixbuf* get_circle_pixbuf_from_color (GdkRGBA *color,
|
cairo_surface_t*get_circle_surface_from_color (GdkRGBA *color,
|
||||||
gint size);
|
gint size);
|
||||||
|
|
||||||
void get_color_name_from_source (ESource *source,
|
void get_color_name_from_source (ESource *source,
|
||||||
|
|||||||
+4
-4
@@ -888,7 +888,7 @@ make_row_from_source (GcalWindow *window,
|
|||||||
{
|
{
|
||||||
GtkWidget *label, *icon, *checkbox, *box, *row;
|
GtkWidget *label, *icon, *checkbox, *box, *row;
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
GdkPixbuf *pixbuf;
|
cairo_surface_t *surface;
|
||||||
GdkRGBA color;
|
GdkRGBA color;
|
||||||
|
|
||||||
row = gtk_list_box_row_new ();
|
row = gtk_list_box_row_new ();
|
||||||
@@ -905,8 +905,8 @@ make_row_from_source (GcalWindow *window,
|
|||||||
|
|
||||||
/* source color icon */
|
/* source color icon */
|
||||||
get_color_name_from_source (source, &color);
|
get_color_name_from_source (source, &color);
|
||||||
pixbuf = get_circle_pixbuf_from_color (&color, 16);
|
surface = get_circle_surface_from_color (&color, 16);
|
||||||
icon = gtk_image_new_from_pixbuf (pixbuf);
|
icon = gtk_image_new_from_surface (surface);
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (icon), "calendar-color-image");
|
gtk_style_context_add_class (gtk_widget_get_style_context (icon), "calendar-color-image");
|
||||||
|
|
||||||
@@ -930,7 +930,7 @@ make_row_from_source (GcalWindow *window,
|
|||||||
|
|
||||||
gtk_widget_show_all (row);
|
gtk_widget_show_all (row);
|
||||||
|
|
||||||
g_object_unref (pixbuf);
|
g_clear_pointer (&surface, cairo_surface_destroy);
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user