utils: add helper function to retrieve parent source data

This commit is contained in:
Georges Basile Stavracas Neto
2015-05-25 12:35:30 -04:00
committed by Erick Pérez Castellanos
parent 80d6e32fba
commit a6a54a2b24
2 changed files with 24 additions and 0 deletions
+18
View File
@@ -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));
}
+6
View File
@@ -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__