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



commit a6a54a2b24afa0f4e3827e60d66285358432109d
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 d93ad74..83db78d 100644
--- a/src/gcal-utils.c
+++ b/src/gcal-utils.c
@@ -686,3 +686,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 e4f6cc9..cbc8e7d 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>
@@ -106,4 +107,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]