Added regions to view.
Fixed/renamed/changed some classes names for css styling. Fixed size_allocate, now taking into account regions differents font sizes.
This commit is contained in:
+21
-15
@@ -30,31 +30,37 @@
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.views {
|
||||
padding: 10px;
|
||||
.calendar-view header {
|
||||
font: bold 12;
|
||||
}
|
||||
|
||||
.views:selected {
|
||||
.calendar-view {
|
||||
padding: 12px;
|
||||
font: 10;
|
||||
}
|
||||
|
||||
.calendar-view:selected {
|
||||
background-color: #555753;
|
||||
}
|
||||
|
||||
.event-view .frame {
|
||||
border-style: solid;
|
||||
border-color: @borders;
|
||||
border-width: 0.5px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* TODO: not working */
|
||||
.event-view .view {
|
||||
box-shadow: 40px 40px black;
|
||||
}
|
||||
|
||||
.event {
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
font: 10;
|
||||
}
|
||||
|
||||
.event-details .frame {
|
||||
border-style: solid;
|
||||
border-color: @borders;
|
||||
border-width: 0.5px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* TODO: not working */
|
||||
.event-details .view {
|
||||
box-shadow: 40px 40px black;
|
||||
}
|
||||
|
||||
GtkClutterOffscreen.overlay {
|
||||
|
||||
@@ -102,14 +102,13 @@ gcal_event_view_class_init(GcalEventViewClass *klass)
|
||||
|
||||
static void gcal_event_view_init(GcalEventView *self)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
|
||||
GCAL_TYPE_EVENT_VIEW,
|
||||
GcalEventViewPrivate);
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (self));
|
||||
gtk_style_context_add_class (context, "event-view");
|
||||
gtk_style_context_add_class (
|
||||
gtk_widget_get_style_context (GTK_WIDGET (self)),
|
||||
"event-details");
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -180,6 +180,10 @@ static void gcal_event_widget_init(GcalEventWidget *self)
|
||||
|
||||
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
|
||||
|
||||
gtk_style_context_add_class (
|
||||
gtk_widget_get_style_context (GTK_WIDGET (self)),
|
||||
"event");
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+30
-6
@@ -197,6 +197,10 @@ gcal_month_view_init (GcalMonthView *self)
|
||||
{
|
||||
priv->days[i] = NULL;
|
||||
}
|
||||
|
||||
gtk_style_context_add_class (
|
||||
gtk_widget_get_style_context (GTK_WIDGET (self)),
|
||||
"calendar-view");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -388,16 +392,30 @@ gcal_month_view_size_allocate (GtkWidget *widget,
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
layout = pango_layout_new (gtk_widget_get_pango_context (widget));
|
||||
|
||||
/* init header values */
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_region (context, "header", 0);
|
||||
|
||||
pango_layout_set_font_description (layout,
|
||||
gtk_style_context_get_font (context,
|
||||
state));
|
||||
pango_layout_get_pixel_size (layout, NULL, &font_height);
|
||||
|
||||
/* init values */
|
||||
priv->header_size = font_height + 4;
|
||||
priv->grid_header_size = font_height + 4;
|
||||
/* 6: is padding around the header */
|
||||
priv->header_size = font_height + 6;
|
||||
gtk_style_context_remove_region (context, "header");
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
/* init grid values */
|
||||
pango_layout_set_font_description (layout,
|
||||
gtk_style_context_get_font (context,
|
||||
state));
|
||||
pango_layout_get_pixel_size (layout, NULL, &font_height);
|
||||
/* 6: is padding around the header */
|
||||
priv->grid_header_size = font_height + 6;
|
||||
|
||||
priv->horizontal_step =
|
||||
(allocation->width - (allocation->x + padding.left + padding.right)) / 7;
|
||||
priv->vertical_step =
|
||||
@@ -679,6 +697,9 @@ gcal_month_view_draw_header (GcalMonthView *view,
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (view));
|
||||
state = gtk_widget_get_state_flags (GTK_WIDGET (view));
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_region (context, "header", 0);
|
||||
|
||||
gtk_style_context_get_color (context, state, &color);
|
||||
cairo_set_source_rgba (cr, color.red, color.green, color.blue, color.alpha);
|
||||
|
||||
@@ -686,6 +707,8 @@ gcal_month_view_draw_header (GcalMonthView *view,
|
||||
pango_layout_set_font_description (layout,
|
||||
gtk_style_context_get_font (context,
|
||||
state));
|
||||
gtk_style_context_remove_region (context, "header");
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
tm_date = icaltimetype_to_tm (priv->date);
|
||||
e_utf8_strftime_fix_am_pm (str_date, 64, "%B", &tm_date);
|
||||
@@ -778,9 +801,10 @@ gcal_month_view_draw_grid (GcalMonthView *view,
|
||||
pango_layout_set_text (layout, gcal_get_weekday (i), -1);
|
||||
pango_cairo_update_layout (cr, layout);
|
||||
pango_layout_get_pixel_size (layout, &font_width, &font_height);
|
||||
/* 6: is padding around the grid-header */
|
||||
cairo_move_to (cr,
|
||||
start_grid_x + priv->horizontal_step * i + 1,
|
||||
start_grid_y - font_height - 1);
|
||||
start_grid_x + priv->horizontal_step * i + 6,
|
||||
start_grid_y - priv->grid_header_size);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
|
||||
for (j = 0; j < 5; j++)
|
||||
|
||||
+28
-7
@@ -190,6 +190,10 @@ gcal_week_view_init (GcalWeekView *self)
|
||||
{
|
||||
priv->days[i] = NULL;
|
||||
}
|
||||
|
||||
gtk_style_context_add_class (
|
||||
gtk_widget_get_style_context (GTK_WIDGET (self)),
|
||||
"calendar-view");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -373,18 +377,30 @@ gcal_week_view_size_allocate (GtkWidget *widget,
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
layout = pango_layout_new (gtk_widget_get_pango_context (widget));
|
||||
|
||||
/* init header values */
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_region (context, "header", 0);
|
||||
|
||||
pango_layout_set_font_description (layout,
|
||||
gtk_style_context_get_font (context,
|
||||
state));
|
||||
pango_layout_set_text (layout, _("All day"), -1);
|
||||
pango_layout_get_pixel_size (layout, &font_width, &font_height);
|
||||
pango_layout_get_pixel_size (layout, NULL, &font_height);
|
||||
|
||||
/* init values */
|
||||
/* FIXME: these values should be extracted from the theme font size */
|
||||
priv->header_size = font_height + 4;
|
||||
priv->grid_header_size = font_height + 4;
|
||||
/* 6: is padding around the header */
|
||||
priv->header_size = font_height + 6;
|
||||
gtk_style_context_remove_region (context, "header");
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
/* init grid values */
|
||||
pango_layout_set_text (layout, _("All day"), -1);
|
||||
pango_layout_set_font_description (layout,
|
||||
gtk_style_context_get_font (context,
|
||||
state));
|
||||
pango_layout_get_pixel_size (layout, &font_width, &font_height);
|
||||
/* 6: is padding around the header */
|
||||
priv->grid_header_size = font_height + 6;
|
||||
priv->grid_sidebar_size = font_width + 8;
|
||||
|
||||
priv->horizontal_step = (allocation->width - (allocation->x + padding.left + padding.right + priv->grid_sidebar_size)) / 7;
|
||||
@@ -605,6 +621,9 @@ gcal_week_view_draw_header (GcalWeekView *view,
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (view));
|
||||
state = gtk_widget_get_state_flags (GTK_WIDGET (view));
|
||||
|
||||
gtk_style_context_add_region (context, "header", 0);
|
||||
gtk_style_context_save (context);
|
||||
|
||||
gtk_style_context_get_color (context, state, &color);
|
||||
cairo_set_source_rgba (cr, color.red, color.green, color.blue, color.alpha);
|
||||
|
||||
@@ -612,6 +631,8 @@ gcal_week_view_draw_header (GcalWeekView *view,
|
||||
pango_layout_set_font_description (layout,
|
||||
gtk_style_context_get_font (context,
|
||||
state));
|
||||
gtk_style_context_remove_region (context, "header");
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
start_of_week = gcal_week_view_get_initial_date (view);
|
||||
tm_date = icaltimetype_to_tm (start_of_week);
|
||||
|
||||
@@ -225,9 +225,6 @@ gcal_window_constructed (GObject *object)
|
||||
priv->views[GCAL_VIEW_TYPE_MONTHLY] = gcal_month_view_new (date);
|
||||
g_free (date);
|
||||
|
||||
context = gtk_widget_get_style_context (priv->views[GCAL_VIEW_TYPE_MONTHLY]);
|
||||
gtk_style_context_add_class (context, "views");
|
||||
|
||||
gtk_widget_show (priv->views[GCAL_VIEW_TYPE_MONTHLY]);
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook),
|
||||
priv->views[GCAL_VIEW_TYPE_MONTHLY],
|
||||
@@ -617,8 +614,6 @@ gcal_window_events_added (GcalManager *manager,
|
||||
gtk_container_add (
|
||||
GTK_CONTAINER (priv->views[priv->active_view]),
|
||||
event);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (event),
|
||||
"event");
|
||||
|
||||
g_signal_connect (event,
|
||||
"activated",
|
||||
|
||||
Reference in New Issue
Block a user