gcal-utils: pass size to gcal_get_pixbuf_from_color
This commit is contained in:
@@ -420,7 +420,7 @@ gcal_edit_dialog_calendar_selected (GtkWidget *menu_item,
|
|||||||
gtk_tree_iter_free (priv->active_iter);
|
gtk_tree_iter_free (priv->active_iter);
|
||||||
priv->active_iter = gtk_tree_iter_copy (iter);
|
priv->active_iter = gtk_tree_iter_copy (iter);
|
||||||
|
|
||||||
pix = gcal_get_pixbuf_from_color (color);
|
pix = gcal_get_pixbuf_from_color (color, 24);
|
||||||
cal_image = gtk_image_new_from_pixbuf (pix);
|
cal_image = gtk_image_new_from_pixbuf (pix);
|
||||||
gtk_button_set_image (GTK_BUTTON (priv->calendar_button), cal_image);
|
gtk_button_set_image (GTK_BUTTON (priv->calendar_button), cal_image);
|
||||||
|
|
||||||
@@ -462,7 +462,7 @@ gcal_edit_dialog_set_calendar_selected (GcalEditDialog *dialog)
|
|||||||
gtk_tree_iter_free (priv->active_iter);
|
gtk_tree_iter_free (priv->active_iter);
|
||||||
priv->active_iter = gtk_tree_iter_copy (&iter);
|
priv->active_iter = gtk_tree_iter_copy (&iter);
|
||||||
|
|
||||||
pix = gcal_get_pixbuf_from_color (color);
|
pix = gcal_get_pixbuf_from_color (color, 24);
|
||||||
cal_image = gtk_image_new_from_pixbuf (pix);
|
cal_image = gtk_image_new_from_pixbuf (pix);
|
||||||
gtk_button_set_image (GTK_BUTTON (priv->calendar_button), cal_image);
|
gtk_button_set_image (GTK_BUTTON (priv->calendar_button), cal_image);
|
||||||
|
|
||||||
@@ -1035,7 +1035,7 @@ gcal_edit_dialog_set_manager (GcalEditDialog *dialog,
|
|||||||
G_CALLBACK (gcal_edit_dialog_calendar_selected),
|
G_CALLBACK (gcal_edit_dialog_calendar_selected),
|
||||||
dialog);
|
dialog);
|
||||||
|
|
||||||
pix = gcal_get_pixbuf_from_color (color);
|
pix = gcal_get_pixbuf_from_color (color, 24);
|
||||||
|
|
||||||
cal_image = gtk_image_new_from_pixbuf (pix);
|
cal_image = gtk_image_new_from_pixbuf (pix);
|
||||||
g_object_set (item,
|
g_object_set (item,
|
||||||
|
|||||||
+5
-6
@@ -234,28 +234,27 @@ gcal_get_month_name (gint i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GdkPixbuf*
|
GdkPixbuf*
|
||||||
gcal_get_pixbuf_from_color (GdkColor *color)
|
gcal_get_pixbuf_from_color (GdkColor *color,
|
||||||
|
gint size)
|
||||||
{
|
{
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
gint width, height;
|
|
||||||
GdkPixbuf *pix;
|
GdkPixbuf *pix;
|
||||||
|
|
||||||
/* TODO: review size here, maybe not hardcoded */
|
/* TODO: review size here, maybe not hardcoded */
|
||||||
width = height = 10;
|
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
|
||||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
|
|
||||||
cr = cairo_create (surface);
|
cr = cairo_create (surface);
|
||||||
|
|
||||||
cairo_set_source_rgb (cr,
|
cairo_set_source_rgb (cr,
|
||||||
color->red / 65535.0,
|
color->red / 65535.0,
|
||||||
color->green / 65535.0,
|
color->green / 65535.0,
|
||||||
color->blue / 65535.0);
|
color->blue / 65535.0);
|
||||||
cairo_rectangle (cr, 0, 0, width, height);
|
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,
|
pix = gdk_pixbuf_get_from_surface (surface,
|
||||||
0, 0,
|
0, 0,
|
||||||
width, height);
|
size, size);
|
||||||
cairo_surface_destroy (surface);
|
cairo_surface_destroy (surface);
|
||||||
return pix;
|
return pix;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -67,7 +67,8 @@ 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 (GdkColor *color);
|
GdkPixbuf* gcal_get_pixbuf_from_color (GdkColor *color,
|
||||||
|
gint size);
|
||||||
|
|
||||||
gint gcal_compare_event_widget_by_date (gconstpointer a,
|
gint gcal_compare_event_widget_by_date (gconstpointer a,
|
||||||
gconstpointer b);
|
gconstpointer b);
|
||||||
|
|||||||
Reference in New Issue
Block a user