[gnome-calendar/calendar-editor] utils: add helper function to retrieve parent source data



commit 78bc433b5bc65d2f4c80c87833cd2cff2687bcfe
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Apr 7 17:22:49 2015 -0300

    utils: add helper function to retrieve parent source data

 src/gcal-utils.c |   18 ++++++++++++++++++
 src/gcal-utils.h |    6 ++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-utils.c b/src/gcal-utils.c
index 049b202..a218458 100644
--- a/src/gcal-utils.c
+++ b/src/gcal-utils.c
@@ -683,3 +683,21 @@ uri_get_fields (const gchar  *uri,
   g_regex_unref (regex);
   return valid;
 }
+
+void
+get_source_parent_name_color (GcalManager  *manager,
+                              ESource      *source,
+                              gchar       **name,
+                              gchar       **color)
+{
+  ESource *parent_source;
+
+  g_assert (source && E_IS_SOURCE (source));
+
+  parent_source = gcal_manager_get_source (manager, e_source_get_parent (source));
+
+  if (name)
+    *name = e_source_dup_display_name (parent_source);
+  if (color)
+    *color = g_strdup (get_color_name_from_source (parent_source));
+}
diff --git a/src/gcal-utils.h b/src/gcal-utils.h
index 3ba631b..2e699c4 100644
--- a/src/gcal-utils.h
+++ b/src/gcal-utils.h
@@ -20,6 +20,7 @@
 #ifndef __GCAL_UTILS_H__
 #define __GCAL_UTILS_H__
 
+#include "gcal-manager.h"
 #include <gtk/gtk.h>
 #include <libecal/libecal.h>
 #include <libical/icaltime.h>
@@ -105,4 +106,9 @@ gboolean        uri_get_fields                                  (const gchar
                                                                  gchar                **host,
                                                                  gchar                **path);
 
+void            get_source_parent_name_color                    (GcalManager           *manager,
+                                                                 ESource               *source,
+                                                                 gchar                **name,
+                                                                 gchar                **color);
+
 #endif // __GCAL_UTILS_H__


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]