gcal-view: cleaned GcalView API

Removed GcalView:remove_by_uuid method.
Reordered gcal-view header file.
This commit is contained in:
Erick Pérez Castellanos
2014-12-04 17:10:25 -05:00
parent f4179ec990
commit a5157748bc
6 changed files with 33 additions and 42 deletions
-2
View File
@@ -14,8 +14,6 @@ TODO
- Rework GcalViews to implement the new API (remove every "New API" comment)
- Review views title string: "Year 2013", shouldn't say "Year"
- Review gtk-styles.css file for actually working css definitions
- Checkout the need ot GcalView:remove_by_uuid (could be replaced by)
GcalView:get_by_uuid ** gtk_widget_destroy
- Add css file and svg image to resources files
- Reorder funcs inside GcalWindow
- Fix nav-button css to matches pushed-down state (font-color goes white)
-1
View File
@@ -213,7 +213,6 @@ gcal_month_view_init (GcalMonthView *self)
static void
gcal_view_interface_init (GcalViewIface *iface)
{
iface->remove_by_uuid = gcal_month_view_remove_by_uuid;
iface->reposition_child = gcal_month_view_reposition_child;
iface->clear_selection = gcal_month_view_clear_selection;
+20 -20
View File
@@ -115,26 +115,6 @@ gcal_view_get_date (GcalView *view)
return date;
}
void
gcal_view_remove_by_uuid (GcalView *view,
const gchar *uuid)
{
g_return_if_fail (GCAL_IS_VIEW (view));
g_return_if_fail (GCAL_VIEW_GET_INTERFACE (view)->remove_by_uuid);
GCAL_VIEW_GET_INTERFACE (view)->remove_by_uuid (view, uuid);
}
GtkWidget*
gcal_view_get_by_uuid (GcalView *view,
const gchar *uuid)
{
g_return_val_if_fail (GCAL_IS_VIEW (view), NULL);
g_return_if_fail (GCAL_VIEW_GET_INTERFACE (view)->get_by_uuid);
return GCAL_VIEW_GET_INTERFACE (view)->get_by_uuid (view, uuid);
}
void
gcal_view_reposition_child (GcalView *view,
const gchar *uuid)
@@ -282,3 +262,23 @@ gcal_view_get_right_header (GcalView *view)
return GCAL_VIEW_GET_INTERFACE (view)->get_right_header (view);
}
/**
* gcal_view_get_by_uuid:
* @view: a #GcalView
* @uuid: the uuid of the event-widget
*
* The uuid is formed by source-uid:event-uid, and the widget with
* this uuid is fetched by this method
*
* Returns: a #GcalEventWidget as #GtkWidget
**/
GtkWidget*
gcal_view_get_by_uuid (GcalView *view,
const gchar *uuid)
{
g_return_val_if_fail (GCAL_IS_VIEW (view), NULL);
g_return_if_fail (GCAL_VIEW_GET_INTERFACE (view)->get_by_uuid);
return GCAL_VIEW_GET_INTERFACE (view)->get_by_uuid (view, uuid);
}
+6 -9
View File
@@ -51,9 +51,6 @@ struct _GcalViewIface
void (*create_event) (GcalView *view, icaltimetype *start_span, icaltimetype *end_span, gdouble x, gdouble y);
void (*updated) (GcalView *view, icaltimetype *date);
/* Container functions related API */
void (*remove_by_uuid) (GcalView *view, const gchar *uuid);
GtkWidget* (*get_by_uuid) (GcalView *view, const gchar *uuid);
void (*reposition_child) (GcalView *view, const gchar *uuid);
/* FIXME remove me in favor of the one below */
@@ -75,6 +72,9 @@ struct _GcalViewIface
/* Update NavBar headings */
gchar* (*get_left_header) (GcalView *view);
gchar* (*get_right_header) (GcalView *view);
/* Container functions related API */
GtkWidget* (*get_by_uuid) (GcalView *view, const gchar *uuid);
};
GType gcal_view_get_type (void);
@@ -85,12 +85,6 @@ void gcal_view_set_date (GcalView *view,
icaltimetype* gcal_view_get_date (GcalView *view);
void gcal_view_remove_by_uuid (GcalView *view,
const gchar *uuid);
GtkWidget* gcal_view_get_by_uuid (GcalView *view,
const gchar *uuid);
void gcal_view_reposition_child (GcalView *view,
const gchar *uuid);
@@ -116,6 +110,9 @@ gchar* gcal_view_get_left_header (GcalView *view);
gchar* gcal_view_get_right_header (GcalView *view);
GtkWidget* gcal_view_get_by_uuid (GcalView *view,
const gchar *uuid);
G_END_DECLS
#endif /* __GCAL_MONTH_VIEW_H__ */
+1 -2
View File
@@ -236,9 +236,8 @@ gcal_view_interface_init (GcalViewIface *iface)
{
iface->get_initial_date = gcal_week_view_get_initial_date;
iface->get_final_date = gcal_week_view_get_final_date;
iface->contains_date = gcal_week_view_contains_date;
iface->remove_by_uuid = gcal_week_view_remove_by_uuid;
iface->get_by_uuid = gcal_week_view_get_by_uuid;
}
+6 -8
View File
@@ -208,21 +208,19 @@ gcal_year_view_init (GcalYearView *self)
static void
gcal_view_interface_init (GcalViewIface *iface)
{
iface->get_initial_date = gcal_year_view_get_initial_date;
iface->get_final_date = gcal_year_view_get_final_date;
iface->contains_date = gcal_year_view_contains_date;
iface->remove_by_uuid = gcal_year_view_remove_by_uuid;
iface->get_by_uuid = gcal_year_view_get_by_uuid;
iface->reposition_child = gcal_year_view_reposition_child;
iface->clear_selection = gcal_year_view_clear_selection;
iface->create_event_on_current_unit = gcal_year_view_create_event_on_current_unit;
/* New API */
iface->get_initial_date = gcal_year_view_get_initial_date;
iface->get_final_date = gcal_year_view_get_final_date;
iface->contains_date = gcal_year_view_contains_date;
iface->get_left_header = gcal_year_view_get_left_header;
iface->get_right_header = gcal_year_view_get_right_header;
iface->get_by_uuid = gcal_year_view_get_by_uuid;
}
static void