aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-irc-network-manager.c
diff options
context:
space:
mode:
authorChandni Verma <chandniverma2112@gmail.com>2011-02-14 10:11:30 +0800
committerChandni Verma <chandniverma2112@gmail.com>2011-02-15 01:08:46 +0800
commitc7e246e02d143268e0e8fc310c2078d312e4b91a (patch)
tree7e2bef519932cc37cea8ae670143ec86b6f3ff84 /libempathy/empathy-irc-network-manager.c
parent9314023680793975ddd928ca3f7b672b605da760 (diff)
downloadgsoc2013-empathy-c7e246e02d143268e0e8fc310c2078d312e4b91a.tar
gsoc2013-empathy-c7e246e02d143268e0e8fc310c2078d312e4b91a.tar.gz
gsoc2013-empathy-c7e246e02d143268e0e8fc310c2078d312e4b91a.tar.bz2
gsoc2013-empathy-c7e246e02d143268e0e8fc310c2078d312e4b91a.tar.lz
gsoc2013-empathy-c7e246e02d143268e0e8fc310c2078d312e4b91a.tar.xz
gsoc2013-empathy-c7e246e02d143268e0e8fc310c2078d312e4b91a.tar.zst
gsoc2013-empathy-c7e246e02d143268e0e8fc310c2078d312e4b91a.zip
Reset network list button
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=642264
Diffstat (limited to 'libempathy/empathy-irc-network-manager.c')
-rw-r--r--libempathy/empathy-irc-network-manager.c63
1 files changed, 52 insertions, 11 deletions
diff --git a/libempathy/empathy-irc-network-manager.c b/libempathy/empathy-irc-network-manager.c
index 5e0530938..691c05df5 100644
--- a/libempathy/empathy-irc-network-manager.c
+++ b/libempathy/empathy-irc-network-manager.c
@@ -366,7 +366,7 @@ empathy_irc_network_manager_remove (EmpathyIrcNetworkManager *self,
}
static void
-append_network_to_list (const gchar *id,
+append_active_networks_to_list (const gchar *id,
EmpathyIrcNetwork *network,
GSList **list)
{
@@ -376,6 +376,42 @@ append_network_to_list (const gchar *id,
*list = g_slist_prepend (*list, g_object_ref (network));
}
+static void
+append_dropped_networks_to_list (const gchar *id,
+ EmpathyIrcNetwork *network,
+ GSList **list)
+{
+ if (!network->dropped)
+ return;
+
+ *list = g_slist_prepend (*list, g_object_ref (network));
+}
+
+static GSList *
+get_network_list (EmpathyIrcNetworkManager *self,
+ gboolean get_active)
+{
+ EmpathyIrcNetworkManagerPriv *priv;
+ GSList *irc_networks = NULL;
+
+ g_return_val_if_fail (EMPATHY_IS_IRC_NETWORK_MANAGER (self), NULL);
+
+ priv = GET_PRIV (self);
+
+ if (get_active)
+ {
+ g_hash_table_foreach (priv->networks,
+ (GHFunc) append_active_networks_to_list, &irc_networks);
+ }
+ else
+ {
+ g_hash_table_foreach (priv->networks,
+ (GHFunc) append_dropped_networks_to_list, &irc_networks);
+ }
+
+ return irc_networks;
+}
+
/**
* empathy_irc_network_manager_get_networks:
* @manager: an #EmpathyIrcNetworkManager
@@ -388,17 +424,22 @@ append_network_to_list (const gchar *id,
GSList *
empathy_irc_network_manager_get_networks (EmpathyIrcNetworkManager *self)
{
- EmpathyIrcNetworkManagerPriv *priv;
- GSList *irc_networks = NULL;
-
- g_return_val_if_fail (EMPATHY_IS_IRC_NETWORK_MANAGER (self), NULL);
-
- priv = GET_PRIV (self);
-
- g_hash_table_foreach (priv->networks, (GHFunc) append_network_to_list,
- &irc_networks);
+ return get_network_list (self, TRUE);
+}
- return irc_networks;
+/**
+ * empathy_irc_network_manager_get_dropped_networks:
+ * @manager: an #EmpathyIrcNetworkManager
+ *
+ * Get the list of dropped #EmpathyIrcNetworks associated with the given
+ * manager.
+ *
+ * Returns: a new #GSList of refed dropped #EmpathyIrcNetworks
+ */
+GSList *
+empathy_irc_network_manager_get_dropped_networks (EmpathyIrcNetworkManager *self)
+{
+ return get_network_list (self, FALSE);
}
/*