[seahorse: 1/3] Don't use GSList unless necessary
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse: 1/3] Don't use GSList unless necessary
- Date: Fri, 12 Aug 2011 09:21:35 +0000 (UTC)
commit 7c4a43b20303611dd23ccbc81c7b8bc9096e022a
Author: Stef Walter <stefw collabora co uk>
Date: Thu Jul 28 15:58:00 2011 +0200
Don't use GSList unless necessary
* Use GList where lists are necessary.
* Use gchar ** for string lists.
common/seahorse-bind.c | 28 +++---
common/seahorse-cleanup.c | 22 +++---
libseahorse/seahorse-context.c | 88 +++++++++---------
libseahorse/seahorse-context.h | 6 +-
libseahorse/seahorse-dns-sd.c | 2 +-
libseahorse/seahorse-object-model.c | 14 ++--
libseahorse/seahorse-object-model.h | 4 +-
libseahorse/seahorse-operation.c | 78 ++++++++--------
libseahorse/seahorse-operation.h | 12 ++--
libseahorse/seahorse-prefs.c | 47 +++++------
libseahorse/seahorse-servers.c | 12 ++--
libseahorse/seahorse-servers.h | 2 +-
libseahorse/seahorse-source.c | 20 ++--
libseahorse/seahorse-source.h | 4 +-
libseahorse/seahorse-transfer-operation.c | 14 ++--
libseahorse/seahorse-transfer-operation.h | 2 +-
libseahorse/seahorse-util.c | 139 -----------------------------
libseahorse/seahorse-util.h | 16 +---
pgp/seahorse-hkp-source.c | 30 ++++---
pgp/seahorse-ldap-source.c | 130 +++++++++++++-------------
pgp/seahorse-pgp-key-properties.c | 24 +++---
pkcs11/seahorse-pkcs11-module.c | 2 +-
src/eggtreemultidnd.c | 14 ++--
src/seahorse-keyserver-sync.c | 6 +-
24 files changed, 281 insertions(+), 435 deletions(-)
---
diff --git a/common/seahorse-bind.c b/common/seahorse-bind.c
index a1e23de..7c6e761 100644
--- a/common/seahorse-bind.c
+++ b/common/seahorse-bind.c
@@ -164,8 +164,8 @@ typedef struct _Binding {
GObject *obj_src;
GParamSpec *prop_src;
GParamSpec *prop_dest;
- GSList *obj_dests;
-
+ GList *obj_dests;
+
gulong connection;
SeahorseTransform transform;
gboolean processing;
@@ -189,13 +189,13 @@ static void
binding_dest_gone (gpointer data, GObject *was)
{
Binding *binding = (Binding*)data;
- GSList *at;
+ GList *at;
- at = g_slist_find (binding->obj_dests, was);
+ at = g_list_find (binding->obj_dests, was);
g_assert (at != NULL);
/* Remove it from the list */
- binding->obj_dests = g_slist_delete_link (binding->obj_dests, at);
+ binding->obj_dests = g_list_delete_link (binding->obj_dests, at);
/* If no more destination objects, then go away */
if (!binding->obj_dests)
@@ -212,7 +212,7 @@ binding_ref (Binding *binding)
static void
binding_unref (Binding *binding)
{
- GSList *l;
+ GList *l;
g_assert (binding);
@@ -227,11 +227,11 @@ binding_unref (Binding *binding)
binding->obj_src = NULL;
}
- for (l = binding->obj_dests; l; l = g_slist_next (l)) {
+ for (l = binding->obj_dests; l; l = g_list_next (l)) {
if (G_IS_OBJECT (l->data))
g_object_weak_unref (l->data, binding_dest_gone, binding);
}
- g_slist_free (binding->obj_dests);
+ g_list_free (binding->obj_dests);
binding->obj_dests = NULL;
g_assert (binding->prop_src);
@@ -257,8 +257,8 @@ static void
bind_transfer (Binding *binding, gboolean forward)
{
GValue src, dest, check;
- GSList *l;
-
+ GList *l;
+
g_assert (binding->obj_src);
g_assert (binding->obj_dests);
@@ -277,7 +277,7 @@ bind_transfer (Binding *binding, gboolean forward)
if ((binding->transform) (&src, &dest)) {
- for (l = binding->obj_dests; l; l = g_slist_next (l)) {
+ for (l = binding->obj_dests; l; l = g_list_next (l)) {
/* Get the current value of the destination object */
memset (&check, 0, sizeof (check));
@@ -348,7 +348,7 @@ seahorse_bind_property_full (const gchar *prop_src, gpointer obj_src,
Binding *binding;
gchar *detail;
GObject *dest;
- GSList *dests, *l;
+ GList *dests, *l;
va_list va;
g_return_val_if_fail (transform, NULL);
@@ -388,7 +388,7 @@ seahorse_bind_property_full (const gchar *prop_src, gpointer obj_src,
return NULL;
}
- dests = g_slist_prepend (dests, dest);
+ dests = g_list_prepend (dests, dest);
spec_dest = spec;
}
@@ -409,7 +409,7 @@ seahorse_bind_property_full (const gchar *prop_src, gpointer obj_src,
binding->obj_dests = dests;
binding->prop_dest = spec_dest;
g_param_spec_ref (spec_dest);
- for (l = binding->obj_dests; l; l = g_slist_next (l))
+ for (l = binding->obj_dests; l; l = g_list_next (l))
g_object_weak_ref (l->data, binding_dest_gone, binding);
binding->references = 1;
diff --git a/common/seahorse-cleanup.c b/common/seahorse-cleanup.c
index d8ba8ee..58aef6c 100644
--- a/common/seahorse-cleanup.c
+++ b/common/seahorse-cleanup.c
@@ -26,9 +26,9 @@ typedef struct _SeahorseCleanup {
gpointer user_data;
} SeahorseCleanup;
-static GSList *registered_cleanups = NULL;
+static GList *registered_cleanups = NULL;
-void
+void
seahorse_cleanup_register (GDestroyNotify notify, gpointer user_data)
{
SeahorseCleanup *cleanup = g_new0 (SeahorseCleanup, 1);
@@ -38,19 +38,19 @@ seahorse_cleanup_register (GDestroyNotify notify, gpointer user_data)
cleanup->user_data = user_data;
/* Note we're reversing the order, so calls happen that way */
- registered_cleanups = g_slist_prepend (registered_cleanups, cleanup);
+ registered_cleanups = g_list_prepend (registered_cleanups, cleanup);
}
void
seahorse_cleanup_unregister (GDestroyNotify notify, gpointer user_data)
{
SeahorseCleanup *cleanup;
- GSList *l;
-
- for (l = registered_cleanups; l; l = g_slist_next (l)) {
+ GList *l;
+
+ for (l = registered_cleanups; l; l = g_list_next (l)) {
cleanup = (SeahorseCleanup*)l->data;
if (cleanup->notify == notify && cleanup->user_data == user_data) {
- registered_cleanups = g_slist_remove (registered_cleanups, cleanup);
+ registered_cleanups = g_list_remove (registered_cleanups, cleanup);
break;
}
}
@@ -60,9 +60,9 @@ seahorse_cleanup_unregister (GDestroyNotify notify, gpointer user_data)
void
seahorse_cleanup_perform (void)
{
- GSList *cleanups, *l;
+ GList *cleanups, *l;
SeahorseCleanup *cleanup;
-
+
while (registered_cleanups) {
/*
@@ -73,7 +73,7 @@ seahorse_cleanup_perform (void)
cleanups = registered_cleanups;
registered_cleanups = NULL;
- for (l = cleanups; l; l = g_slist_next (l)) {
+ for (l = cleanups; l; l = g_list_next (l)) {
cleanup = (SeahorseCleanup*)l->data;
g_assert (cleanup->notify);
@@ -81,6 +81,6 @@ seahorse_cleanup_perform (void)
g_free (cleanup);
}
- g_slist_free (cleanups);
+ g_list_free (cleanups);
}
}
diff --git a/libseahorse/seahorse-context.c b/libseahorse/seahorse-context.c
index 38b6218..950d791 100644
--- a/libseahorse/seahorse-context.c
+++ b/libseahorse/seahorse-context.c
@@ -77,7 +77,7 @@ G_DEFINE_TYPE (SeahorseContext, seahorse_context, G_TYPE_OBJECT);
*/
struct _SeahorseContextPrivate {
- GSList *sources; /* Sources which add keys to this context */
+ GList *sources; /* Sources which add keys to this context */
GHashTable *auto_sources; /* Automatically added sources (keyservers) */
GHashTable *objects_by_source; /* See explanation above */
GHashTable *objects_by_type; /* See explanation above */
@@ -243,15 +243,15 @@ seahorse_context_init (SeahorseContext *sctx)
/**
* object: ignored
* value: the value to prepend
-* user_data: GSList ** to prepend to
+* user_data: GList ** to prepend to
*
* Prepends #value to #user_data
*
**/
static void
-hash_to_ref_slist (gpointer object, gpointer value, gpointer user_data)
+hash_to_ref_list (gpointer object, gpointer value, gpointer user_data)
{
- *((GSList**)user_data) = g_slist_prepend (*((GSList**)user_data), g_object_ref (value));
+ *((GList**)user_data) = g_list_prepend (*((GList**)user_data), g_object_ref (value));
}
@@ -265,18 +265,18 @@ static void
seahorse_context_dispose (GObject *gobject)
{
SeahorseContext *sctx;
- GSList *objects, *l;
+ GList *objects, *l;
sctx = SEAHORSE_CONTEXT (gobject);
/* Release all the objects */
objects = NULL;
- g_hash_table_foreach (sctx->pv->objects_by_source, hash_to_ref_slist, &objects);
- for (l = objects; l; l = g_slist_next (l)) {
+ g_hash_table_foreach (sctx->pv->objects_by_source, hash_to_ref_list, &objects);
+ for (l = objects; l; l = g_list_next (l)) {
seahorse_context_remove_object (sctx, l->data);
g_object_unref (G_OBJECT (l->data));
}
- g_slist_free (objects);
+ g_list_free (objects);
#ifdef WITH_KEYSERVER
if (sctx->pv->crypto_pgp_settings) {
@@ -298,9 +298,9 @@ seahorse_context_dispose (GObject *gobject)
sctx->pv->discovery = NULL;
/* Release all the sources */
- for (l = sctx->pv->sources; l; l = g_slist_next (l))
+ for (l = sctx->pv->sources; l; l = g_list_next (l))
g_object_unref (SEAHORSE_SOURCE (l->data));
- g_slist_free (sctx->pv->sources);
+ g_list_free (sctx->pv->sources);
sctx->pv->sources = NULL;
if (sctx->pv->refresh_ops)
@@ -399,8 +399,8 @@ static gboolean
take_source (SeahorseContext *sctx, SeahorseSource *sksrc)
{
g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), FALSE);
- if (!g_slist_find (sctx->pv->sources, sksrc)) {
- sctx->pv->sources = g_slist_append (sctx->pv->sources, sksrc);
+ if (!g_list_find (sctx->pv->sources, sksrc)) {
+ sctx->pv->sources = g_list_append (sctx->pv->sources, sksrc);
return TRUE;
}
@@ -467,7 +467,7 @@ seahorse_context_remove_source (SeahorseContext *sctx, SeahorseSource *sksrc)
sctx = seahorse_context_instance ();
g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
- if (!g_slist_find (sctx->pv->sources, sksrc))
+ if (!g_list_find (sctx->pv->sources, sksrc))
return;
/* Remove all objects from this source */
@@ -476,7 +476,7 @@ seahorse_context_remove_source (SeahorseContext *sctx, SeahorseSource *sksrc)
seahorse_context_remove_object (sctx, SEAHORSE_OBJECT (l->data));
/* Remove the source itself */
- sctx->pv->sources = g_slist_remove (sctx->pv->sources, sksrc);
+ sctx->pv->sources = g_list_remove (sctx->pv->sources, sksrc);
g_object_unref (sksrc);
}
@@ -495,13 +495,13 @@ seahorse_context_find_source (SeahorseContext *sctx, GQuark ktype,
SeahorseLocation location)
{
SeahorseSource *ks;
- GSList *l;
+ GList *l;
if (!sctx)
sctx = seahorse_context_instance ();
g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
- for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
+ for (l = sctx->pv->sources; l; l = g_list_next (l)) {
ks = SEAHORSE_SOURCE (l->data);
if (ktype != SEAHORSE_TAG_INVALID &&
@@ -532,22 +532,22 @@ seahorse_context_find_source (SeahorseContext *sctx, GQuark ktype,
* @ktype: the type of the key to match. Or SEAHORSE_TAG_INVALID
* @location: the location to match. Or SEAHORSE_LOCATION_INVALID
*
-* Returns: A list of seahorse sources matching @ktype and @location as #GSList. Must
-* be freed with #g_slist_free
+* Returns: A list of seahorse sources matching @ktype and @location as #GList. Must
+* be freed with #g_list_free
*/
-GSList*
+GList*
seahorse_context_find_sources (SeahorseContext *sctx, GQuark ktype,
SeahorseLocation location)
{
SeahorseSource *ks;
- GSList *sources = NULL;
- GSList *l;
+ GList *sources = NULL;
+ GList *l;
if (!sctx)
sctx = seahorse_context_instance ();
g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
- for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
+ for (l = sctx->pv->sources; l; l = g_list_next (l)) {
ks = SEAHORSE_SOURCE (l->data);
if (ktype != SEAHORSE_TAG_INVALID &&
@@ -558,7 +558,7 @@ seahorse_context_find_sources (SeahorseContext *sctx, GQuark ktype,
seahorse_source_get_location (ks) != location)
continue;
- sources = g_slist_append (sources, ks);
+ sources = g_list_append (sources, ks);
}
return sources;
@@ -580,7 +580,7 @@ seahorse_context_remote_source (SeahorseContext *sctx, const gchar *uri)
SeahorseSource *ks = NULL;
gboolean found = FALSE;
gchar *ks_uri;
- GSList *l;
+ GList *l;
g_return_val_if_fail (uri && *uri, NULL);
@@ -588,7 +588,7 @@ seahorse_context_remote_source (SeahorseContext *sctx, const gchar *uri)
sctx = seahorse_context_instance ();
g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
- for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
+ for (l = sctx->pv->sources; l; l = g_list_next (l)) {
ks = SEAHORSE_SOURCE (l->data);
if (seahorse_source_get_location (ks) != SEAHORSE_LOCATION_REMOTE)
@@ -1140,8 +1140,8 @@ seahorse_context_refresh_auto (SeahorseContext *sctx)
{
SeahorseSource *ks;
SeahorseOperation *op = NULL;
- GSList *l;
-
+ GList *l;
+
if (!sctx)
sctx = seahorse_context_instance ();
g_return_if_fail (SEAHORSE_IS_CONTEXT (sctx));
@@ -1149,7 +1149,7 @@ seahorse_context_refresh_auto (SeahorseContext *sctx)
if (!sctx->pv->refresh_ops)
sctx->pv->refresh_ops = seahorse_multi_operation_new ();
- for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
+ for (l = sctx->pv->sources; l; l = g_list_next (l)) {
ks = SEAHORSE_SOURCE (l->data);
if (seahorse_source_get_location (ks) == SEAHORSE_LOCATION_LOCAL) {
@@ -1182,7 +1182,7 @@ seahorse_context_search_remote (SeahorseContext *sctx, const gchar *search)
gchar **names;
GHashTable *servers = NULL;
gchar *uri;
- GSList *l;
+ GList *l;
guint i;
if (!sctx)
@@ -1198,7 +1198,7 @@ seahorse_context_search_remote (SeahorseContext *sctx, const gchar *search)
g_strfreev (names);
}
- for (l = sctx->pv->sources; l; l = g_slist_next (l)) {
+ for (l = sctx->pv->sources; l; l = g_list_next (l)) {
ks = SEAHORSE_SOURCE (l->data);
if (seahorse_source_get_location (ks) != SEAHORSE_LOCATION_REMOTE)
@@ -1246,7 +1246,7 @@ seahorse_context_transfer_objects (SeahorseContext *sctx, GList *objects,
SeahorseOperation *op = NULL;
SeahorseMultiOperation *mop = NULL;
SeahorseObject *sobj;
- GSList *ids = NULL;
+ GList *ids = NULL;
GList *next, *l;
GQuark ktype;
@@ -1299,14 +1299,14 @@ seahorse_context_transfer_objects (SeahorseContext *sctx, GList *objects,
/* Build id list */
for (l = objects; l; l = g_list_next (l))
- ids = g_slist_prepend (ids, GUINT_TO_POINTER (seahorse_object_get_id (l->data)));
- ids = g_slist_reverse (ids);
+ ids = g_list_prepend (ids, GUINT_TO_POINTER (seahorse_object_get_id (l->data)));
+ ids = g_list_reverse (ids);
/* Start a new transfer operation between the two sources */
op = seahorse_transfer_operation_new (NULL, from, to, ids);
g_return_val_if_fail (op != NULL, FALSE);
- g_slist_free (ids);
+ g_list_free (ids);
ids = NULL;
}
@@ -1336,12 +1336,12 @@ seahorse_context_transfer_objects (SeahorseContext *sctx, GList *objects,
*/
SeahorseOperation*
seahorse_context_retrieve_objects (SeahorseContext *sctx, GQuark ktype,
- GSList *ids, SeahorseSource *to)
+ GList *ids, SeahorseSource *to)
{
SeahorseMultiOperation *mop = NULL;
SeahorseOperation *op = NULL;
SeahorseSource *sksrc;
- GSList *sources, *l;
+ GList *sources, *l;
if (!sctx)
sctx = seahorse_context_instance ();
@@ -1363,7 +1363,7 @@ seahorse_context_retrieve_objects (SeahorseContext *sctx, GQuark ktype,
return seahorse_operation_new_complete (NULL);
}
- for (l = sources; l; l = g_slist_next (l)) {
+ for (l = sources; l; l = g_list_next (l)) {
sksrc = SEAHORSE_SOURCE (l->data);
g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
@@ -1395,24 +1395,24 @@ seahorse_context_retrieve_objects (SeahorseContext *sctx, GQuark ktype,
*/
GList*
seahorse_context_discover_objects (SeahorseContext *sctx, GQuark ktype,
- GSList *rawids)
+ GList *rawids)
{
SeahorseOperation *op = NULL;
GList *robjects = NULL;
GQuark id = 0;
- GSList *todiscover = NULL;
+ GList *todiscover = NULL;
GList *toimport = NULL;
SeahorseSource *sksrc;
SeahorseObject* sobj;
SeahorseLocation loc;
- GSList *l;
+ GList *l;
if (!sctx)
sctx = seahorse_context_instance ();
g_return_val_if_fail (SEAHORSE_IS_CONTEXT (sctx), NULL);
/* Check all the ids */
- for (l = rawids; l; l = g_slist_next (l)) {
+ for (l = rawids; l; l = g_list_next (l)) {
id = seahorse_context_canonize_id (ktype, (gchar*)l->data);
if (!id) {
@@ -1426,7 +1426,7 @@ seahorse_context_discover_objects (SeahorseContext *sctx, GQuark ktype,
/* No such object anywhere, discover it */
if (!sobj) {
- todiscover = g_slist_prepend (todiscover, GUINT_TO_POINTER (id));
+ todiscover = g_list_prepend (todiscover, GUINT_TO_POINTER (id));
id = 0;
continue;
}
@@ -1474,7 +1474,7 @@ seahorse_context_discover_objects (SeahorseContext *sctx, GQuark ktype,
/* Add unknown objects for all these */
sksrc = seahorse_context_find_source (sctx, ktype, SEAHORSE_LOCATION_MISSING);
- for (l = todiscover; l; l = g_slist_next (l)) {
+ for (l = todiscover; l; l = g_list_next (l)) {
if (sksrc) {
sobj = seahorse_unknown_source_add_object (SEAHORSE_UNKNOWN_SOURCE (sksrc),
GPOINTER_TO_UINT (l->data), op);
@@ -1482,7 +1482,7 @@ seahorse_context_discover_objects (SeahorseContext *sctx, GQuark ktype,
}
}
- g_slist_free (todiscover);
+ g_list_free (todiscover);
return robjects;
}
diff --git a/libseahorse/seahorse-context.h b/libseahorse/seahorse-context.h
index be3ebee..8156e36 100644
--- a/libseahorse/seahorse-context.h
+++ b/libseahorse/seahorse-context.h
@@ -122,7 +122,7 @@ SeahorseSource* seahorse_context_find_source (SeahorseContext *sct
GQuark ktype,
SeahorseLocation location);
-GSList* seahorse_context_find_sources (SeahorseContext *sctx,
+GList* seahorse_context_find_sources (SeahorseContext *sctx,
GQuark ktype,
SeahorseLocation location);
@@ -182,12 +182,12 @@ SeahorseOperation* seahorse_context_transfer_objects (SeahorseContext *sct
SeahorseOperation* seahorse_context_retrieve_objects (SeahorseContext *sctx,
GQuark ktype,
- GSList *ids,
+ GList *ids,
SeahorseSource *to);
GList* seahorse_context_discover_objects (SeahorseContext *sctx,
GQuark ktype,
- GSList *ids);
+ GList *ids);
typedef GQuark (*SeahorseCanonizeFunc) (const gchar *id);
diff --git a/libseahorse/seahorse-dns-sd.c b/libseahorse/seahorse-dns-sd.c
index cd9b29b..1ba2429 100644
--- a/libseahorse/seahorse-dns-sd.c
+++ b/libseahorse/seahorse-dns-sd.c
@@ -436,7 +436,7 @@ seahorse_service_discovery_get_uri (SeahorseServiceDiscovery *ssd, const gchar *
/**
* seahorse_service_discovery_get_uris:
* @ssd: The service discovery object
- * @services: A #GSList of services
+ * @services: A list of services
*
* The returned uris in the list are copied and must be freed with g_free.
*
diff --git a/libseahorse/seahorse-object-model.c b/libseahorse/seahorse-object-model.c
index f6021ef..b9a0a23 100644
--- a/libseahorse/seahorse-object-model.c
+++ b/libseahorse/seahorse-object-model.c
@@ -413,11 +413,11 @@ seahorse_object_model_remove_rows_for_object (SeahorseObjectModel *self, Seahors
g_hash_table_remove (pv->rows, object);
}
-GSList*
+GList*
seahorse_object_model_get_rows_for_object (SeahorseObjectModel *self, SeahorseObject *object)
{
SeahorseObjectModelPrivate *pv = SEAHORSE_OBJECT_MODEL_GET_PRIVATE (self);
- GSList *rows = NULL;
+ GList *rows = NULL;
SeahorseObjectRow *skrow;
GtkTreeIter *iter;
GtkTreePath *path;
@@ -436,7 +436,7 @@ seahorse_object_model_get_rows_for_object (SeahorseObjectModel *self, SeahorseOb
if (path) {
iter = g_new0(GtkTreeIter, 1);
gtk_tree_model_get_iter (GTK_TREE_MODEL (self), iter, path);
- rows = g_slist_prepend (rows, iter);
+ rows = g_list_prepend (rows, iter);
gtk_tree_path_free (path);
}
}
@@ -445,10 +445,10 @@ seahorse_object_model_get_rows_for_object (SeahorseObjectModel *self, SeahorseOb
}
void
-seahorse_object_model_free_rows (GSList *rows)
+seahorse_object_model_free_rows (GList *rows)
{
- GSList *l;
- for (l = rows; l; l = g_slist_next (l))
+ GList *l;
+ for (l = rows; l; l = g_list_next (l))
g_free (l->data);
- g_slist_free (rows);
+ g_list_free (rows);
}
diff --git a/libseahorse/seahorse-object-model.h b/libseahorse/seahorse-object-model.h
index ce2d4bd..b561da1 100644
--- a/libseahorse/seahorse-object-model.h
+++ b/libseahorse/seahorse-object-model.h
@@ -76,12 +76,12 @@ void seahorse_object_model_set_row_object (SeahorseObjec
SeahorseObject* seahorse_object_model_get_row_key (SeahorseObjectModel *self,
GtkTreeIter *iter);
-GSList* seahorse_object_model_get_rows_for_object (SeahorseObjectModel *self,
+GList* seahorse_object_model_get_rows_for_object (SeahorseObjectModel *self,
SeahorseObject *object);
void seahorse_object_model_remove_rows_for_object (SeahorseObjectModel *self,
SeahorseObject *object);
-void seahorse_object_model_free_rows (GSList *rows);
+void seahorse_object_model_free_rows (GList *rows);
#endif /* __SEAHORSE_OBJECT_MODEL_H__ */
diff --git a/libseahorse/seahorse-operation.c b/libseahorse/seahorse-operation.c
index e8d64d6..76ae34f 100644
--- a/libseahorse/seahorse-operation.c
+++ b/libseahorse/seahorse-operation.c
@@ -558,8 +558,8 @@ static void
multi_operation_progress (SeahorseOperation *operation, const gchar *message,
gdouble fract, SeahorseMultiOperation *mop)
{
- GSList *list;
-
+ GList *list;
+
g_assert (SEAHORSE_IS_MULTI_OPERATION (mop));
g_assert (SEAHORSE_IS_OPERATION (operation));
@@ -569,7 +569,7 @@ multi_operation_progress (SeahorseOperation *operation, const gchar *message,
list = mop->operations;
/* One or two operations, simple */
- if (g_slist_length (list) <= 1) {
+ if (g_list_length (list) <= 1) {
seahorse_debug ("[multi-operation %p] single progress: %s %lf", mop,
seahorse_operation_get_message (operation), operation->progress);
@@ -592,7 +592,7 @@ multi_operation_progress (SeahorseOperation *operation, const gchar *message,
/* Get the total progress */
while (list) {
op = SEAHORSE_OPERATION (list->data);
- list = g_slist_next (list);
+ list = g_list_next (list);
if (message && !message[0])
message = NULL;
@@ -630,7 +630,7 @@ multi_operation_progress (SeahorseOperation *operation, const gchar *message,
static void
multi_operation_done (SeahorseOperation *op, SeahorseMultiOperation *mop)
{
- GSList *l;
+ GList *l;
gboolean done = TRUE;
g_assert (SEAHORSE_IS_MULTI_OPERATION (mop));
@@ -643,10 +643,10 @@ multi_operation_done (SeahorseOperation *op, SeahorseMultiOperation *mop)
seahorse_operation_copy_error (op, &(SEAHORSE_OPERATION (mop)->error));
seahorse_debug ("[multi-operation %p] part complete (%d): %p/%s", mop,
- g_slist_length (mop->operations), op, seahorse_operation_get_message (op));
+ g_list_length (mop->operations), op, seahorse_operation_get_message (op));
/* Are we done with all of them? */
- for (l = mop->operations; l; l = g_slist_next (l)) {
+ for (l = mop->operations; l; l = g_list_next (l)) {
if (seahorse_operation_is_running (SEAHORSE_OPERATION (l->data)))
done = FALSE;
}
@@ -660,7 +660,7 @@ multi_operation_done (SeahorseOperation *op, SeahorseMultiOperation *mop)
seahorse_debug ("[multi-operation %p] complete", mop);
/* Remove all the listeners */
- for (l = mop->operations; l; l = g_slist_next (l)) {
+ for (l = mop->operations; l; l = g_list_next (l)) {
g_signal_handlers_disconnect_by_func (l->data, multi_operation_done, mop);
g_signal_handlers_disconnect_by_func (l->data, multi_operation_progress, mop);
}
@@ -696,12 +696,12 @@ static void
seahorse_multi_operation_dispose (GObject *gobject)
{
SeahorseMultiOperation *mop;
- GSList *l;
-
+ GList *l;
+
mop = SEAHORSE_MULTI_OPERATION (gobject);
/* Remove all the listeners */
- for (l = mop->operations; l; l = g_slist_next (l)) {
+ for (l = mop->operations; l; l = g_list_next (l)) {
g_signal_handlers_disconnect_by_func (l->data, multi_operation_done, mop);
g_signal_handlers_disconnect_by_func (l->data, multi_operation_progress, mop);
}
@@ -824,18 +824,18 @@ seahorse_multi_operation_take (SeahorseMultiOperation* mop, SeahorseOperation *o
/**
* seahorse_operation_list_add:
- * @list: a #GSList
+ * @list: a #GList
* @operation: a #SeahorseOperation to add to the lit
*
* Prepends the seahorse operation to the list
*
* Returns: the list
*/
-GSList*
-seahorse_operation_list_add (GSList *list, SeahorseOperation *operation)
+GList*
+seahorse_operation_list_add (GList *list, SeahorseOperation *operation)
{
/* This assumes the main reference */
- return g_slist_prepend (list, operation);
+ return g_list_prepend (list, operation);
}
/**
@@ -847,16 +847,16 @@ seahorse_operation_list_add (GSList *list, SeahorseOperation *operation)
*
* Returns: The new list
*/
-GSList*
-seahorse_operation_list_remove (GSList *list, SeahorseOperation *operation)
+GList*
+seahorse_operation_list_remove (GList *list, SeahorseOperation *operation)
{
- GSList *element;
-
- element = g_slist_find (list, operation);
+ GList *element;
+
+ element = g_list_find (list, operation);
if (element) {
g_object_unref (operation);
- list = g_slist_remove_link (list, element);
- g_slist_free (element);
+ list = g_list_remove_link (list, element);
+ g_list_free (element);
}
return list;
@@ -870,13 +870,13 @@ seahorse_operation_list_remove (GSList *list, SeahorseOperation *operation)
*
*/
void
-seahorse_operation_list_cancel (GSList *list)
+seahorse_operation_list_cancel (GList *list)
{
SeahorseOperation *operation;
while (list) {
operation = SEAHORSE_OPERATION (list->data);
- list = g_slist_next (list);
+ list = g_list_next (list);
if (seahorse_operation_is_running (operation))
seahorse_operation_cancel (operation);
@@ -891,23 +891,23 @@ seahorse_operation_list_cancel (GSList *list)
*
* Returns: the purged list
*/
-GSList*
-seahorse_operation_list_purge (GSList *list)
+GList*
+seahorse_operation_list_purge (GList *list)
{
- GSList *l, *p;
+ GList *l, *p;
p = list;
while (p != NULL) {
l = p;
- p = g_slist_next (p);
-
+ p = g_list_next (p);
+
if (!seahorse_operation_is_running (SEAHORSE_OPERATION (l->data))) {
g_object_unref (G_OBJECT (l->data));
- list = g_slist_remove_link (list, l);
- g_slist_free (l);
+ list = g_list_remove_link (list, l);
+ g_list_free (l);
}
}
@@ -916,22 +916,22 @@ seahorse_operation_list_purge (GSList *list)
/**
* seahorse_operation_list_free:
- * @list: A #GSList of #SEAHORSE_OPERATION s
+ * @list: A #GList of #SEAHORSE_OPERATION s
*
* Frees the list of seahorse operations
*
* Returns: NULL
*/
-GSList*
-seahorse_operation_list_free (GSList *list)
+GList*
+seahorse_operation_list_free (GList *list)
{
- GSList *l;
-
- for (l = list; l; l = g_slist_next (l)) {
+ GList *l;
+
+ for (l = list; l; l = g_list_next (l)) {
g_assert (SEAHORSE_IS_OPERATION (l->data));
g_object_unref (G_OBJECT (l->data));
}
-
- g_slist_free (list);
+
+ g_list_free (list);
return NULL;
}
diff --git a/libseahorse/seahorse-operation.h b/libseahorse/seahorse-operation.h
index ca1fe39..fbac5bb 100644
--- a/libseahorse/seahorse-operation.h
+++ b/libseahorse/seahorse-operation.h
@@ -157,17 +157,17 @@ gpointer seahorse_operation_get_result (SeahorseOperation *operation
/* Helpers for Tracking Operation Lists ------------------------------ */
-GSList* seahorse_operation_list_add (GSList *list,
+GList* seahorse_operation_list_add (GList *list,
SeahorseOperation *operation);
-GSList* seahorse_operation_list_remove (GSList *list,
+GList* seahorse_operation_list_remove (GList *list,
SeahorseOperation *operation);
-void seahorse_operation_list_cancel (GSList *list);
+void seahorse_operation_list_cancel (GList *list);
-GSList* seahorse_operation_list_purge (GSList *list);
+GList* seahorse_operation_list_purge (GList *list);
-GSList* seahorse_operation_list_free (GSList *list);
+GList* seahorse_operation_list_free (GList *list);
/* Combining parallel operations ------------------------------------- */
@@ -182,7 +182,7 @@ typedef struct _SeahorseMultiOperation {
SeahorseOperation parent;
/*< public >*/
- GSList *operations;
+ GList *operations;
} SeahorseMultiOperation;
diff --git a/libseahorse/seahorse-prefs.c b/libseahorse/seahorse-prefs.c
index 28aa1bc..04c9b24 100644
--- a/libseahorse/seahorse-prefs.c
+++ b/libseahorse/seahorse-prefs.c
@@ -223,7 +223,7 @@ calculate_keyserver_uri (SeahorseWidget *swidget)
const gchar *host = NULL;
const gchar *port = NULL;
GtkWidget *widget;
- GSList *types;
+ GList *types;
gint active;
gchar *uri;
@@ -231,14 +231,14 @@ calculate_keyserver_uri (SeahorseWidget *swidget)
widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "keyserver-type"));
g_return_val_if_fail (widget != NULL, NULL);
- active = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
- if (active >= 0) {
- types = g_object_get_data (G_OBJECT (swidget), "keyserver-types");
- scheme = (const gchar*)g_slist_nth_data (types, active);
- if (scheme && !scheme[0])
- scheme = NULL;
- }
-
+ active = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
+ if (active >= 0) {
+ types = g_object_get_data (G_OBJECT (swidget), "keyserver-types");
+ scheme = (const gchar*)g_list_nth_data (types, active);
+ if (scheme && !scheme[0])
+ scheme = NULL;
+ }
+
/* The host */
widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "keyserver-host"));
g_return_val_if_fail (widget != NULL, NULL);
@@ -274,7 +274,7 @@ G_MODULE_EXPORT void
on_prefs_add_keyserver_uri_changed (GtkWidget *button, SeahorseWidget *swidget)
{
GtkWidget *widget;
- GSList *types;
+ gchar **types;
gchar *t;
gint active;
@@ -296,8 +296,7 @@ on_prefs_add_keyserver_uri_changed (GtkWidget *button, SeahorseWidget *swidget)
widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "port-block"));
g_return_if_fail (widget != NULL);
- t = (gchar*)g_slist_nth_data (types, active);
- if (t && t[0])
+ if (types && types[active] && types[active][0])
gtk_widget_show (widget);
else
gtk_widget_hide (widget);
@@ -308,15 +307,15 @@ G_MODULE_EXPORT void
on_prefs_keyserver_add_clicked (GtkButton *button, SeahorseWidget *sw)
{
SeahorseWidget *swidget;
- GSList *types, *descriptions, *l;
+ gchar **types;
GtkWidget *widget;
gint response;
gchar *result = NULL;
-
GtkTreeView *treeview;
GtkTreeStore *store;
GtkTreeIter iter;
-
+ guint i;
+
swidget = seahorse_widget_new_allow_multiple ("add-keyserver",
GTK_WINDOW (seahorse_widget_get_widget (sw, sw->name)));
g_return_if_fail (swidget != NULL);
@@ -326,23 +325,19 @@ on_prefs_keyserver_add_clicked (GtkButton *button, SeahorseWidget *sw)
/* The list of types */
types = seahorse_servers_get_types ();
-
- /* The description for the key server types, plus custom */
- descriptions = NULL;
- for (l = types; l; l = g_slist_next (l))
- descriptions = g_slist_append (descriptions, seahorse_servers_get_description (l->data));
- descriptions = g_slist_append (descriptions, g_strdup (_("Custom")));
+ /* The description for the key server types, plus custom */
+ for (i = 0; types[i] != NULL; i++)
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget),
+ seahorse_servers_get_description (types[i]));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget),
+ _("Custom"));
gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (widget), 0);
- for (l = descriptions; l; l = g_slist_next (l))
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), l->data ? l->data : "");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
- seahorse_util_string_slist_free (descriptions);
/* Save these away for later */
- types = g_slist_append (types, g_strdup (""));
g_object_set_data_full (G_OBJECT (swidget), "keyserver-types", types,
- (GDestroyNotify)seahorse_util_string_slist_free);
+ (GDestroyNotify)g_strfreev);
response = gtk_dialog_run (GTK_DIALOG (seahorse_widget_get_toplevel (swidget)));
if (response == GTK_RESPONSE_ACCEPT) {
diff --git a/libseahorse/seahorse-servers.c b/libseahorse/seahorse-servers.c
index e736d55..c8a8e78 100644
--- a/libseahorse/seahorse-servers.c
+++ b/libseahorse/seahorse-servers.c
@@ -48,17 +48,17 @@ free_server_info (gpointer data)
static void
types_to_slist (gpointer key, gpointer value, gpointer data)
{
- GSList **list = (GSList**)data;
- *list = g_slist_prepend (*list, g_strdup (((ServerInfo*)value)->type));
+ g_ptr_array_add (data, g_strdup (((ServerInfo*)value)->type));
}
-GSList*
+gchar **
seahorse_servers_get_types (void)
{
- GSList* results = NULL;
+ GPtrArray *result = g_ptr_array_new_with_free_func (g_free);
if (server_types)
- g_hash_table_foreach (server_types, types_to_slist, &results);
- return results;
+ g_hash_table_foreach (server_types, types_to_slist, result);
+ g_ptr_array_add (result, NULL);
+ return (gchar **)g_ptr_array_free (result, FALSE);
}
gchar*
diff --git a/libseahorse/seahorse-servers.h b/libseahorse/seahorse-servers.h
index 867cc75..94c4820 100644
--- a/libseahorse/seahorse-servers.h
+++ b/libseahorse/seahorse-servers.h
@@ -25,7 +25,7 @@
#include <glib.h>
#include <gio/gio.h>
-GSList* seahorse_servers_get_types (void);
+gchar ** seahorse_servers_get_types (void);
gchar ** seahorse_servers_get_names (void);
diff --git a/libseahorse/seahorse-source.c b/libseahorse/seahorse-source.c
index 5b5be7d..1baf3c7 100644
--- a/libseahorse/seahorse-source.c
+++ b/libseahorse/seahorse-source.c
@@ -346,7 +346,7 @@ seahorse_source_export (SeahorseSource *sksrc, GList *objects, GOutputStream *ou
{
SeahorseSourceIface *klass;
SeahorseOperation *op;
- GSList *ids = NULL;
+ GList *ids = NULL;
GList *l;
g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
@@ -360,11 +360,11 @@ seahorse_source_export (SeahorseSource *sksrc, GList *objects, GOutputStream *ou
g_return_val_if_fail (klass->export_raw != NULL, NULL);
for (l = objects; l; l = g_list_next (l))
- ids = g_slist_prepend (ids, GUINT_TO_POINTER (seahorse_object_get_id (l->data)));
-
- ids = g_slist_reverse (ids);
+ ids = g_list_prepend (ids, GUINT_TO_POINTER (seahorse_object_get_id (l->data)));
+
+ ids = g_list_reverse (ids);
op = (*klass->export_raw) (sksrc, ids, output);
- g_slist_free (ids);
+ g_list_free (ids);
return op;
}
@@ -379,14 +379,14 @@ seahorse_source_export (SeahorseSource *sksrc, GList *objects, GOutputStream *ou
* Returns: An export Operation (#SeahorseOperation)
*/
SeahorseOperation*
-seahorse_source_export_raw (SeahorseSource *sksrc, GSList *ids, GOutputStream *output)
+seahorse_source_export_raw (SeahorseSource *sksrc, GList *ids, GOutputStream *output)
{
SeahorseSourceIface *klass;
SeahorseOperation *op;
SeahorseObject *sobj;
GList *objects = NULL;
- GSList *l;
-
+ GList *l;
+
g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
g_return_val_if_fail (output == NULL || G_IS_OUTPUT_STREAM (output), NULL);
@@ -397,8 +397,8 @@ seahorse_source_export_raw (SeahorseSource *sksrc, GSList *ids, GOutputStream *o
return (*klass->export_raw)(sksrc, ids, output);
g_return_val_if_fail (klass->export != NULL, NULL);
-
- for (l = ids; l; l = g_slist_next (l)) {
+
+ for (l = ids; l; l = g_list_next (l)) {
sobj = seahorse_context_get_object (SCTX_APP (), sksrc, GPOINTER_TO_UINT (l->data));
/* TODO: A proper error message here 'not found' */
diff --git a/libseahorse/seahorse-source.h b/libseahorse/seahorse-source.h
index b3f6a26..3f9e85a 100644
--- a/libseahorse/seahorse-source.h
+++ b/libseahorse/seahorse-source.h
@@ -120,7 +120,7 @@ struct _SeahorseSourceIface {
*
* Returns: The export operation
*/
- SeahorseOperation* (*export_raw) (SeahorseSource *sksrc, GSList *ids,
+ SeahorseOperation* (*export_raw) (SeahorseSource *sksrc, GList *ids,
GOutputStream *output);
};
@@ -158,7 +158,7 @@ SeahorseOperation* seahorse_source_export (SeahorseSource *sksrc
GOutputStream *output);
SeahorseOperation* seahorse_source_export_raw (SeahorseSource *sksrc,
- GSList *ids,
+ GList *ids,
GOutputStream *output);
GQuark seahorse_source_get_tag (SeahorseSource *sksrc);
diff --git a/libseahorse/seahorse-transfer-operation.c b/libseahorse/seahorse-transfer-operation.c
index 6ae7c19..1338c09 100644
--- a/libseahorse/seahorse-transfer-operation.c
+++ b/libseahorse/seahorse-transfer-operation.c
@@ -213,11 +213,11 @@ start_transfer (SeahorseTransferOperation *top)
{
SeahorseTransferOperationPrivate *pv = SEAHORSE_TRANSFER_OPERATION_GET_PRIVATE (top);
SeahorseSource *from;
- GSList *keyids;
-
+ GList *keyids;
+
g_assert (pv->operation == NULL);
- keyids = (GSList*)g_object_get_data (G_OBJECT (top), "transfer-key-ids");
+ keyids = (GList*)g_object_get_data (G_OBJECT (top), "transfer-key-ids");
g_object_get (top, "from-key-source", &from, NULL);
g_assert (keyids && from);
@@ -352,7 +352,7 @@ seahorse_transfer_operation_cancel (SeahorseOperation *operation)
SeahorseOperation*
seahorse_transfer_operation_new (const gchar *message, SeahorseSource *from,
- SeahorseSource *to, GSList *keyids)
+ SeahorseSource *to, GList *keyids)
{
SeahorseTransferOperation *top;
@@ -368,9 +368,9 @@ seahorse_transfer_operation_new (const gchar *message, SeahorseSource *from,
seahorse_debug ("[transfer] starting export");
/* A list of quarks, so a deep copy is not necessary */
- g_object_set_data_full (G_OBJECT (top), "transfer-key-ids", g_slist_copy (keyids),
- (GDestroyNotify)g_slist_free);
-
+ g_object_set_data_full (G_OBJECT (top), "transfer-key-ids", g_list_copy (keyids),
+ (GDestroyNotify)g_list_free);
+
/* And mark us as started */
seahorse_operation_mark_start (SEAHORSE_OPERATION (top));
seahorse_operation_mark_progress (SEAHORSE_OPERATION (top), message, 0.0);
diff --git a/libseahorse/seahorse-transfer-operation.h b/libseahorse/seahorse-transfer-operation.h
index 5b55270..9990a35 100644
--- a/libseahorse/seahorse-transfer-operation.h
+++ b/libseahorse/seahorse-transfer-operation.h
@@ -56,6 +56,6 @@ END_DECLARE_OPERATION
SeahorseOperation* seahorse_transfer_operation_new (const gchar *message,
SeahorseSource *from,
SeahorseSource *to,
- GSList *keyids);
+ GList *keyids);
#endif /* __SEAHORSE_TRANSFER_OPERATION_H__ */
diff --git a/libseahorse/seahorse-util.c b/libseahorse/seahorse-util.c
index c886c8f..015c98a 100644
--- a/libseahorse/seahorse-util.c
+++ b/libseahorse/seahorse-util.c
@@ -1228,52 +1228,6 @@ seahorse_util_remove_suffix (const gchar *path, const gchar *prompt)
}
/**
- * seahorse_util_strvec_dup:
- * @vec: the string table to copy
- *
- * Copy a string table
- *
- * Returns: the new char **
- */
-gchar**
-seahorse_util_strvec_dup (const gchar** vec)
-{
- gint len = 0;
- gchar** ret;
- const gchar** v;
-
- if (vec) {
- for(v = vec; *v; v++)
- len++;
- }
-
- ret = (gchar**)g_new0(gchar*, len + 1);
-
- while((--len) >= 0)
- ret[len] = g_strdup(vec[len]);
-
- return ret;
-}
-
-/**
- * seahorse_util_strvec_length:
- * @vec: The string table
- *
- * Calculates the length of the string table
- *
- * Returns: The length of the string table
- */
-guint
-seahorse_util_strvec_length (const gchar **vec)
-{
- guint len = 0;
- while (*(vec++))
- len++;
- return len;
-}
-
-
-/**
* sort_objects_by_source:
* @k1: the first seahorse object
* @k2: The second seahorse object
@@ -1376,42 +1330,6 @@ seahorse_util_string_equals (const gchar *s1, const gchar *s2)
}
/**
- * seahorse_util_string_up_first:
- * @orig: The utf8 string to work with
- *
- * Upper case the first char in the UTF8 string
- *
- * Returns: a new string, with the first char upper cased. The returned string
- * should be freed with #g_free when no longer needed.
- */
-gchar*
-seahorse_util_string_up_first (const gchar *orig)
-{
- gchar *t, *t2, *ret;
-
- if (g_utf8_validate (orig, -1, NULL)) {
-
- t = g_utf8_find_next_char (orig, NULL);
- if (t != NULL) {
- t2 = g_utf8_strup (orig, t - orig);
- ret = g_strdup_printf ("%s%s", t2, t);
- g_free (t2);
-
- /* Can't find first UTF8 char */
- } else {
- ret = g_strdup (orig);
- }
-
- /* Just use ASCII functions when not UTF8 */
- } else {
- ret = g_strdup (orig);
- ret[0] = g_ascii_toupper (ret[0]);
- }
-
- return ret;
-}
-
-/**
* seahorse_util_string_lower:
* @s: ASCII string to change
*
@@ -1425,63 +1343,6 @@ seahorse_util_string_lower (gchar *s)
}
/**
- * seahorse_util_string_slist_free:
- * @slist: the #GSList to free
- *
- * Free a GSList along with string values
- *
- * Returns: NULL
- */
-GSList*
-seahorse_util_string_slist_free (GSList* list)
-{
- GSList *l;
- for (l = list; l; l = l->next)
- g_free (l->data);
- g_slist_free (list);
- return NULL;
-}
-
-/**
- * seahorse_util_string_slist_copy:
- * @slist: The list to copy
- *
- * Copy a #GSList along with string values
- *
- * Returns: the new list
- */
-GSList*
-seahorse_util_string_slist_copy (GSList *list)
-{
- GSList *l = NULL;
- for ( ; list; list = g_slist_next(list))
- l = g_slist_append (l, g_strdup(list->data));
- return l;
-}
-
-/**
- * seahorse_util_string_slist_equal:
- * @sl1: the first string list
- * @sl2: the second string list
- *
- * Compare two string GSLists.
- *
- * Returns: TRUE if all the string are equal
- */
-gboolean
-seahorse_util_string_slist_equal (GSList *l1, GSList *l2)
-{
- while (l1 && l2) {
- if (!g_str_equal ((const gchar*)l1->data, (const gchar*)l2->data))
- break;
- l1 = g_slist_next (l1);
- l2 = g_slist_next (l2);
- }
-
- return !l1 && !l2;
-}
-
-/**
* seahorse_util_string_is_whitespace:
* @text: The UTF8 string to test
*
diff --git a/libseahorse/seahorse-util.h b/libseahorse/seahorse-util.h
index d3bafe3..82f1b7b 100644
--- a/libseahorse/seahorse-util.h
+++ b/libseahorse/seahorse-util.h
@@ -145,26 +145,14 @@ gchar* seahorse_util_add_suffix (const gchar *path,
gchar* seahorse_util_remove_suffix (const gchar *path,
const gchar *prompt);
-gchar** seahorse_util_strvec_dup (const gchar **vec);
+GList* seahorse_util_objects_sort (GList *objects);
-guint seahorse_util_strvec_length (const gchar **vec);
-
-GList* seahorse_util_objects_sort (GList *objects);
-
-GList* seahorse_util_objects_splice (GList *objects);
+GList* seahorse_util_objects_splice (GList *objects);
gboolean seahorse_util_string_equals (const gchar *s1, const gchar *s2);
-gchar* seahorse_util_string_up_first (const gchar *orig);
-
void seahorse_util_string_lower (gchar *s);
-GSList* seahorse_util_string_slist_free (GSList *slist);
-
-GSList* seahorse_util_string_slist_copy (GSList *slist);
-
-gboolean seahorse_util_string_slist_equal (GSList *sl1, GSList *sl2);
-
gboolean seahorse_util_string_is_whitespace (const gchar *text);
void seahorse_util_string_trim_whitespace (gchar *text);
diff --git a/pgp/seahorse-hkp-source.c b/pgp/seahorse-hkp-source.c
index d1eb910..82d4ac7 100644
--- a/pgp/seahorse-hkp-source.c
+++ b/pgp/seahorse-hkp-source.c
@@ -1030,12 +1030,12 @@ seahorse_hkp_source_import (SeahorseSource *sksrc, GInputStream *input)
SeahorseHKPOperation *hop;
SeahorseHKPSource *hsrc;
SoupMessage *message;
- GSList *keydata = NULL;
+ GList *keydata = NULL;
GString *buf = NULL;
GHashTable *form;
gchar *key, *t;
SoupURI *uri;
- GSList *l;
+ GList *l;
guint len;
g_return_val_if_fail (SEAHORSE_IS_HKP_SOURCE (sksrc), NULL);
@@ -1051,14 +1051,14 @@ seahorse_hkp_source_import (SeahorseSource *sksrc, GInputStream *input)
"-----END PGP PUBLIC KEY BLOCK-----");
if (len > 0) {
- keydata = g_slist_prepend (keydata, g_string_free (buf, FALSE));
+ keydata = g_list_prepend (keydata, g_string_free (buf, FALSE));
} else {
g_string_free (buf, TRUE);
break;
}
}
- if (g_slist_length (keydata) == 0) {
+ if (g_list_length (keydata) == 0) {
g_object_unref (input);
return seahorse_operation_new_complete (NULL);
}
@@ -1068,11 +1068,11 @@ seahorse_hkp_source_import (SeahorseSource *sksrc, GInputStream *input)
g_return_val_if_fail (uri, FALSE);
/* New operation and away we go */
- keydata = g_slist_reverse (keydata);
+ keydata = g_list_reverse (keydata);
hop = setup_hkp_operation (hsrc);
form = g_hash_table_new (g_str_hash, g_str_equal);
- for (l = keydata; l; l = g_slist_next (l)) {
+ for (l = keydata; l; l = g_list_next (l)) {
g_assert (l->data != NULL);
g_hash_table_insert (form, "keytext", l->data);
@@ -1094,10 +1094,12 @@ seahorse_hkp_source_import (SeahorseSource *sksrc, GInputStream *input)
g_free (t);
soup_uri_free (uri);
-
- seahorse_util_string_slist_free (keydata);
- g_object_unref (input);
-
+
+ for (l = keydata; l != NULL; l = g_list_next (l))
+ g_free (l->data);
+ g_list_free (keydata);
+ g_object_unref (input);
+
return SEAHORSE_OPERATION (hop);
}
@@ -1111,7 +1113,7 @@ seahorse_hkp_source_import (SeahorseSource *sksrc, GInputStream *input)
* Returns A new Seahorse operation
**/
static SeahorseOperation*
-seahorse_hkp_source_export_raw (SeahorseSource *sksrc, GSList *keyids,
+seahorse_hkp_source_export_raw (SeahorseSource *sksrc, GList *keyids,
GOutputStream *output)
{
SeahorseHKPOperation *hop;
@@ -1123,14 +1125,14 @@ seahorse_hkp_source_export_raw (SeahorseSource *sksrc, GSList *keyids,
gchar hexfpr[11];
GHashTable *form;
guint len;
- GSList *l;
+ GList *l;
g_return_val_if_fail (SEAHORSE_IS_HKP_SOURCE (sksrc), NULL);
g_return_val_if_fail (output == NULL || G_IS_OUTPUT_STREAM (output), NULL);
hsrc = SEAHORSE_HKP_SOURCE (sksrc);
- if (g_slist_length (keyids) == 0)
+ if (g_list_length (keyids) == 0)
return seahorse_operation_new_complete (NULL);
uri = get_http_server_uri (sksrc, "/pks/lookup");
@@ -1146,7 +1148,7 @@ seahorse_hkp_source_export_raw (SeahorseSource *sksrc, GSList *keyids,
strncpy(hexfpr, "0x", 3);
form = g_hash_table_new (g_str_hash, g_str_equal);
- for (l = keyids; l; l = g_slist_next (l)) {
+ for (l = keyids; l; l = g_list_next (l)) {
/* Get the key id and limit it to 8 characters */
fpr = seahorse_pgp_key_calc_rawid (GPOINTER_TO_UINT (l->data));
diff --git a/pgp/seahorse-ldap-source.c b/pgp/seahorse-ldap-source.c
index 517851d..ed61412 100644
--- a/pgp/seahorse-ldap-source.c
+++ b/pgp/seahorse-ldap-source.c
@@ -1064,7 +1064,8 @@ get_key_from_ldap (SeahorseOperation *op, LDAPMessage *result)
SeahorseLDAPOperation *lop = SEAHORSE_LDAP_OPERATION (op);
LDAPServerInfo *sinfo;
GOutputStream *output;
- GSList *fingerprints, *fprfull;
+ gchar **fingerprints;
+ gchar **fprfull;
gchar *filter;
char *attrs[2];
const gchar *fpr;
@@ -1073,24 +1074,23 @@ get_key_from_ldap (SeahorseOperation *op, LDAPMessage *result)
g_assert (lop->ldap != NULL);
g_assert (lop->ldap_op == -1);
-
- fingerprints = (GSList*)g_object_get_data (G_OBJECT (lop), "fingerprints");
- fprfull = (GSList*)g_object_get_data (G_OBJECT (lop), "fingerprints-full");
- l = g_slist_length (fprfull);
+ fingerprints = (gchar **)g_object_get_data (G_OBJECT (lop), "fingerprints");
+ fprfull = (gchar **)g_object_get_data (G_OBJECT (lop), "fingerprints-full");
+
+ l = g_strv_length (fprfull);
seahorse_operation_mark_progress_full (SEAHORSE_OPERATION (lop),
_("Retrieving remote keys..."),
- l - g_slist_length (fingerprints), l);
-
- if (fingerprints) {
-
- fpr = (const gchar*)(fingerprints->data);
- g_assert (fpr != NULL);
+ l - g_strv_length (fingerprints), l);
+
+ if (fingerprints[0]) {
+
+ fpr = fingerprints[0];
/* Keep track of the ones that have already been done */
- fingerprints = g_slist_next (fingerprints);
+ fingerprints++;
g_object_set_data (G_OBJECT (lop), "fingerprints", fingerprints);
-
+
l = strlen (fpr);
if (l > 16)
fpr += (l - 16);
@@ -1126,25 +1126,25 @@ get_key_from_ldap (SeahorseOperation *op, LDAPMessage *result)
/* Starts a get operation for multiple keys */
static SeahorseLDAPOperation *
-start_get_operation_multiple (SeahorseLDAPSource *lsrc, GSList *fingerprints,
+start_get_operation_multiple (SeahorseLDAPSource *lsrc, gchar **fingerprints,
GOutputStream *output)
{
SeahorseLDAPOperation *lop;
-
- g_assert (g_slist_length (fingerprints) > 0);
- g_return_val_if_fail (G_IS_OUTPUT_STREAM (output), NULL);
-
- lop = seahorse_ldap_operation_start (lsrc, get_key_from_ldap,
- g_slist_length (fingerprints));
- g_return_val_if_fail (lop != NULL, NULL);
-
+
+ g_assert (fingerprints && fingerprints[0]);
+ g_return_val_if_fail (G_IS_OUTPUT_STREAM (output), NULL);
+
+ lop = seahorse_ldap_operation_start (lsrc, get_key_from_ldap,
+ g_strv_length (fingerprints));
+ g_return_val_if_fail (lop != NULL, NULL);
+
g_object_ref (output);
seahorse_operation_mark_result (SEAHORSE_OPERATION (lop), output,
g_object_unref);
g_object_set_data (G_OBJECT (lop), "fingerprints", fingerprints);
g_object_set_data_full (G_OBJECT (lop), "fingerprints-full", fingerprints,
- (GDestroyNotify)seahorse_util_string_slist_free);
+ (GDestroyNotify)g_strfreev);
return lop;
}
@@ -1194,7 +1194,7 @@ send_key_to_ldap (SeahorseOperation *op, LDAPMessage *result)
{
SeahorseLDAPOperation *lop = SEAHORSE_LDAP_OPERATION (op);
LDAPServerInfo *sinfo;
- GSList *keys, *keysfull;
+ gchar **keys, **keysfull;
gchar *key;
gchar *base;
LDAPMod mod;
@@ -1205,22 +1205,20 @@ send_key_to_ldap (SeahorseOperation *op, LDAPMessage *result)
g_assert (lop->ldap != NULL);
g_assert (lop->ldap_op == -1);
-
- keys = (GSList*)g_object_get_data (G_OBJECT (lop), "key-data");
- keysfull = (GSList*)g_object_get_data (G_OBJECT (lop), "key-data-full");
-
- l = g_slist_length (keysfull);
+
+ keys = (gchar **)g_object_get_data (G_OBJECT (lop), "key-data");
+ keysfull = (gchar **)g_object_get_data (G_OBJECT (lop), "key-data-full");
+
+ l = g_strv_length (keysfull);
seahorse_operation_mark_progress_full (SEAHORSE_OPERATION (lop),
_("Sending keys to key server..."),
- l - g_slist_length (keys), l);
+ l - g_strv_length (keys), l);
- if (keys) {
-
- key = (gchar*)(keys->data);
- g_assert (key != NULL);
+ if (keys[0]) {
+ key = keys[0];
/* Keep track of the ones that have already been done */
- keys = g_slist_next (keys);
+ keys++;
g_object_set_data (G_OBJECT (lop), "key-data", keys);
sinfo = get_ldap_server_info (lop->lsrc, TRUE);
@@ -1258,19 +1256,19 @@ send_key_to_ldap (SeahorseOperation *op, LDAPMessage *result)
/* Start a key send operation for multiple keys */
static SeahorseLDAPOperation *
-start_send_operation_multiple (SeahorseLDAPSource *lsrc, GSList *keys)
+start_send_operation_multiple (SeahorseLDAPSource *lsrc, gchar **keys)
{
SeahorseLDAPOperation *lop;
- g_assert (g_slist_length (keys) > 0);
-
+ g_assert (g_strv_length (keys) > 0);
+
lop = seahorse_ldap_operation_start (lsrc, send_key_to_ldap,
- g_slist_length (keys));
+ g_strv_length (keys));
g_return_val_if_fail (lop != NULL, NULL);
g_object_set_data (G_OBJECT (lop), "key-data", keys);
g_object_set_data_full (G_OBJECT (lop), "key-data-full", keys,
- (GDestroyNotify)seahorse_util_string_slist_free);
+ (GDestroyNotify)g_strfreev);
return lop;
}
@@ -1340,16 +1338,17 @@ seahorse_ldap_source_import (SeahorseSource *sksrc, GInputStream *input)
{
SeahorseLDAPOperation *lop;
SeahorseLDAPSource *lsrc;
- GSList *keydata = NULL;
+ GPtrArray *keydata;
GString *buf = NULL;
guint len;
-
- g_return_val_if_fail (SEAHORSE_IS_LDAP_SOURCE (sksrc), NULL);
- lsrc = SEAHORSE_LDAP_SOURCE (sksrc);
-
- g_return_val_if_fail (G_IS_INPUT_STREAM (input), NULL);
- g_object_ref (input);
-
+
+ g_return_val_if_fail (SEAHORSE_IS_LDAP_SOURCE (sksrc), NULL);
+ lsrc = SEAHORSE_LDAP_SOURCE (sksrc);
+
+ g_return_val_if_fail (G_IS_INPUT_STREAM (input), NULL);
+ g_object_ref (input);
+
+ keydata = g_ptr_array_new_with_free_func (g_free);
for (;;) {
buf = g_string_sized_new (2048);
@@ -1357,44 +1356,45 @@ seahorse_ldap_source_import (SeahorseSource *sksrc, GInputStream *input)
"-----END PGP PUBLIC KEY BLOCK-----");
if (len > 0) {
- keydata = g_slist_prepend (keydata, g_string_free (buf, FALSE));
+ g_ptr_array_add (keydata, g_string_free (buf, FALSE));
} else {
g_string_free (buf, TRUE);
break;
}
}
-
- keydata = g_slist_reverse (keydata);
-
- lop = start_send_operation_multiple (lsrc, keydata);
+
+ g_ptr_array_add (keydata, NULL);
+ lop = start_send_operation_multiple (lsrc, (gchar **)g_ptr_array_free (keydata, FALSE));
g_return_val_if_fail (lop != NULL, NULL);
-
- g_object_unref (input);
- return SEAHORSE_OPERATION (lop);
+
+ g_object_unref (input);
+ return SEAHORSE_OPERATION (lop);
}
static SeahorseOperation*
-seahorse_ldap_source_export_raw (SeahorseSource *sksrc, GSList *keyids,
+seahorse_ldap_source_export_raw (SeahorseSource *sksrc, GList *keyids,
GOutputStream *output)
{
SeahorseLDAPOperation *lop;
SeahorseLDAPSource *lsrc;
- GSList *l, *fingerprints = NULL;
+ GList *l;
+ GPtrArray *fingerprints;
g_return_val_if_fail (SEAHORSE_IS_LDAP_SOURCE (sksrc), NULL);
g_return_val_if_fail (G_IS_OUTPUT_STREAM (output), NULL);
lsrc = SEAHORSE_LDAP_SOURCE (sksrc);
-
- for (l = keyids; l; l = g_slist_next (l))
- fingerprints = g_slist_prepend (fingerprints,
+
+ fingerprints = g_ptr_array_new_with_free_func (g_free);
+ for (l = keyids; l; l = g_list_next (l))
+ g_ptr_array_add (fingerprints,
g_strdup (seahorse_pgp_key_calc_rawid (GPOINTER_TO_UINT (l->data))));
- fingerprints = g_slist_reverse (fingerprints);
+ g_ptr_array_add (fingerprints, NULL);
- lop = start_get_operation_multiple (lsrc, fingerprints, output);
+ lop = start_get_operation_multiple (lsrc, (gchar **)g_ptr_array_free (fingerprints, FALSE), output);
g_return_val_if_fail (lop != NULL, NULL);
-
- return SEAHORSE_OPERATION (lop);
+
+ return SEAHORSE_OPERATION (lop);
}
/* Initialize the basic class stuff */
diff --git a/pgp/seahorse-pgp-key-properties.c b/pgp/seahorse-pgp-key-properties.c
index 19f5bde..bfcd088 100644
--- a/pgp/seahorse-pgp-key-properties.c
+++ b/pgp/seahorse-pgp-key-properties.c
@@ -163,16 +163,16 @@ on_pgp_signature_row_activated (GtkTreeView *treeview, GtkTreePath *path, GtkTre
}
}
-static GSList*
-unique_slist_strings (GSList *keyids)
+static GList*
+unique_slist_strings (GList *keyids)
{
- GSList *l;
+ GList *l;
- keyids = g_slist_sort (keyids, (GCompareFunc)g_ascii_strcasecmp);
- for (l = keyids; l; l = g_slist_next (l)) {
+ keyids = g_list_sort (keyids, (GCompareFunc)g_ascii_strcasecmp);
+ for (l = keyids; l; l = g_list_next (l)) {
while (l->next && l->data && l->next->data &&
g_ascii_strcasecmp (l->data, l->next->data) == 0)
- keyids = g_slist_delete_link (keyids, l->next);
+ keyids = g_list_delete_link (keyids, l->next);
}
return keyids;
@@ -341,7 +341,7 @@ names_populate (SeahorseWidget *swidget, GtkTreeStore *store, SeahorsePgpKey *pk
{
SeahorseObject *object;
GtkTreeIter uiditer, sigiter;
- GSList *rawids = NULL;
+ GList *rawids = NULL;
SeahorsePgpUid *uid;
GList *keys, *l;
GList *uids, *u;
@@ -368,12 +368,12 @@ names_populate (SeahorseWidget *swidget, GtkTreeStore *store, SeahorsePgpKey *pk
/* Never show self signatures, they're implied */
if (seahorse_pgp_key_has_keyid (pkey, seahorse_pgp_signature_get_keyid (s->data)))
continue;
- rawids = g_slist_prepend (rawids, (gpointer)seahorse_pgp_signature_get_keyid (s->data));
+ rawids = g_list_prepend (rawids, (gpointer)seahorse_pgp_signature_get_keyid (s->data));
}
/* Pass it to 'DiscoverKeys' for resolution/download */
keys = seahorse_context_discover_objects (SCTX_APP (), SEAHORSE_PGP, rawids);
- g_slist_free (rawids);
+ g_list_free (rawids);
rawids = NULL;
/* Add the keys to the store */
@@ -1477,7 +1477,7 @@ signatures_populate_model (SeahorseWidget *swidget, SeahorseObjectModel *skmodel
GtkTreeIter iter;
GtkWidget *widget;
gboolean have_sigs = FALSE;
- GSList *rawids = NULL;
+ GList *rawids = NULL;
GList *keys, *l, *uids;
GList *sigs, *s;
@@ -1496,7 +1496,7 @@ signatures_populate_model (SeahorseWidget *swidget, SeahorseObjectModel *skmodel
if (seahorse_pgp_key_has_keyid (pkey, seahorse_pgp_signature_get_keyid (s->data)))
continue;
have_sigs = TRUE;
- rawids = g_slist_prepend (rawids, (gpointer)seahorse_pgp_signature_get_keyid (s->data));
+ rawids = g_list_prepend (rawids, (gpointer)seahorse_pgp_signature_get_keyid (s->data));
}
}
@@ -1510,7 +1510,7 @@ signatures_populate_model (SeahorseWidget *swidget, SeahorseObjectModel *skmodel
/* Pass it to 'DiscoverKeys' for resolution/download */
keys = seahorse_context_discover_objects (SCTX_APP (), SEAHORSE_PGP, rawids);
- g_slist_free (rawids);
+ g_list_free (rawids);
rawids = NULL;
/* Add the keys to the store */
diff --git a/pkcs11/seahorse-pkcs11-module.c b/pkcs11/seahorse-pkcs11-module.c
index 75e1071..e06f8b6 100644
--- a/pkcs11/seahorse-pkcs11-module.c
+++ b/pkcs11/seahorse-pkcs11-module.c
@@ -40,7 +40,7 @@ seahorse_pkcs11_module_init (void)
GList *slots, *s;
GError *err = NULL;
- for (l = module_paths; l; l = g_slist_next (l)) {
+ for (l = module_paths; l; l = g_list_next (l)) {
module = gck_module_initialize (l->data, &err);
if (!module) {
diff --git a/src/eggtreemultidnd.c b/src/eggtreemultidnd.c
index a76a00f..a6cf0c3 100644
--- a/src/eggtreemultidnd.c
+++ b/src/eggtreemultidnd.c
@@ -35,7 +35,7 @@ typedef struct
guint motion_notify_handler;
guint button_release_handler;
guint drag_data_get_handler;
- GSList *event_list;
+ GList *event_list;
} EggTreeMultiDndData;
/* CUT-N-PASTE from gtktreeview.c */
@@ -166,14 +166,14 @@ static void
stop_drag_check (GtkWidget *widget)
{
EggTreeMultiDndData *priv_data;
- GSList *l;
+ GList *l;
priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
for (l = priv_data->event_list; l != NULL; l = l->next)
gdk_event_free (l->data);
- g_slist_free (priv_data->event_list);
+ g_list_free (priv_data->event_list);
priv_data->event_list = NULL;
g_signal_handler_disconnect (widget, priv_data->motion_notify_handler);
g_signal_handler_disconnect (widget, priv_data->button_release_handler);
@@ -185,7 +185,7 @@ egg_tree_multi_drag_button_release_event (GtkWidget *widget,
gpointer data)
{
EggTreeMultiDndData *priv_data;
- GSList *l;
+ GList *l;
priv_data = g_object_get_data (G_OBJECT (widget), EGG_TREE_MULTI_DND_STRING);
@@ -356,13 +356,13 @@ egg_tree_multi_drag_button_press_event (GtkWidget *widget,
g_object_set_data (G_OBJECT (tree_view), EGG_TREE_MULTI_DND_STRING, priv_data);
}
- if (g_slist_find (priv_data->event_list, event))
+ if (g_list_find (priv_data->event_list, event))
return FALSE;
if (priv_data->event_list)
{
/* save the event to be propagated in order */
- priv_data->event_list = g_slist_append (priv_data->event_list, gdk_event_copy ((GdkEvent*)event));
+ priv_data->event_list = g_list_append (priv_data->event_list, gdk_event_copy ((GdkEvent*)event));
return TRUE;
}
@@ -381,7 +381,7 @@ egg_tree_multi_drag_button_press_event (GtkWidget *widget,
priv_data->pressed_button = event->button;
priv_data->x = event->x;
priv_data->y = event->y;
- priv_data->event_list = g_slist_append (priv_data->event_list, gdk_event_copy ((GdkEvent*)event));
+ priv_data->event_list = g_list_append (priv_data->event_list, gdk_event_copy ((GdkEvent*)event));
priv_data->motion_notify_handler =
g_signal_connect (G_OBJECT (tree_view), "motion_notify_event", G_CALLBACK (egg_tree_multi_drag_motion_event), NULL);
priv_data->button_release_handler =
diff --git a/src/seahorse-keyserver-sync.c b/src/seahorse-keyserver-sync.c
index f2a2ac1..8194c32 100644
--- a/src/seahorse-keyserver-sync.c
+++ b/src/seahorse-keyserver-sync.c
@@ -176,7 +176,7 @@ seahorse_keyserver_sync (GList *keys)
gchar *keyserver;
gchar **keyservers;
GList *k;
- GSList *keyids = NULL;
+ GList *keyids = NULL;
guint i;
if (!keys)
@@ -186,7 +186,7 @@ seahorse_keyserver_sync (GList *keys)
/* Build a keyid list */
for (k = keys; k; k = g_list_next (k))
- keyids = g_slist_prepend (keyids,
+ keyids = g_list_prepend (keyids,
GUINT_TO_POINTER (seahorse_object_get_id (SEAHORSE_OBJECT (k->data))));
mop = seahorse_multi_operation_new ();
@@ -232,7 +232,7 @@ seahorse_keyserver_sync (GList *keys)
}
}
- g_slist_free (keyids);
+ g_list_free (keyids);
g_free (keyserver);
/* Show the progress window if necessary */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]