#include "gtksctree.h"
#include "sylpheed-marshal.h"
-
+#include "stock_pixmap.h"
enum {
ROW_POPUP_MENU,
LAST_SIGNAL
};
+static GdkPixmap *emptyxpm = NULL;
+static GdkBitmap *emptyxpmmask = NULL;
static void gtk_sctree_class_init (GtkSCTreeClass *class);
static void gtk_sctree_init (GtkSCTree *sctree);
min = prev_row;
max = row;
}
- for (i = min; i <= max; i++)
+ sctree->selecting_range = TRUE;
+ for (i = min; i < max; i++)
gtk_clist_select_row (GTK_CLIST (sctree), i, -1);
+
+ sctree->selecting_range = FALSE;
+ gtk_clist_select_row (GTK_CLIST (sctree), max, -1);
}
/* Handles row selection according to the specified modifier state */
(GTK_CLIST(sctree)->selection_mode != GTK_SELECTION_BROWSE);
gtk_clist_freeze (GTK_CLIST (sctree));
+
GTK_CLIST(sctree)->focus_row = row;
+
GTK_CLIST_GET_CLASS(sctree)->refresh(GTK_CLIST(sctree));
+
if (!additive)
gtk_clist_unselect_all (GTK_CLIST (sctree));
sctree->anchor_row = node;
} else
select_range (sctree, row);
+
gtk_clist_thaw (GTK_CLIST (sctree));
}
sctree->dnd_select_pending_state = 0;
if (on_row)
- g_signal_emit (GTK_OBJECT (sctree),
+ g_signal_emit (G_OBJECT (sctree),
sctree_signals[OPEN_ROW], 0);
retval = TRUE;
-1, 0);
}
+void gtk_sctree_select_with_state (GtkSCTree *sctree, GtkCTreeNode *node, int state)
+{
+ select_row(sctree,
+ g_list_position(GTK_CLIST(sctree)->row_list, (GList *)node),
+ -1, state);
+}
+
void gtk_sctree_unselect_all (GtkSCTree *sctree)
{
gtk_clist_unselect_all(GTK_CLIST(sctree));
return gtk_ctree_last_visible (ctree, work);
}
+
+/* this wrapper simply replaces NULL pixmaps
+ * with a transparent, 1x1 pixmap. This works
+ * around a memory problem deep inside gtk,
+ * revealed by valgrind.
+ */
+GtkCTreeNode* gtk_sctree_insert_node (GtkCTree *ctree,
+ GtkCTreeNode *parent,
+ GtkCTreeNode *sibling,
+ gchar *text[],
+ guint8 spacing,
+ GdkPixmap *pixmap_closed,
+ GdkBitmap *mask_closed,
+ GdkPixmap *pixmap_opened,
+ GdkBitmap *mask_opened,
+ gboolean is_leaf,
+ gboolean expanded)
+{
+ if (!emptyxpm) {
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_EMPTY,
+ &emptyxpm, &emptyxpmmask);
+ }
+ if (!pixmap_closed) {
+ pixmap_closed = emptyxpm;
+ mask_closed = emptyxpmmask;
+ }
+ if (!pixmap_opened) {
+ pixmap_opened = emptyxpm;
+ mask_opened = emptyxpmmask;
+ }
+ return gtk_ctree_insert_node(ctree, parent, sibling, text,spacing,
+ pixmap_closed, mask_closed, pixmap_opened, mask_opened,
+ is_leaf, expanded);
+}
+
+/* this wrapper simply replaces NULL pixmaps
+ * with a transparent, 1x1 pixmap. This works
+ * around a memory problem deep inside gtk,
+ * revealed by valgrind.
+ */
+void gtk_sctree_set_node_info (GtkCTree *ctree,
+ GtkCTreeNode *node,
+ const gchar *text,
+ guint8 spacing,
+ GdkPixmap *pixmap_closed,
+ GdkBitmap *mask_closed,
+ GdkPixmap *pixmap_opened,
+ GdkBitmap *mask_opened,
+ gboolean is_leaf,
+ gboolean expanded)
+{
+ if (!emptyxpm) {
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_EMPTY,
+ &emptyxpm, &emptyxpmmask);
+ }
+ if (!pixmap_closed) {
+ pixmap_closed = emptyxpm;
+ mask_closed = emptyxpmmask;
+ }
+ if (!pixmap_opened) {
+ pixmap_opened = emptyxpm;
+ mask_opened = emptyxpmmask;
+ }
+ gtk_ctree_set_node_info(ctree, node, text, spacing,
+ pixmap_closed, mask_closed, pixmap_opened, mask_opened,
+ is_leaf, expanded);
+
+}