[gnome-calendar] gcal-all-day-grid: added :get_by_uuid method
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] gcal-all-day-grid: added :get_by_uuid method
- Date: Thu, 4 Dec 2014 22:22:11 +0000 (UTC)
commit 8644ad892171138a49d3ed2e52443c428ed2ad27
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Tue Jun 11 17:14:40 2013 -0400
gcal-all-day-grid: added :get_by_uuid method
Added GcalView:get_by_uuid like method to use from GcalDayView and GcalWeekView
src/gcal-all-day-grid.c | 96 +++++++++++++++++++++++++++++++----------------
src/gcal-all-day-grid.h | 2 +
2 files changed, 66 insertions(+), 32 deletions(-)
---
diff --git a/src/gcal-all-day-grid.c b/src/gcal-all-day-grid.c
index 54a3470..94f7ca5 100644
--- a/src/gcal-all-day-grid.c
+++ b/src/gcal-all-day-grid.c
@@ -19,6 +19,7 @@
*/
#include "gcal-all-day-grid.h"
+#include "gcal-event-widget.h"
#include <string.h>
@@ -632,13 +633,17 @@ gcal_all_day_grid_button_release_event (GtkWidget *widget,
g_debug ("Button released on all-day area");
return FALSE;
}
+
/* GtkContainer API */
-/*
+/**
* gcal_all_day_grid_add:
+ * @container: a #GcalAllDayGrid
+ * @widget: a widget to add
*
* @gtk_container_add implementation. It assumes the widget will go
- * to the first column. If there's no column set, will set columns to 1
- */
+ * to the first column.
+ *
+ **/
static void
gcal_all_day_grid_add (GtkContainer *container,
GtkWidget *widget)
@@ -663,27 +668,24 @@ gcal_all_day_grid_remove (GtkContainer *container,
priv = GCAL_ALL_DAY_GRID (container)->priv;
- if (priv->children != NULL)
+ for (columns = priv->children;
+ columns != NULL;
+ columns = g_list_next (columns))
{
- for (columns = priv->children;
- columns != NULL;
- columns = g_list_next (columns))
+ GList* column = (GList*) columns->data;
+ for (;column != NULL; column = g_list_next (column))
{
- GList* column = (GList*) columns->data;
- for (;column != NULL; column = g_list_next (column))
+ if (widget == (GtkWidget*) column->data)
{
- if (widget == (GtkWidget*) column->data)
- {
- GList* orig = (GList*) columns->data;
- orig = g_list_delete_link (orig, column);
+ GList* orig = (GList*) columns->data;
+ orig = g_list_delete_link (orig, column);
- gtk_widget_unparent (widget);
+ gtk_widget_unparent (widget);
- columns->data = orig;
+ columns->data = orig;
- columns = NULL;
- break;
- }
+ columns = NULL;
+ break;
}
}
}
@@ -701,24 +703,20 @@ gcal_all_day_grid_forall (GtkContainer *container,
priv = GCAL_ALL_DAY_GRID (container)->priv;
- if (priv->children != NULL)
+ columns = priv->children;
+ while (columns)
{
- columns = priv->children;
-
- while (columns)
- {
- GList *column;
+ GList *column;
- column = columns->data;
- columns = columns->next;
+ column = columns->data;
+ columns = columns->next;
- while (column)
- {
- GtkWidget *child = (GtkWidget*) column->data;
- column = column->next;
+ while (column)
+ {
+ GtkWidget *child = (GtkWidget*) column->data;
+ column = column->next;
- (* callback) (child, callback_data);
- }
+ (* callback) (child, callback_data);
}
}
}
@@ -803,3 +801,37 @@ gcal_all_day_grid_place (GcalAllDayGrid *all_day,
gtk_widget_set_parent (widget, GTK_WIDGET (all_day));
}
+
+GtkWidget*
+gcal_all_day_grid_get_by_uuid (GcalAllDayGrid *all_day,
+ const gchar *uuid)
+{
+ GcalAllDayGridPrivate *priv;
+
+ GList* columns;
+
+ priv = all_day->priv;
+
+ columns = priv->children;
+ while (columns)
+ {
+ GList *column;
+
+ column = columns->data;
+ columns = columns->next;
+
+ while (column)
+ {
+ GcalEventWidget *child = GCAL_EVENT_WIDGET ((GtkWidget*) column->data);
+ column = column->next;
+
+ if (g_strcmp0 (uuid,
+ gcal_event_widget_peek_uuid (child)) == 0)
+ {
+ return (GtkWidget*) child;
+ }
+ }
+ }
+
+ return NULL;
+}
diff --git a/src/gcal-all-day-grid.h b/src/gcal-all-day-grid.h
index b586eeb..aac44be 100644
--- a/src/gcal-all-day-grid.h
+++ b/src/gcal-all-day-grid.h
@@ -59,6 +59,8 @@ void gcal_all_day_grid_place (GcalAllDayGrid *all_day,
GtkWidget *widget,
guint column_idx);
+GtkWidget* gcal_all_day_grid_get_by_uuid (GcalAllDayGrid *all_day,
+ const gchar *uuid);
G_END_DECLS
#endif /* __GCAL_ALL_DAY_GRID_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]