Use constants for column indexes
This commit is contained in:
parent
a258ca7cdc
commit
50bae5b5cf
|
@ -38,6 +38,13 @@ typedef struct _BrowserPlugin
|
|||
GtkWidget * status;
|
||||
} Selection;
|
||||
|
||||
typedef enum _SelectionCount
|
||||
{
|
||||
SC_ICON = 0, SC_FILENAME, SC_FILENAME_DISPLAY
|
||||
} SelectionCount;
|
||||
#define SC_LAST SC_FILENAME_DISPLAY
|
||||
#define SC_COUNT (SC_LAST + 1)
|
||||
|
||||
|
||||
/* prototypes */
|
||||
static Selection * _selection_init(BrowserPluginHelper * helper);
|
||||
|
@ -81,19 +88,23 @@ static Selection * _selection_init(BrowserPluginHelper * helper)
|
|||
widget = gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
selection->store = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING,
|
||||
selection->store = gtk_list_store_new(SC_COUNT,
|
||||
GDK_TYPE_PIXBUF,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING);
|
||||
selection->view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
|
||||
selection->store));
|
||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(selection->view),
|
||||
FALSE);
|
||||
/* column: icon */
|
||||
renderer = gtk_cell_renderer_pixbuf_new();
|
||||
column = gtk_tree_view_column_new_with_attributes(NULL, renderer,
|
||||
"pixbuf", 0, NULL);
|
||||
"pixbuf", SC_ICON, NULL);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(selection->view), column);
|
||||
/* column: filename */
|
||||
renderer = gtk_cell_renderer_text_new();
|
||||
column = gtk_tree_view_column_new_with_attributes(_("Filename"),
|
||||
renderer, "text", 2, NULL);
|
||||
renderer, "text", SC_FILENAME_DISPLAY, NULL);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(selection->view), column);
|
||||
gtk_container_add(GTK_CONTAINER(widget), selection->view);
|
||||
gtk_box_pack_start(GTK_BOX(selection->widget), widget, TRUE, TRUE, 0);
|
||||
|
@ -146,8 +157,9 @@ static void _selection_refresh(Selection * selection, GList * selected)
|
|||
pst, 16);
|
||||
basename = g_path_get_basename(l->data);
|
||||
gtk_list_store_append(selection->store, &iter);
|
||||
gtk_list_store_set(selection->store, &iter, 0, pixbuf,
|
||||
1, l->data, 2, basename, -1);
|
||||
gtk_list_store_set(selection->store, &iter, SC_ICON, pixbuf,
|
||||
SC_FILENAME, l->data,
|
||||
SC_FILENAME_DISPLAY, basename, -1);
|
||||
g_free(basename);
|
||||
if(plst != NULL)
|
||||
size += lst.st_size;
|
||||
|
|
Loading…
Reference in New Issue
Block a user