aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-calendar-item.c
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/misc/e-calendar-item.c')
-rw-r--r--widgets/misc/e-calendar-item.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 4a53b10e96..6a7e4494d2 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -37,7 +37,6 @@
#include <gtk/gtkmenuitem.h>
#include <gtk/gtklabel.h>
#include <gtk/gtksignal.h>
-#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
@@ -214,6 +213,7 @@ static void e_calendar_item_on_menu_item_activate(GtkWidget *menuitem,
static void e_calendar_item_position_menu (GtkMenu *menu,
gint *x,
gint *y,
+ gboolean *push_in,
gpointer user_data);
static void e_calendar_item_date_range_changed (ECalendarItem *calitem);
static void e_calendar_item_queue_signal_emission (ECalendarItem *calitem);
@@ -291,10 +291,10 @@ e_calendar_item_class_init (ECalendarItemClass *class)
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE,
ARG_Y2);
gtk_object_add_arg_type ("ECalendarItem::font",
- GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE,
+ GTK_TYPE_POINTER, GTK_ARG_READWRITE,
ARG_FONT);
gtk_object_add_arg_type ("ECalendarItem::week_number_font",
- GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE,
+ GTK_TYPE_POINTER, GTK_ARG_READWRITE,
ARG_WEEK_NUMBER_FONT);
gtk_object_add_arg_type ("ECalendarItem::row_height",
GTK_TYPE_INT, GTK_ARG_READABLE,
@@ -339,22 +339,18 @@ e_calendar_item_class_init (ECalendarItemClass *class)
e_calendar_item_signals[DATE_RANGE_CHANGED] =
gtk_signal_new ("date_range_changed",
GTK_RUN_FIRST,
- object_class->type,
+ GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (ECalendarItemClass, date_range_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
e_calendar_item_signals[SELECTION_CHANGED] =
gtk_signal_new ("selection_changed",
GTK_RUN_FIRST,
- object_class->type,
+ GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (ECalendarItemClass, selection_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
- gtk_object_class_add_signals (object_class, e_calendar_item_signals,
- LAST_SIGNAL);
-
-
object_class->destroy = e_calendar_item_destroy;
object_class->get_arg = e_calendar_item_get_arg;
object_class->set_arg = e_calendar_item_set_arg;
@@ -737,8 +733,11 @@ e_calendar_item_unrealize (GnomeCanvasItem *item)
colormap = gtk_widget_get_colormap (GTK_WIDGET (item->canvas));
- for (i = 0; i < E_CALENDAR_ITEM_COLOR_LAST; i++)
- gdk_colors_free (colormap, &calitem->colors[i].pixel, 1, 0);
+ for (i = 0; i < E_CALENDAR_ITEM_COLOR_LAST; i++) {
+ /* FIXME: gdk_colors_free expects gulong* here but the pixel value in GdkColor
+ is guint32. GDK bug? */
+ gdk_colors_free (colormap, (gulong *) &calitem->colors[i].pixel, 1, 0);
+ }
if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize)
(* GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize) (item);
@@ -779,8 +778,8 @@ e_calendar_item_update (GnomeCanvasItem *item,
calitem = E_CALENDAR_ITEM (item);
style = GTK_WIDGET (item->canvas)->style;
- xthickness = style->klass->xthickness;
- ythickness = style->klass->ythickness;
+ xthickness = style->xthickness;
+ ythickness = style->ythickness;
item->x1 = calitem->x1;
item->y1 = calitem->y1;
@@ -831,7 +830,7 @@ e_calendar_item_update (GnomeCanvasItem *item,
font = calitem->font;
if (!font)
- font = style->font;
+ font = gtk_style_get_font (style);
char_height = font->ascent + font->descent;
calitem->month_width = calitem->min_month_width;
@@ -911,10 +910,10 @@ e_calendar_item_draw (GnomeCanvasItem *canvas_item,
style = GTK_WIDGET (canvas_item->canvas)->style;
font = calitem->font;
if (!font)
- font = style->font;
+ font = gtk_style_get_font (style);
char_height = font->ascent + font->descent;
- xthickness = style->klass->xthickness;
- ythickness = style->klass->ythickness;
+ xthickness = style->xthickness;
+ ythickness = style->ythickness;
base_gc = style->base_gc[GTK_STATE_NORMAL];
bg_gc = style->bg_gc[GTK_STATE_NORMAL];
@@ -1010,10 +1009,10 @@ e_calendar_item_draw_month (ECalendarItem *calitem,
style = widget->style;
font = calitem->font;
if (!font)
- font = style->font;
+ font = gtk_style_get_font (style);
char_height = font->ascent + font->descent;
- xthickness = style->klass->xthickness;
- ythickness = style->klass->ythickness;
+ xthickness = style->xthickness;
+ ythickness = style->ythickness;
fg_gc = style->fg_gc[GTK_STATE_NORMAL];
/* Calculate the top-left position of the entire month display. */
@@ -1047,7 +1046,7 @@ e_calendar_item_draw_month (ECalendarItem *calitem,
else
max_x -= E_CALENDAR_ITEM_XPAD_AFTER_MONTH_NAME;
- text_y = month_y + style->klass->ythickness
+ text_y = month_y + style->ythickness
+ E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME;
clip_rect.x = month_x + min_x;
clip_rect.x = MAX (0, clip_rect.x);
@@ -1190,7 +1189,7 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
style = widget->style;
font = calitem->font;
if (!font)
- font = style->font;
+ font = gtk_style_get_font (style);
wkfont = calitem->week_number_font;
if (!wkfont)
wkfont = font;
@@ -1530,7 +1529,7 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem)
font = calitem->font;
if (!font)
- font = style->font;
+ font = gtk_style_get_font (style);
wkfont = calitem->week_number_font;
if (!wkfont)
wkfont = font;
@@ -1588,7 +1587,7 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem)
+ E_CALENDAR_ITEM_XPAD_AFTER_WEEK_NUMBERS + 1;
}
- calitem->min_month_height = style->klass->ythickness * 2
+ calitem->min_month_height = style->ythickness * 2
+ E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME + char_height
+ E_CALENDAR_ITEM_YPAD_BELOW_MONTH_NAME + 1
+ E_CALENDAR_ITEM_YPAD_ABOVE_DAY_LETTERS
@@ -1967,9 +1966,9 @@ e_calendar_item_convert_position_to_day (ECalendarItem *calitem,
item = GNOME_CANVAS_ITEM (calitem);
widget = GTK_WIDGET (item->canvas);
style = widget->style;
- char_height = style->font->ascent + style->font->descent;
- xthickness = style->klass->xthickness;
- ythickness = style->klass->ythickness;
+ char_height = gtk_style_get_font (style)->ascent + gtk_style_get_font (style)->descent;
+ xthickness = style->xthickness;
+ ythickness = style->ythickness;
*entire_week = FALSE;
@@ -2848,6 +2847,7 @@ static void
e_calendar_item_position_menu (GtkMenu *menu,
gint *x,
gint *y,
+ gboolean *push_in,
gpointer user_data)
{
GtkRequisition requisition;
@@ -2926,9 +2926,7 @@ e_calendar_item_signal_emission_idle_cb (gpointer data)
e_calendar_item_signals[DATE_RANGE_CHANGED]);
}
- if (GTK_OBJECT_DESTROYED (calitem)) {
- g_warning ("e_calendar_item_signal_emission_idle_cb: item destroyed");
- } else if (calitem->selection_changed) {
+ if (calitem->selection_changed) {
calitem->selection_changed = FALSE;
gtk_signal_emit (GTK_OBJECT (calitem),
e_calendar_item_signals[SELECTION_CHANGED]);