views: add time direction property
The time direction property tells which orientation one needs to scroll to change the time of the view. In these directions (up/down v left/right) the new prev/next buttons will be pointing. The two buttons will be added in a subsequent commit, and will gain view-dependent tooltips. Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it> Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/542>
This commit is contained in:
committed by
Marge Bot
parent
d400048bc6
commit
4a4dce8ee3
@@ -102,6 +102,7 @@ enum
|
||||
PROP_SPLIT_MONTH_YEAR,
|
||||
PROP_DATE,
|
||||
PROP_CONTEXT,
|
||||
PROP_TIME_DIRECTION,
|
||||
NUM_PROPERTIES = PROP_SPLIT_MONTH_YEAR + 1,
|
||||
};
|
||||
|
||||
@@ -739,6 +740,10 @@ calendar_get_property (GObject *obj,
|
||||
g_value_set_boolean (value, self->split_month_year);
|
||||
break;
|
||||
|
||||
case PROP_TIME_DIRECTION:
|
||||
g_value_set_enum (value, GTK_ORIENTATION_VERTICAL);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
|
||||
break;
|
||||
@@ -894,6 +899,7 @@ gcal_date_chooser_class_init (GcalDateChooserClass *class)
|
||||
|
||||
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
||||
g_object_class_override_property (object_class, PROP_CONTEXT, "context");
|
||||
g_object_class_override_property (object_class, PROP_TIME_DIRECTION, "time-direction");
|
||||
|
||||
signals[DAY_SELECTED] = g_signal_new ("day-selected",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
|
||||
@@ -70,6 +70,7 @@ enum
|
||||
PROP_0,
|
||||
PROP_DATE,
|
||||
PROP_CONTEXT,
|
||||
PROP_TIME_DIRECTION,
|
||||
N_PROPS,
|
||||
};
|
||||
|
||||
@@ -763,6 +764,10 @@ gcal_agenda_view_get_property (GObject *object,
|
||||
g_value_set_object (value, self->context);
|
||||
break;
|
||||
|
||||
case PROP_TIME_DIRECTION:
|
||||
g_value_set_enum (value, GTK_ORIENTATION_VERTICAL);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@@ -782,6 +787,7 @@ gcal_agenda_view_class_init (GcalAgendaViewClass *klass)
|
||||
|
||||
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
||||
g_object_class_override_property (object_class, PROP_CONTEXT, "context");
|
||||
g_object_class_override_property (object_class, PROP_TIME_DIRECTION, "time-direction");
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/views/gcal-agenda-view.ui");
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ enum
|
||||
PROP_0,
|
||||
PROP_CONTEXT,
|
||||
PROP_DATE,
|
||||
PROP_TIME_DIRECTION,
|
||||
N_PROPS,
|
||||
};
|
||||
|
||||
@@ -1592,6 +1593,10 @@ gcal_month_view_get_property (GObject *object,
|
||||
g_value_set_object (value, self->context);
|
||||
break;
|
||||
|
||||
case PROP_TIME_DIRECTION:
|
||||
g_value_set_enum (value, GTK_ORIENTATION_VERTICAL);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@@ -1644,6 +1649,7 @@ gcal_month_view_class_init (GcalMonthViewClass *klass)
|
||||
|
||||
g_object_class_override_property (object_class, PROP_CONTEXT, "context");
|
||||
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
||||
g_object_class_override_property (object_class, PROP_TIME_DIRECTION, "time-direction");
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/views/gcal-month-view.ui");
|
||||
|
||||
|
||||
@@ -66,6 +66,19 @@ gcal_view_default_init (GcalViewInterface *iface)
|
||||
GCAL_TYPE_CONTEXT,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GcalView::time-direction:
|
||||
*
|
||||
* Orientation determining in which direction time is going for the view
|
||||
*/
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_enum ("time-direction",
|
||||
NULL,
|
||||
NULL,
|
||||
GTK_TYPE_ORIENTATION,
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
/**
|
||||
* GcalView::create-event:
|
||||
*
|
||||
@@ -148,6 +161,26 @@ gcal_view_get_context (GcalView *self)
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_view_get_time_direction:
|
||||
* @self: a #GcalView
|
||||
*
|
||||
* Retrieves the orientation of the direction in which the view visualises time.
|
||||
*
|
||||
* Returns: (transfer none): a #GtkOrientation
|
||||
*/
|
||||
GtkOrientation
|
||||
gcal_view_get_time_direction (GcalView *self)
|
||||
{
|
||||
GtkOrientation time_direction;
|
||||
|
||||
g_return_val_if_fail (GCAL_IS_VIEW (self), GTK_ORIENTATION_VERTICAL);
|
||||
|
||||
g_object_get (self, "time-direction", &time_direction, NULL);
|
||||
|
||||
return time_direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* gcal_view_get_date:
|
||||
* @view: a #GcalView
|
||||
|
||||
@@ -66,6 +66,8 @@ GDateTime* gcal_view_get_date (GcalView
|
||||
|
||||
GcalContext* gcal_view_get_context (GcalView *self);
|
||||
|
||||
GtkOrientation gcal_view_get_time_direction (GcalView *self);
|
||||
|
||||
void gcal_view_clear_marks (GcalView *view);
|
||||
|
||||
GList* gcal_view_get_children_by_uuid (GcalView *view,
|
||||
|
||||
@@ -75,6 +75,7 @@ enum
|
||||
PROP_0,
|
||||
PROP_DATE,
|
||||
PROP_CONTEXT,
|
||||
PROP_TIME_DIRECTION,
|
||||
NUM_PROPS
|
||||
};
|
||||
|
||||
@@ -615,6 +616,10 @@ gcal_week_view_get_property (GObject *object,
|
||||
g_value_set_object (value, self->context);
|
||||
break;
|
||||
|
||||
case PROP_TIME_DIRECTION:
|
||||
g_value_set_enum (value, GTK_ORIENTATION_HORIZONTAL);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@@ -637,6 +642,7 @@ gcal_week_view_class_init (GcalWeekViewClass *klass)
|
||||
|
||||
g_object_class_override_property (object_class, PROP_DATE, "active-date");
|
||||
g_object_class_override_property (object_class, PROP_CONTEXT, "context");
|
||||
g_object_class_override_property (object_class, PROP_TIME_DIRECTION, "time-direction");
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/views/gcal-week-view.ui");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user