/** * Update list with data for current row. * \param clist List to update. */ static void imp_ldif_update_row( GtkCMCList *clist ) { Ldif_FieldRec *rec; gchar *text[ FIELDS_N_COLS ]; gint row; if( impldif_dlg.rowIndSelect < 0 ) return; row = impldif_dlg.rowIndSelect; rec = gtk_cmclist_get_row_data( clist, row ); if (!rec) return; text[ FIELD_COL_RESERVED ] = ""; text[ FIELD_COL_SELECT ] = ""; text[ FIELD_COL_FIELD ] = rec->tagName; text[ FIELD_COL_ATTRIB ] = rec->userName; gtk_cmclist_freeze( clist ); gtk_cmclist_remove( clist, row ); if( row == impldif_dlg.rowCount - 1 ) { gtk_cmclist_append( clist, text ); } else { gtk_cmclist_insert( clist, row, text ); } if( rec->selected ) { gtk_cmclist_set_pixbuf( clist, row, FIELD_COL_SELECT, markxpm ); } if( rec->reserved ) { gtk_cmclist_set_pixbuf( clist, row, FIELD_COL_RESERVED, markxpm ); } gtk_cmclist_set_row_data( clist, row, rec ); gtk_cmclist_thaw( clist ); }
static void grouplist_dialog_set_list(const gchar *pattern, gboolean refresh) { static GdkCursor *watch_cursor = NULL; GSList *cur; GtkCMCTreeNode *node; GPatternSpec *pspec; GdkWindow *window; if (locked) return; locked = TRUE; if (!pattern || *pattern == '\0') pattern = "*"; if (!watch_cursor) watch_cursor = gdk_cursor_new(GDK_WATCH); window = gtk_widget_get_window(dialog); gdk_window_set_cursor(window, watch_cursor); main_window_cursor_wait(mainwindow_get_mainwindow()); GTK_EVENTS_FLUSH(); if (refresh) { ack = TRUE; grouplist_clear(); recv_set_ui_func(grouplist_recv_func, NULL); group_list = news_get_group_list(news_folder); group_list = g_slist_reverse(group_list); recv_set_ui_func(NULL, NULL); if (group_list == NULL && ack == TRUE) { alertpanel_error(_("Can't retrieve newsgroup list.")); locked = FALSE; gdk_window_set_cursor(window, NULL); main_window_cursor_normal(mainwindow_get_mainwindow()); return; } } else gtk_cmclist_clear(GTK_CMCLIST(ctree)); gtk_entry_set_text(GTK_ENTRY(entry), pattern); grouplist_hash_init(); gtk_cmclist_freeze(GTK_CMCLIST(ctree)); pspec = g_pattern_spec_new(pattern); for (cur = group_list; cur != NULL ; cur = cur->next) { NewsGroupInfo *ginfo = (NewsGroupInfo *)cur->data; if (g_pattern_match_string(pspec, ginfo->name)) { node = grouplist_create_branch(ginfo, pattern); if (g_slist_find_custom(subscribed, ginfo->name, (GCompareFunc)g_ascii_strcasecmp) != NULL) gtk_cmctree_select(GTK_CMCTREE(ctree), node); } } for (cur = subscribed; cur; cur = g_slist_next(cur)) grouplist_expand_upwards(GTK_CMCTREE(ctree), (gchar *)cur->data); g_pattern_spec_free(pspec); gtk_cmclist_thaw(GTK_CMCLIST(ctree)); grouplist_hash_done(); gtk_label_set_text(GTK_LABEL(status_label), _("Done.")); gdk_window_set_cursor(window, NULL); main_window_cursor_normal(mainwindow_get_mainwindow()); locked = FALSE; }