]> git.0d.be Git - empathy.git/commitdiff
Move empathy-contact-groups to libempathy, it has nothing to do in -gtk
authorXavier Claessens <xclaesse@src.gnome.org>
Mon, 21 Jan 2008 14:12:28 +0000 (14:12 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Mon, 21 Jan 2008 14:12:28 +0000 (14:12 +0000)
svn path=/trunk/; revision=592

libempathy-gtk/Makefile.am
libempathy-gtk/empathy-contact-groups.c [deleted file]
libempathy-gtk/empathy-contact-groups.dtd [deleted file]
libempathy-gtk/empathy-contact-groups.h [deleted file]
libempathy-gtk/empathy-contact-list-view.c
libempathy/Makefile.am
libempathy/empathy-contact-groups.c [new file with mode: 0644]
libempathy/empathy-contact-groups.dtd [new file with mode: 0644]
libempathy/empathy-contact-groups.h [new file with mode: 0644]

index 002762138d24185d141c8b72c16c9feb5e9152c2..721bd82e22e5e2f0b57617e30f3f64e508f8173e 100644 (file)
@@ -28,7 +28,6 @@ libempathy_gtk_la_SOURCES =                   \
        empathy-cell-renderer-activatable.c     \
        empathy-spell.c                         \
        empathy-spell-dialog.c                  \
-       empathy-contact-groups.c                \
        empathy-contact-list-store.c            \
        empathy-contact-list-view.c             \
        empathy-preferences.c                   \
@@ -83,7 +82,6 @@ libempathy_gtk_headers =                      \
        empathy-cell-renderer-activatable.h     \
        empathy-spell.h                         \
        empathy-spell-dialog.h                  \
-       empathy-contact-groups.h                \
        empathy-contact-list-store.h            \
        empathy-contact-list-view.h             \
        empathy-preferences.h                   \
@@ -174,16 +172,11 @@ empathy-gtk-enum-types.c: Makefile $(libempathy_gtk_headers)
        && cp xgen-gtc $(@F) \
        && rm -f xgen-gtc
 
-dtddir = $(datadir)/empathy
-dtd_DATA =                                     \
-       empathy-contact-groups.dtd
-
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libempathy-gtk.pc
 
 EXTRA_DIST =                   \
-       $(glade_DATA)           \
-       $(dtd_DATA)
+       $(glade_DATA)
 
 CLEANFILES =                           \
        $(BUILT_SOURCES)                \
diff --git a/libempathy-gtk/empathy-contact-groups.c b/libempathy-gtk/empathy-contact-groups.c
deleted file mode 100644 (file)
index 1e5fabe..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2005-2007 Imendio AB
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Martyn Russell <martyn@imendio.com>
- */
-
-#include "config.h"
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <glib.h>
-#include <glib/gi18n.h>
-
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-
-#include <libempathy/empathy-debug.h>
-#include <libempathy/empathy-utils.h>
-
-#include "empathy-contact-groups.h"
-
-#define DEBUG_DOMAIN "ContactGroups"
-
-#define CONTACT_GROUPS_XML_FILENAME "contact-groups.xml"
-#define CONTACT_GROUPS_DTD_FILENAME "empathy-contact-groups.dtd"
-
-typedef struct {
-       gchar    *name;
-       gboolean  expanded;
-} ContactGroup;
-
-static void          contact_groups_file_parse (const gchar  *filename);
-static gboolean      contact_groups_file_save  (void);
-static ContactGroup *contact_group_new         (const gchar  *name,
-                                               gboolean      expanded);
-static void          contact_group_free        (ContactGroup *group);
-
-static GList *groups = NULL;
-
-void
-empathy_contact_groups_get_all (void)
-{
-       gchar *dir;
-       gchar *file_with_path;
-
-       /* If already set up clean up first */
-       if (groups) {
-               g_list_foreach (groups, (GFunc)contact_group_free, NULL);
-               g_list_free (groups);
-               groups = NULL;
-       }
-
-       dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
-       file_with_path = g_build_filename (dir, CONTACT_GROUPS_XML_FILENAME, NULL);
-       g_free (dir);
-
-       if (g_file_test (file_with_path, G_FILE_TEST_EXISTS)) {
-               contact_groups_file_parse (file_with_path);
-       }
-
-       g_free (file_with_path);
-}
-
-static void
-contact_groups_file_parse (const gchar *filename)
-{
-       xmlParserCtxtPtr ctxt;
-       xmlDocPtr        doc;
-       xmlNodePtr       contacts;
-       xmlNodePtr       account;
-       xmlNodePtr       node;
-
-       empathy_debug (DEBUG_DOMAIN, "Attempting to parse file:'%s'...", filename);
-
-       ctxt = xmlNewParserCtxt ();
-
-       /* Parse and validate the file. */
-       doc = xmlCtxtReadFile (ctxt, filename, NULL, 0);
-       if (!doc) {
-               g_warning ("Failed to parse file:'%s'", filename);
-               xmlFreeParserCtxt (ctxt);
-               return;
-       }
-
-       if (!empathy_xml_validate (doc, CONTACT_GROUPS_DTD_FILENAME)) {
-               g_warning ("Failed to validate file:'%s'", filename);
-               xmlFreeDoc(doc);
-               xmlFreeParserCtxt (ctxt);
-               return;
-       }
-
-       /* The root node, contacts. */
-       contacts = xmlDocGetRootElement (doc);
-
-       account = NULL;
-       node = contacts->children;
-       while (node) {
-               if (strcmp ((gchar *) node->name, "account") == 0) {
-                       account = node;
-                       break;
-               }
-               node = node->next;
-       }
-
-       node = NULL;
-       if (account) {
-               node = account->children;
-       }
-
-       while (node) {
-               if (strcmp ((gchar *) node->name, "group") == 0) {
-                       gchar        *name;
-                       gchar        *expanded_str;
-                       gboolean      expanded;
-                       ContactGroup *contact_group;
-
-                       name = (gchar *) xmlGetProp (node, "name");
-                       expanded_str = (gchar *) xmlGetProp (node, "expanded");
-
-                       if (expanded_str && strcmp (expanded_str, "yes") == 0) {
-                               expanded = TRUE;
-                       } else {
-                               expanded = FALSE;
-                       }
-
-                       contact_group = contact_group_new (name, expanded);
-                       groups = g_list_append (groups, contact_group);
-
-                       xmlFree (name);
-                       xmlFree (expanded_str);
-               }
-
-               node = node->next;
-       }
-
-       empathy_debug (DEBUG_DOMAIN, "Parsed %d contact groups", g_list_length (groups));
-
-       xmlFreeDoc(doc);
-       xmlFreeParserCtxt (ctxt);
-}
-
-static ContactGroup *
-contact_group_new (const gchar *name,
-                  gboolean     expanded)
-{
-       ContactGroup *group;
-
-       group = g_new0 (ContactGroup, 1);
-
-       group->name = g_strdup (name);
-       group->expanded = expanded;
-
-       return group;
-}
-
-static void
-contact_group_free (ContactGroup *group)
-{
-       g_return_if_fail (group != NULL);
-
-       g_free (group->name);
-
-       g_free (group);
-}
-
-static gboolean
-contact_groups_file_save (void)
-{
-       xmlDocPtr   doc;
-       xmlNodePtr  root;
-       xmlNodePtr  node;
-       GList      *l;
-       gchar      *dir;
-       gchar      *file;
-
-       dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
-       g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
-       file = g_build_filename (dir, CONTACT_GROUPS_XML_FILENAME, NULL);
-       g_free (dir);
-
-       doc = xmlNewDoc ("1.0");
-       root = xmlNewNode (NULL, "contacts");
-       xmlDocSetRootElement (doc, root);
-
-       node = xmlNewChild (root, NULL, "account", NULL);
-       xmlNewProp (node, "name", "Default");
-
-       for (l = groups; l; l = l->next) {
-               ContactGroup *cg;
-               xmlNodePtr    subnode;
-
-               cg = l->data;
-
-               subnode = xmlNewChild (node, NULL, "group", NULL);
-               xmlNewProp (subnode, "expanded", cg->expanded ? "yes" : "no");
-               xmlNewProp (subnode, "name", cg->name);
-       }
-
-       /* Make sure the XML is indented properly */
-       xmlIndentTreeOutput = 1;
-
-       empathy_debug (DEBUG_DOMAIN, "Saving file:'%s'", file);
-       xmlSaveFormatFileEnc (file, doc, "utf-8", 1);
-       xmlFreeDoc (doc);
-
-       xmlCleanupParser ();
-       xmlMemoryDump ();
-
-       g_free (file);
-
-       return TRUE;
-}
-
-gboolean
-empathy_contact_group_get_expanded (const gchar *group)
-{
-       GList    *l;
-       gboolean  default_val = TRUE;
-
-       g_return_val_if_fail (group != NULL, default_val);
-
-       for (l = groups; l; l = l->next) {
-               ContactGroup *cg = l->data;
-
-               if (!cg || !cg->name) {
-                       continue;
-               }
-
-               if (strcmp (cg->name, group) == 0) {
-                       return cg->expanded;
-               }
-       }
-
-       return default_val;
-}
-
-void
-empathy_contact_group_set_expanded (const gchar *group,
-                                  gboolean     expanded)
-{
-       GList        *l;
-       ContactGroup *cg;
-       gboolean      changed = FALSE;
-
-       g_return_if_fail (group != NULL);
-
-       for (l = groups; l; l = l->next) {
-               ContactGroup *cg = l->data;
-
-               if (!cg || !cg->name) {
-                       continue;
-               }
-
-               if (strcmp (cg->name, group) == 0) {
-                       cg->expanded = expanded;
-                       changed = TRUE;
-                       break;
-               }
-       }
-
-       /* if here... we don't have a ContactGroup for the group. */
-       if (!changed) {
-               cg = contact_group_new (group, expanded);
-               groups = g_list_append (groups, cg);
-       }
-
-       contact_groups_file_save ();
-}
diff --git a/libempathy-gtk/empathy-contact-groups.dtd b/libempathy-gtk/empathy-contact-groups.dtd
deleted file mode 100644 (file)
index b4de226..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
-  DTD for Empathys contact groups.
-  by Martyn Russell <mr@gnome.org>
--->
-
-<!-- Root element. -->
-<!ELEMENT contacts (account)>
-
-<!ELEMENT account (group)+>
-<!ATTLIST account 
-       name CDATA #REQUIRED>
-
-<!-- Groups in the roster. -->
-<!ELEMENT group EMPTY>
-<!ATTLIST group
-   name CDATA #REQUIRED
-   expanded CDATA #REQUIRED>
diff --git a/libempathy-gtk/empathy-contact-groups.h b/libempathy-gtk/empathy-contact-groups.h
deleted file mode 100644 (file)
index e2e9810..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2005 Imendio AB
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Martyn Russell <martyn@imendio.com>
- */
-
-#ifndef __EMPATHY_CONTACT_GROUPS_H__
-#define __EMPATHY_CONTACT_GROUPS_H__
-
-G_BEGIN_DECLS
-
-#include <glib.h>
-
-void     empathy_contact_groups_get_all     (void);
-
-gboolean empathy_contact_group_get_expanded (const gchar *group);
-void     empathy_contact_group_set_expanded (const gchar *group,
-                                           gboolean     expanded);
-
-G_END_DECLS
-
-#endif /* __EMPATHY_CONTACT_GROUPS_H__ */
index 35557f10de25bafcbc07492b6506029ba7879d40..78ac3980cd1f0248430e34a9c7f45907c239f096 100644 (file)
@@ -40,6 +40,7 @@
 #include <libempathy/empathy-contact-list.h>
 #include <libempathy/empathy-log-manager.h>
 #include <libempathy/empathy-tp-group.h>
+#include <libempathy/empathy-contact-groups.h>
 #include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-marshal.h>
@@ -47,7 +48,6 @@
 #include "empathy-contact-list-view.h"
 #include "empathy-contact-list-store.h"
 #include "empathy-images.h"
-#include "empathy-contact-groups.h"
 #include "empathy-cell-renderer-expander.h"
 #include "empathy-cell-renderer-text.h"
 #include "empathy-cell-renderer-activatable.h"
index c6c7faa8e4e2dff73dcc3094596ecab3077948bd..e6711c3c642e993045c770ee00747c3f2d57da39 100644 (file)
@@ -20,13 +20,14 @@ libempathy_la_SOURCES =                                     \
        empathy-avatar.c                                \
        empathy-time.c                                  \
        empathy-presence.c                              \
-       empathy-status-presets.c                \
+       empathy-status-presets.c                        \
        empathy-debug.c                                 \
        empathy-utils.c                                 \
        empathy-message.c                               \
        empathy-chatroom-manager.c                      \
        empathy-chatroom.c                              \
        empathy-contact.c                               \
+       empathy-contact-groups.c                        \
        empathy-contact-list.c                          \
        empathy-contact-manager.c                       \
        empathy-contact-factory.c                       \
@@ -64,6 +65,7 @@ libempathy_headers =                          \
        empathy-chatroom-manager.h              \
        empathy-chatroom.h                      \
        empathy-contact.h                       \
+       empathy-contact-groups.h                \
        empathy-contact-list.h                  \
        empathy-contact-manager.h               \
        empathy-contact-factory.h               \
@@ -142,6 +144,7 @@ empathy-enum-types.c: $(libempathy_headers) Makefile
 dtddir = $(datadir)/empathy
 dtd_DATA =                                     \
        empathy-status-presets.dtd              \
+       empathy-contact-groups.dtd              \
        empathy-chatroom-manager.dtd
 
 stylesheetdir = $(datadir)/empathy
diff --git a/libempathy/empathy-contact-groups.c b/libempathy/empathy-contact-groups.c
new file mode 100644 (file)
index 0000000..b71cf66
--- /dev/null
@@ -0,0 +1,285 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2005-2007 Imendio AB
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Martyn Russell <martyn@imendio.com>
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+#include "empathy-debug.h"
+#include "empathy-utils.h"
+#include "empathy-contact-groups.h"
+
+#define DEBUG_DOMAIN "ContactGroups"
+
+#define CONTACT_GROUPS_XML_FILENAME "contact-groups.xml"
+#define CONTACT_GROUPS_DTD_FILENAME "empathy-contact-groups.dtd"
+
+typedef struct {
+       gchar    *name;
+       gboolean  expanded;
+} ContactGroup;
+
+static void          contact_groups_file_parse (const gchar  *filename);
+static gboolean      contact_groups_file_save  (void);
+static ContactGroup *contact_group_new         (const gchar  *name,
+                                               gboolean      expanded);
+static void          contact_group_free        (ContactGroup *group);
+
+static GList *groups = NULL;
+
+void
+empathy_contact_groups_get_all (void)
+{
+       gchar *dir;
+       gchar *file_with_path;
+
+       /* If already set up clean up first */
+       if (groups) {
+               g_list_foreach (groups, (GFunc)contact_group_free, NULL);
+               g_list_free (groups);
+               groups = NULL;
+       }
+
+       dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
+       file_with_path = g_build_filename (dir, CONTACT_GROUPS_XML_FILENAME, NULL);
+       g_free (dir);
+
+       if (g_file_test (file_with_path, G_FILE_TEST_EXISTS)) {
+               contact_groups_file_parse (file_with_path);
+       }
+
+       g_free (file_with_path);
+}
+
+static void
+contact_groups_file_parse (const gchar *filename)
+{
+       xmlParserCtxtPtr ctxt;
+       xmlDocPtr        doc;
+       xmlNodePtr       contacts;
+       xmlNodePtr       account;
+       xmlNodePtr       node;
+
+       empathy_debug (DEBUG_DOMAIN, "Attempting to parse file:'%s'...", filename);
+
+       ctxt = xmlNewParserCtxt ();
+
+       /* Parse and validate the file. */
+       doc = xmlCtxtReadFile (ctxt, filename, NULL, 0);
+       if (!doc) {
+               g_warning ("Failed to parse file:'%s'", filename);
+               xmlFreeParserCtxt (ctxt);
+               return;
+       }
+
+       if (!empathy_xml_validate (doc, CONTACT_GROUPS_DTD_FILENAME)) {
+               g_warning ("Failed to validate file:'%s'", filename);
+               xmlFreeDoc(doc);
+               xmlFreeParserCtxt (ctxt);
+               return;
+       }
+
+       /* The root node, contacts. */
+       contacts = xmlDocGetRootElement (doc);
+
+       account = NULL;
+       node = contacts->children;
+       while (node) {
+               if (strcmp ((gchar *) node->name, "account") == 0) {
+                       account = node;
+                       break;
+               }
+               node = node->next;
+       }
+
+       node = NULL;
+       if (account) {
+               node = account->children;
+       }
+
+       while (node) {
+               if (strcmp ((gchar *) node->name, "group") == 0) {
+                       gchar        *name;
+                       gchar        *expanded_str;
+                       gboolean      expanded;
+                       ContactGroup *contact_group;
+
+                       name = (gchar *) xmlGetProp (node, "name");
+                       expanded_str = (gchar *) xmlGetProp (node, "expanded");
+
+                       if (expanded_str && strcmp (expanded_str, "yes") == 0) {
+                               expanded = TRUE;
+                       } else {
+                               expanded = FALSE;
+                       }
+
+                       contact_group = contact_group_new (name, expanded);
+                       groups = g_list_append (groups, contact_group);
+
+                       xmlFree (name);
+                       xmlFree (expanded_str);
+               }
+
+               node = node->next;
+       }
+
+       empathy_debug (DEBUG_DOMAIN, "Parsed %d contact groups", g_list_length (groups));
+
+       xmlFreeDoc(doc);
+       xmlFreeParserCtxt (ctxt);
+}
+
+static ContactGroup *
+contact_group_new (const gchar *name,
+                  gboolean     expanded)
+{
+       ContactGroup *group;
+
+       group = g_new0 (ContactGroup, 1);
+
+       group->name = g_strdup (name);
+       group->expanded = expanded;
+
+       return group;
+}
+
+static void
+contact_group_free (ContactGroup *group)
+{
+       g_return_if_fail (group != NULL);
+
+       g_free (group->name);
+
+       g_free (group);
+}
+
+static gboolean
+contact_groups_file_save (void)
+{
+       xmlDocPtr   doc;
+       xmlNodePtr  root;
+       xmlNodePtr  node;
+       GList      *l;
+       gchar      *dir;
+       gchar      *file;
+
+       dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
+       g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
+       file = g_build_filename (dir, CONTACT_GROUPS_XML_FILENAME, NULL);
+       g_free (dir);
+
+       doc = xmlNewDoc ("1.0");
+       root = xmlNewNode (NULL, "contacts");
+       xmlDocSetRootElement (doc, root);
+
+       node = xmlNewChild (root, NULL, "account", NULL);
+       xmlNewProp (node, "name", "Default");
+
+       for (l = groups; l; l = l->next) {
+               ContactGroup *cg;
+               xmlNodePtr    subnode;
+
+               cg = l->data;
+
+               subnode = xmlNewChild (node, NULL, "group", NULL);
+               xmlNewProp (subnode, "expanded", cg->expanded ? "yes" : "no");
+               xmlNewProp (subnode, "name", cg->name);
+       }
+
+       /* Make sure the XML is indented properly */
+       xmlIndentTreeOutput = 1;
+
+       empathy_debug (DEBUG_DOMAIN, "Saving file:'%s'", file);
+       xmlSaveFormatFileEnc (file, doc, "utf-8", 1);
+       xmlFreeDoc (doc);
+
+       xmlCleanupParser ();
+       xmlMemoryDump ();
+
+       g_free (file);
+
+       return TRUE;
+}
+
+gboolean
+empathy_contact_group_get_expanded (const gchar *group)
+{
+       GList    *l;
+       gboolean  default_val = TRUE;
+
+       g_return_val_if_fail (group != NULL, default_val);
+
+       for (l = groups; l; l = l->next) {
+               ContactGroup *cg = l->data;
+
+               if (!cg || !cg->name) {
+                       continue;
+               }
+
+               if (strcmp (cg->name, group) == 0) {
+                       return cg->expanded;
+               }
+       }
+
+       return default_val;
+}
+
+void
+empathy_contact_group_set_expanded (const gchar *group,
+                                  gboolean     expanded)
+{
+       GList        *l;
+       ContactGroup *cg;
+       gboolean      changed = FALSE;
+
+       g_return_if_fail (group != NULL);
+
+       for (l = groups; l; l = l->next) {
+               ContactGroup *cg = l->data;
+
+               if (!cg || !cg->name) {
+                       continue;
+               }
+
+               if (strcmp (cg->name, group) == 0) {
+                       cg->expanded = expanded;
+                       changed = TRUE;
+                       break;
+               }
+       }
+
+       /* if here... we don't have a ContactGroup for the group. */
+       if (!changed) {
+               cg = contact_group_new (group, expanded);
+               groups = g_list_append (groups, cg);
+       }
+
+       contact_groups_file_save ();
+}
diff --git a/libempathy/empathy-contact-groups.dtd b/libempathy/empathy-contact-groups.dtd
new file mode 100644 (file)
index 0000000..b4de226
--- /dev/null
@@ -0,0 +1,17 @@
+<!--
+  DTD for Empathys contact groups.
+  by Martyn Russell <mr@gnome.org>
+-->
+
+<!-- Root element. -->
+<!ELEMENT contacts (account)>
+
+<!ELEMENT account (group)+>
+<!ATTLIST account 
+       name CDATA #REQUIRED>
+
+<!-- Groups in the roster. -->
+<!ELEMENT group EMPTY>
+<!ATTLIST group
+   name CDATA #REQUIRED
+   expanded CDATA #REQUIRED>
diff --git a/libempathy/empathy-contact-groups.h b/libempathy/empathy-contact-groups.h
new file mode 100644 (file)
index 0000000..e2e9810
--- /dev/null
@@ -0,0 +1,38 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2005 Imendio AB
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Martyn Russell <martyn@imendio.com>
+ */
+
+#ifndef __EMPATHY_CONTACT_GROUPS_H__
+#define __EMPATHY_CONTACT_GROUPS_H__
+
+G_BEGIN_DECLS
+
+#include <glib.h>
+
+void     empathy_contact_groups_get_all     (void);
+
+gboolean empathy_contact_group_get_expanded (const gchar *group);
+void     empathy_contact_group_set_expanded (const gchar *group,
+                                           gboolean     expanded);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_CONTACT_GROUPS_H__ */