[empathy] add empathy_theme_manager_dup_theme_name_from_path()



commit 5e112661cca767870225936428515a82b2f6f82c
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Jul 2 12:57:36 2012 +0200

    add empathy_theme_manager_dup_theme_name_from_path()

 libempathy-gtk/empathy-theme-manager.c |   20 ++++++++++++++++++++
 libempathy-gtk/empathy-theme-manager.h |    2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-theme-manager.c b/libempathy-gtk/empathy-theme-manager.c
index 9999de0..1f66116 100644
--- a/libempathy-gtk/empathy-theme-manager.c
+++ b/libempathy-gtk/empathy-theme-manager.c
@@ -416,3 +416,23 @@ empathy_theme_manager_find_theme (const gchar *name)
 
   return NULL;
 }
+
+gchar *
+empathy_theme_manager_dup_theme_name_from_path (const gchar *path)
+{
+  gchar *fullname, *result;
+  gchar **tmp;
+
+  if (path == NULL)
+    return NULL;
+
+  fullname = g_path_get_basename (path);
+  if (!g_str_has_suffix (fullname, ".AdiumMessageStyle"))
+    return NULL;
+
+  tmp = g_strsplit (fullname, ".AdiumMessageStyle", 0);
+  result = g_strdup (tmp[0]);
+
+  g_strfreev (tmp);
+  return result;
+}
diff --git a/libempathy-gtk/empathy-theme-manager.h b/libempathy-gtk/empathy-theme-manager.h
index ab756cc..d4d755b 100644
--- a/libempathy-gtk/empathy-theme-manager.h
+++ b/libempathy-gtk/empathy-theme-manager.h
@@ -72,6 +72,8 @@ GList * empathy_theme_manager_get_adium_themes (void);
 EmpathyChatView * empathy_theme_manager_create_view (EmpathyThemeManager *self);
 gchar * empathy_theme_manager_find_theme (const gchar *name);
 
+gchar * empathy_theme_manager_dup_theme_name_from_path (const gchar *path);
+
 G_END_DECLS
 
 #endif /* __EMPATHY_THEME_MANAGER_H__ */



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