expand nodes containing subscribed groups
authorThorsten Maerz <torte@netztorte.de>
Mon, 19 Jan 2004 23:19:36 +0000 (23:19 +0000)
committerThorsten Maerz <torte@netztorte.de>
Mon, 19 Jan 2004 23:19:36 +0000 (23:19 +0000)
ChangeLog-gtk2
src/grouplistdialog.c

index 39d8d74f99d4c188bdf29d74b43797214b1c363e..b8158fc09f470d731986aa2e403b4453b894ae3e 100644 (file)
@@ -1,3 +1,7 @@
+2004-01-20 Thorsten Maerz <torte@netztorte.de>
+       * src/grouplistdialog.c
+               expand nodes containing subscribed groups
+
 2004-01-19 Thorsten Maerz <torte@netztorte.de>
        * src/textview.c
                textview: hide cursor, restore old click behaviour
index ac3c17616629b123588eada8f1482a2cb09a6e06..366c2269709e53281ecb0d8aa9dd819dd3026709 100644 (file)
@@ -379,6 +379,19 @@ static GtkCTreeNode *grouplist_create_branch(NewsGroupInfo *ginfo,
        return node;
 }
 
+static void grouplist_expand_upwards(GtkCTree *ctree, const gchar *name) {
+       const gchar *ptr;
+       gchar *newname=g_malloc0(strlen(name));
+
+       for (ptr=name; *ptr; ptr++) {
+               if (*ptr == '.')
+                       gtk_ctree_expand(ctree, 
+                               grouplist_hash_get_branch_node(newname));
+               newname[ptr-name] = *ptr;
+       }
+       g_free(newname);
+}
+
 static void grouplist_dialog_set_list(const gchar *pattern, gboolean refresh)
 {
        GSList *cur;
@@ -418,8 +431,8 @@ static void grouplist_dialog_set_list(const gchar *pattern, gboolean refresh)
        gtk_clist_freeze(GTK_CLIST(ctree));
 
        g_signal_handlers_block_by_func(G_OBJECT(ctree),
-                                                                       G_CALLBACK(ctree_selected),
-                                                                       NULL);
+                                       G_CALLBACK(ctree_selected),
+                                       NULL);
 
        for (cur = group_list; cur != NULL ; cur = cur->next) {
                NewsGroupInfo *ginfo = (NewsGroupInfo *)cur->data;
@@ -428,10 +441,13 @@ static void grouplist_dialog_set_list(const gchar *pattern, gboolean refresh)
                        node = grouplist_create_branch(ginfo, pattern);
                        if (g_slist_find_custom(subscribed, ginfo->name,
                                                (GCompareFunc)g_strcasecmp)
-                           != NULL)
+                                               != NULL) {
                                gtk_ctree_select(GTK_CTREE(ctree), node);
+                       }
                }
        }
+       for (cur = subscribed; cur; cur = g_slist_next(cur))
+               grouplist_expand_upwards(GTK_CTREE(ctree), (gchar *)cur->data);
 
        g_signal_handlers_unblock_by_func(G_OBJECT(ctree),
                                          G_CALLBACK(ctree_selected),