From 66d33128ace8a0f45bca3b95745566cca1f54c14 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Tue, 24 Dec 2002 13:30:17 +0000 Subject: [PATCH] r2228: Made 'Automatic' an icon size, rather than a separate option. Autosizing for views. Better focus style for collections. --- ROX-Filer/Help/Changes | 8 +++++ ROX-Filer/Options.xml | 68 ++++++++++++++++++++++++++----------------- ROX-Filer/src/Docs/Manual.xml | 4 +-- ROX-Filer/src/collection.c | 21 ++++++++----- ROX-Filer/src/display.c | 48 +++++++++++++++++++++++++----- ROX-Filer/src/display.h | 1 + ROX-Filer/src/filer.c | 65 ++++++++++------------------------------- ROX-Filer/src/filer.h | 6 ++-- ROX-Filer/src/global.h | 1 + ROX-Filer/src/menu.c | 55 +++++++++++++++++----------------- ROX-Filer/src/options.c | 16 ++++------ ROX-Filer/src/remote.c | 4 ++- ROX-Filer/src/view_details.c | 41 +++++++++++++++++++------- ROX-Filer/src/view_iface.c | 1 + 14 files changed, 194 insertions(+), 145 deletions(-) diff --git a/ROX-Filer/Help/Changes b/ROX-Filer/Help/Changes index 5b079ed7..c78323da 100644 --- a/ROX-Filer/Help/Changes +++ b/ROX-Filer/Help/Changes @@ -2,6 +2,14 @@ A RISC OS-like filer for X by Thomas Leonard +24-Dec-2002 +~~~~~~~~~~~ +Made 'Automatic' an icon size, rather than a separate option. + +23-Dec-2002 +~~~~~~~~~~~ +Rearranged menus and options for new List View mode. + 20-Dec-2002 ~~~~~~~~~~~ Removed warning message from --new. It can be useful for a session manager... diff --git a/ROX-Filer/Options.xml b/ROX-Filer/Options.xml index 5a46498c..9c1ba09c 100644 --- a/ROX-Filer/Options.xml +++ b/ROX-Filer/Options.xml @@ -31,50 +31,66 @@ The filer will resize windows whenever it seems useful (that is, when changing directory or display style). The largest size, as a percentage of the screen size, that the auto-resizer will resize a window to. - If this is on then filer windows will change from Large icons to Small when showing a new directory with lots of files. - If the directory contains this many items then it will be shown using Small Icons, otherwise Large Icons will be used. - Use single letters instead of words for Scanning, All and Thumbs indicators in the titlebar. - If you open a directory and that directory is already displayed in another window, then this option causes the other window to be closed. - Clicking with mouse button 1 (usually the left button) opens a directory in a new window with this turned on. Clicking with the button-2 (middle) will reuse the current window. - Clicking on an item opens it with this on. Hold down Control to select the item instead. If off, clicking once selects an item; double click to open things. + + + Use single letters instead of words for Scanning, All and Thumbs indicators in the titlebar. + If you open a directory and that directory is already displayed in another window, then this option causes the other window to be closed. + + + Clicking with mouse button 1 (usually the left button) opens a directory in a new window with this turned on. Clicking with the button-2 (middle) will reuse the current window. + Clicking on an item opens it with this on. Hold down Control to select the item instead. If off, clicking once selects an item; double click to open things. + + + + + If this is on then directories will always appear before anything else when sorting by name.
- - If this is on then directories will always appear before anything else when sorting by name. - - - Text wider than this is broken onto two lines in Large Icons mode. In Huge Icons mode, text is wrapped when 50% wider than this. - Maximum width for the text beside a Small Icon. - If this is on then display options for a new window are inherited from the source window if possible, otherwise they are set to the defaults below. - + + + + + + + + + + + + + + + If this is on then files whose names start with a dot are shown too, otherwise they are hidden. + Load every image file and display it, scaled-down, in the filer window instead of the normal icon. + + + + + - + + - + - - - - - - - - If this is on then files whose names start with a dot are shown too, otherwise they are hidden. - Load every image file and display it, scaled-down, in the filer window instead of the normal icon. - + When automatic icon sizing is selected: If the directory contains this many items then it will be shown using Small Icons, otherwise Large Icons will be used. + + + Text wider than this is broken onto two lines in Large Icons mode. In Huge Icons mode, text is wrapped when 50% wider than this. + Maximum width for the text beside a Small Icon.
diff --git a/ROX-Filer/src/Docs/Manual.xml b/ROX-Filer/src/Docs/Manual.xml index 4a237bde..9f2e0a17 100644 --- a/ROX-Filer/src/Docs/Manual.xml +++ b/ROX-Filer/src/Docs/Manual.xml @@ -3457,8 +3457,8 @@ EOF [Style, Details, Sort, Class]) Open a window showing directory Filename. - Style is one of Large, Small - or Huge. + Style is one of Large, Small, Huge + or Automatic. Details is one of None, Summary, Size, Type, Times or Permissions. Sort is one of Name, Type, Date or Size. If any of these three option parameters are missing, the default is used. diff --git a/ROX-Filer/src/collection.c b/ROX-Filer/src/collection.c index 68f725ce..758d62a1 100644 --- a/ROX-Filer/src/collection.c +++ b/ROX-Filer/src/collection.c @@ -142,19 +142,24 @@ static gint collection_scroll_event(GtkWidget *widget, GdkEventScroll *event); static void draw_focus_at(Collection *collection, GdkRectangle *area) { GtkWidget *widget; - GdkGC *gc; + GtkStateType state; widget = GTK_WIDGET(collection); if (GTK_WIDGET_FLAGS(widget) & GTK_HAS_FOCUS) - gc = widget->style->fg_gc[GTK_STATE_ACTIVE]; + state = GTK_STATE_ACTIVE; else - gc = widget->style->fg_gc[GTK_STATE_INSENSITIVE]; - - gdk_draw_rectangle(widget->window, gc, FALSE, - area->x, area->y, - collection->item_width - 1, - area->height - 1); + state = GTK_STATE_INSENSITIVE; + + gtk_paint_focus(widget->style, + widget->window, + state, + NULL, + widget, + "collection", + area->x, area->y, + collection->item_width, + area->height); } static void draw_one_item(Collection *collection, int item, GdkRectangle *area) diff --git a/ROX-Filer/src/display.c b/ROX-Filer/src/display.c index ee38190d..30252ccf 100644 --- a/ROX-Filer/src/display.c +++ b/ROX-Filer/src/display.c @@ -70,12 +70,14 @@ Option o_small_width; Option o_display_show_hidden; Option o_display_show_thumbs; Option o_display_inherit_options; +static Option o_filer_change_size_num; /* Static prototypes */ static void display_details_set(FilerWindow *filer_window, DetailsType details); static void display_style_set(FilerWindow *filer_window, DisplayStyle style); static void options_changed(void); static char *details(FilerWindow *filer_window, DirItem *item); +static void display_set_actual_size_real(FilerWindow *filer_window); enum { SORT_BY_NAME = 0, @@ -91,7 +93,7 @@ enum { void display_init() { option_add_int(&o_display_dirs_first, "display_dirs_first", FALSE); - option_add_int(&o_display_size, "display_size", LARGE_ICONS); + option_add_int(&o_display_size, "display_icon_size", AUTO_SIZE_ICONS); option_add_int(&o_display_details, "display_details", DETAILS_NONE); option_add_int(&o_display_sort_by, "display_sort_by", SORT_BY_NAME); option_add_int(&o_large_width, "display_large_width", 89); @@ -100,6 +102,7 @@ void display_init() option_add_int(&o_display_show_thumbs, "display_show_thumbs", FALSE); option_add_int(&o_display_inherit_options, "display_inherit_options", FALSE); + option_add_int(&o_filer_change_size_num, "filer_change_size_num", 30); option_add_notify(options_changed); } @@ -344,7 +347,7 @@ void display_set_layout(FilerWindow *filer_window, view_style_changed(filer_window->view, VIEW_UPDATE_NAME); if (o_filer_auto_resize.int_value != RESIZE_NEVER) - filer_window_autosize(filer_window); + view_autosize(filer_window->view); } /* Set the 'Show Thumbnails' flag for this window */ @@ -435,6 +438,17 @@ ViewData *display_create_viewdata(FilerWindow *filer_window, DirItem *item) return view; } +/* Set the display style to the desired style. If the desired style + * is AUTO_SIZE_ICONS, choose an appropriate size. Also resizes filer + * window, if requested. + */ +void display_set_actual_size(FilerWindow *filer_window) +{ + display_set_layout(filer_window, filer_window->display_style_wanted, + filer_window->details_type); +} + + /**************************************************************** * INTERNAL FUNCTIONS * ****************************************************************/ @@ -538,18 +552,14 @@ static char *details(FilerWindow *filer_window, DirItem *item) /* Note: Call style_changed after this */ static void display_details_set(FilerWindow *filer_window, DetailsType details) { - if (filer_window->details_type == details) - return; filer_window->details_type = details; } /* Note: Call style_changed after this */ static void display_style_set(FilerWindow *filer_window, DisplayStyle style) { - if (filer_window->display_style == style) - return; - - filer_window->display_style = style; + filer_window->display_style_wanted = style; + display_set_actual_size_real(filer_window); } /* Each displayed item has a ViewData structure with some cached information @@ -686,3 +696,25 @@ void display_update_view(FilerWindow *filer_window, view->name_height = h / PANGO_SCALE; } +/* Sets display_style from display_style_wanted. + * See also display_set_actual_size(). + */ +static void display_set_actual_size_real(FilerWindow *filer_window) +{ + DisplayStyle size = filer_window->display_style_wanted; + int n; + + g_return_if_fail(filer_window != NULL); + + if (size == AUTO_SIZE_ICONS) + { + n = view_count_items(filer_window->view); + + if (n >= o_filer_change_size_num.int_value) + size = SMALL_ICONS; + else + size = LARGE_ICONS; + } + + filer_window->display_style = size; +} diff --git a/ROX-Filer/src/display.h b/ROX-Filer/src/display.h index 5f224ef4..220be447 100644 --- a/ROX-Filer/src/display.h +++ b/ROX-Filer/src/display.h @@ -67,5 +67,6 @@ void display_update_view(FilerWindow *filer_window, void display_update_views(FilerWindow *filer_window); void draw_small_icon(GdkWindow *window, GdkRectangle *area, DirItem *item, MaskedPixmap *image, gboolean selected); +void display_set_actual_size(FilerWindow *filer_window); #endif /* _DISPLAY_H */ diff --git a/ROX-Filer/src/filer.c b/ROX-Filer/src/filer.c index 3d8e7e97..88334a27 100644 --- a/ROX-Filer/src/filer.c +++ b/ROX-Filer/src/filer.c @@ -102,7 +102,6 @@ static void set_selection_state(FilerWindow *filer_window, gboolean normal); static void filer_next_thumb(GObject *window, const gchar *path); static void start_thumb_scanning(FilerWindow *filer_window); static void filer_options_changed(void); -static void set_style_by_number_of_items(FilerWindow *filer_window); static void drag_end(GtkWidget *widget, GdkDragContext *context, FilerWindow *filer_window); static void drag_leave(GtkWidget *widget, @@ -124,8 +123,8 @@ static GdkCursor *crosshair = NULL; */ static gboolean not_local = FALSE; -static Option o_filer_change_size, o_filer_change_size_num; static Option o_short_flag_names; +static Option o_filer_view_type; Option o_filer_auto_resize, o_unique_filer_windows; Option o_filer_size_limit; @@ -142,8 +141,8 @@ void filer_init(void) option_add_int(&o_short_flag_names, "filer_short_flag_names", FALSE); - option_add_int(&o_filer_change_size, "filer_change_size", TRUE); - option_add_int(&o_filer_change_size_num, "filer_change_size_num", 30); + option_add_int(&o_filer_view_type, "filer_view_type", + VIEW_TYPE_COLLECTION); option_add_notify(filer_options_changed); @@ -247,15 +246,6 @@ void filer_window_set_size(FilerWindow *filer_window, int w, int h) } } -/* Resize the window to fit the items currently in the Directory. - * When opening a directory for the first time, the names will be known but not - * the types and images. We can still make a good estimate of the size. - */ -void filer_window_autosize(FilerWindow *filer_window) -{ - view_autosize(filer_window->view); -} - /* Called on a timeout while scanning or when scanning ends * (whichever happens first). */ @@ -271,8 +261,7 @@ static gint open_filer_window(FilerWindow *filer_window) if (!GTK_WIDGET_VISIBLE(filer_window->window)) { - set_style_by_number_of_items(filer_window); - filer_window_autosize(filer_window); + display_set_actual_size(filer_window); gtk_widget_show(filer_window->window); } @@ -1053,10 +1042,10 @@ void filer_change_to(FilerWindow *filer_window, attach(filer_window); - set_style_by_number_of_items(filer_window); + display_set_actual_size(filer_window); if (o_filer_auto_resize.int_value == RESIZE_ALWAYS) - filer_window_autosize(filer_window); + view_autosize(filer_window->view); if (filer_window->mini_type == MINI_PATH) gtk_idle_add((GtkFunction) minibuffer_show_cb, @@ -1173,10 +1162,11 @@ FilerWindow *filer_opendir(const char *path, FilerWindow *src_win, if (src_win && o_display_inherit_options.int_value) { filer_window->sort_fn = src_win->sort_fn; - dstyle = src_win->display_style; + dstyle = src_win->display_style_wanted; dtype = src_win->details_type; filer_window->show_hidden = src_win->show_hidden; filer_window->show_thumbs = src_win->show_thumbs; + filer_window->view_type = src_win->view_type; } else { @@ -1188,10 +1178,9 @@ FilerWindow *filer_opendir(const char *path, FilerWindow *src_win, dstyle = o_display_size.int_value; dtype = o_display_details.int_value; - filer_window->show_hidden = - o_display_show_hidden.int_value; - filer_window->show_thumbs = - o_display_show_thumbs.int_value; + filer_window->show_hidden = o_display_show_hidden.int_value; + filer_window->show_thumbs = o_display_show_thumbs.int_value; + filer_window->view_type = o_filer_view_type.int_value; } /* Add all the user-interface elements & realise */ @@ -1286,6 +1275,8 @@ void filer_set_view_type(FilerWindow *filer_window, ViewType type) /* Only when changing type. Otherwise, will attach later. */ filer_window->directory = dir; attach(filer_window); + + view_autosize(filer_window->view); } } @@ -1321,7 +1312,7 @@ static void filer_add_widgets(FilerWindow *filer_window, const gchar *wm_class) gtk_box_pack_start_defaults(GTK_BOX(hbox), vbox); filer_window->toplevel_vbox = GTK_BOX(vbox); - filer_set_view_type(filer_window, VIEW_TYPE_COLLECTION); + filer_set_view_type(filer_window, filer_window->view_type); /* If we want a toolbar, create it now */ toolbar_update_toolbar(filer_window); @@ -1838,32 +1829,6 @@ static void filer_options_changed(void) } } -/* Change to Large or Small icons depending on the number of items - * in the directory, subject to options. - */ -static void set_style_by_number_of_items(FilerWindow *filer_window) -{ - int n; - - g_return_if_fail(filer_window != NULL); - - if (!o_filer_change_size.int_value) - return; /* Don't auto-set style */ - - if (filer_window->display_style != LARGE_ICONS && - filer_window->display_style != SMALL_ICONS) - return; /* Only change between these two styles */ - - n = view_count_items(filer_window->view); - - if (n >= o_filer_change_size_num.int_value) - display_set_layout(filer_window, SMALL_ICONS, - filer_window->details_type); - else - display_set_layout(filer_window, LARGE_ICONS, - filer_window->details_type); -} - /* Append interesting information to this GString */ void filer_add_tip_details(FilerWindow *filer_window, GString *tip, DirItem *item) @@ -2056,7 +2021,7 @@ void filer_perform_action(FilerWindow *filer_window, GdkEventButton *event) view_start_lasso_box(view, event); break; case ACT_RESIZE: - filer_window_autosize(filer_window); + view_autosize(filer_window->view); break; default: g_warning("Unsupported action : %d\n", action); diff --git a/ROX-Filer/src/filer.h b/ROX-Filer/src/filer.h index dbf08a67..9e952231 100644 --- a/ROX-Filer/src/filer.h +++ b/ROX-Filer/src/filer.h @@ -31,10 +31,11 @@ typedef enum FILER_CREATE_THUMBS = 0x04, /* Create thumbs when scan ends */ } FilerFlags; +/* Numbers used in options */ typedef enum { - VIEW_TYPE_COLLECTION, /* Icons view */ - VIEW_TYPE_DETAILS /* TreeView details list */ + VIEW_TYPE_COLLECTION = 0, /* Icons view */ + VIEW_TYPE_DETAILS = 1 /* TreeView details list */ } ViewType; /* iter's next method has just returned the clicked item... */ @@ -58,6 +59,7 @@ struct _FilerWindow DetailsType details_type; DisplayStyle display_style; + DisplayStyle display_style_wanted; Directory *directory; diff --git a/ROX-Filer/src/global.h b/ROX-Filer/src/global.h index aa951665..d88fb72b 100644 --- a/ROX-Filer/src/global.h +++ b/ROX-Filer/src/global.h @@ -111,6 +111,7 @@ typedef enum { /* Values used in options, must start at 0 */ LARGE_ICONS = 0, SMALL_ICONS = 1, HUGE_ICONS = 2, + AUTO_SIZE_ICONS = 3, UNKNOWN_STYLE } DisplayStyle; diff --git a/ROX-Filer/src/menu.c b/ROX-Filer/src/menu.c index 6f36a543..3dab1870 100644 --- a/ROX-Filer/src/menu.c +++ b/ROX-Filer/src/menu.c @@ -126,6 +126,7 @@ static void view_type(gpointer data, guint action, GtkWidget *widget); /* (action used in these three - DetailsType) */ static void change_size(gpointer data, guint action, GtkWidget *widget); +static void change_size_auto(gpointer data, guint action, GtkWidget *widget); static void set_with(gpointer data, guint action, GtkWidget *widget); static void sort_name(gpointer data, guint action, GtkWidget *widget); @@ -165,6 +166,7 @@ static GtkWidget *filer_menu; /* The popup filer menu */ static GtkWidget *filer_file_item; /* The File '' label */ static GtkWidget *filer_file_menu; /* The File '' menu */ static GtkWidget *file_shift_item; /* Shift Open label */ +static GtkWidget *filer_auto_size_menu; /* The Automatic item */ static GtkWidget *filer_hidden_menu; /* The Show Hidden item */ static GtkWidget *filer_thumb_menu; /* The Show Thumbs item */ static GtkWidget *filer_new_window; /* The New Window item */ @@ -182,10 +184,11 @@ static GtkItemFactoryEntry filer_menu_def[] = { {">>" N_("Permissions"), NULL, set_with, DETAILS_PERMISSIONS, NULL}, {">>" N_("Type"), NULL, set_with, DETAILS_TYPE, NULL}, {">>" N_("Times"), NULL, set_with, DETAILS_TIMES, NULL}, -{">" N_("Details View"), NULL, view_type, VIEW_TYPE_DETAILS, NULL}, +{">" N_("List View"), NULL, view_type, VIEW_TYPE_DETAILS, NULL}, {">", NULL, NULL, 0, ""}, {">" N_("Bigger Icons"), NULL, change_size, 1, NULL}, {">" N_("Smaller Icons"), NULL, change_size, -1, NULL}, +{">" N_("Automatic"), NULL, change_size_auto, 0, ""}, {">", NULL, NULL, 0, ""}, {">" N_("Sort by Name"), NULL, sort_name, 0, NULL}, {">" N_("Sort by Type"), NULL, sort_type, 0, NULL}, @@ -280,6 +283,7 @@ void ensure_filer_menu(void) GET_MENU_ITEM(filer_menu, "filer"); GET_SMENU_ITEM(filer_file_menu, "filer", "File"); GET_SSMENU_ITEM(filer_hidden_menu, "filer", "Display", "Show Hidden"); + GET_SSMENU_ITEM(filer_auto_size_menu, "filer", "Display", "Automatic"); GET_SSMENU_ITEM(filer_thumb_menu, "filer", "Display", "Show Thumbnails"); @@ -736,6 +740,9 @@ void show_filer_menu(FilerWindow *filer_window, GdkEvent *event, ViewIter *iter) gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(filer_hidden_menu), filer_window->show_hidden); + gtk_check_menu_item_set_active( + GTK_CHECK_MENU_ITEM(filer_auto_size_menu), + filer_window->display_style_wanted == AUTO_SIZE_ICONS); buffer = g_string_new(NULL); switch (n_selected) @@ -867,41 +874,33 @@ static void view_type(gpointer data, guint action, GtkWidget *widget) if (view_type == VIEW_TYPE_COLLECTION) display_set_layout(window_with_focus, - window_with_focus->display_style, DETAILS_NONE); + window_with_focus->display_style_wanted, + DETAILS_NONE); filer_set_view_type(window_with_focus, (ViewType) action); } static void change_size(gpointer data, guint action, GtkWidget *widget) { - DisplayStyle size; - DetailsType type; - g_return_if_fail(window_with_focus != NULL); - type = window_with_focus->details_type; - size = window_with_focus->display_style; + display_change_size(window_with_focus, action == 1); +} - if (action == 1) - { - if (size == SMALL_ICONS) - size = LARGE_ICONS; - else if (size == LARGE_ICONS) - size = HUGE_ICONS; - else - return; - } - else if (action == -1) - { - if (size == LARGE_ICONS) - size = SMALL_ICONS; - else if (size == HUGE_ICONS) - size = LARGE_ICONS; - else - return; - } +static void change_size_auto(gpointer data, guint action, GtkWidget *widget) +{ + g_return_if_fail(window_with_focus != NULL); - display_set_layout(window_with_focus, size, type); + if (updating_menu) + return; + + if (window_with_focus->display_style_wanted == AUTO_SIZE_ICONS) + display_set_layout(window_with_focus, + window_with_focus->display_style, + window_with_focus->details_type); + else + display_set_layout(window_with_focus, AUTO_SIZE_ICONS, + window_with_focus->details_type); } static void set_with(gpointer data, guint action, GtkWidget *widget) @@ -910,7 +909,7 @@ static void set_with(gpointer data, guint action, GtkWidget *widget) g_return_if_fail(window_with_focus != NULL); - size = window_with_focus->display_style; + size = window_with_focus->display_style_wanted; filer_set_view_type(window_with_focus, VIEW_TYPE_COLLECTION); display_set_layout(window_with_focus, size, action); @@ -1606,7 +1605,7 @@ static void resize(gpointer data, guint action, GtkWidget *widget) { g_return_if_fail(window_with_focus != NULL); - filer_window_autosize(window_with_focus); + view_autosize(window_with_focus->view); } static void new_window(gpointer data, guint action, GtkWidget *widget) diff --git a/ROX-Filer/src/options.c b/ROX-Filer/src/options.c index 8db9463b..c34c534a 100644 --- a/ROX-Filer/src/options.c +++ b/ROX-Filer/src/options.c @@ -852,8 +852,8 @@ static void tree_cursor_changed(GtkTreeView *tv, gpointer data) static GtkWidget *build_window_frame(GtkTreeView **tree_view) { GtkWidget *notebook; - GtkWidget *tl_vbox, *hbox, *sw, *tv; - GtkWidget *actions, *button, *frame; + GtkWidget *tl_vbox, *hbox, *frame, *tv; + GtkWidget *actions, *button; GtkTreeStore *model; char *string, *save_path; @@ -880,13 +880,9 @@ static GtkWidget *build_window_frame(GtkTreeView **tree_view) gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook), FALSE); gtk_container_add(GTK_CONTAINER(frame), notebook); - /* scrolled window for the tree view */ - sw = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), - GTK_SHADOW_IN); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start(GTK_BOX(hbox), sw, FALSE, TRUE, 0); + frame = gtk_frame_new(NULL); + gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); + gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 0); /* tree view */ model = gtk_tree_store_new(2, G_TYPE_STRING, GTK_TYPE_WIDGET); @@ -898,7 +894,7 @@ static GtkWidget *build_window_frame(GtkTreeView **tree_view) gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tv), FALSE); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tv), -1, NULL, gtk_cell_renderer_text_new(), "text", 0, NULL); - gtk_container_add(GTK_CONTAINER(sw), tv); + gtk_container_add(GTK_CONTAINER(frame), tv); g_signal_connect(tv, "cursor_changed", G_CALLBACK(tree_cursor_changed), notebook); diff --git a/ROX-Filer/src/remote.c b/ROX-Filer/src/remote.c index 4e06af6e..b97cc62a 100644 --- a/ROX-Filer/src/remote.c +++ b/ROX-Filer/src/remote.c @@ -585,6 +585,7 @@ static xmlNodePtr rpc_OpenDir(GList *args) ds = !g_strcasecmp(style, "Large") ? LARGE_ICONS : !g_strcasecmp(style, "Small") ? SMALL_ICONS : !g_strcasecmp(style, "Huge") ? HUGE_ICONS : + !g_strcasecmp(style, "Automatic") ? AUTO_SIZE_ICONS : UNKNOWN_STYLE; if (ds == UNKNOWN_STYLE) g_warning("Unknown style '%s'\n", style); @@ -610,7 +611,8 @@ static xmlNodePtr rpc_OpenDir(GList *args) if (dt == DETAILS_UNKNOWN) g_warning("Unknown details type '%s'\n", details); else - display_set_layout(fwin, fwin->display_style, dt); + display_set_layout(fwin, + fwin->display_style_wanted, dt); g_free(details); } diff --git a/ROX-Filer/src/view_details.c b/ROX-Filer/src/view_details.c index fc5abdc6..9cb4c5b3 100644 --- a/ROX-Filer/src/view_details.c +++ b/ROX-Filer/src/view_details.c @@ -299,8 +299,6 @@ static void details_get_value(GtkTreeModel *tree_model, view_item = (ViewItem *) items->pdata[i]; item = view_item->item; - /* g_print("[ get %d ]\n", column); */ - if (column == COL_LEAF) { g_value_init(value, G_TYPE_STRING); @@ -750,7 +748,7 @@ static void view_details_init(GTypeInstance *object, gpointer gclass) /* Name */ cell = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(_("Name"), cell, + column = gtk_tree_view_column_new_with_attributes(_("_Name"), cell, "text", COL_LEAF, "foreground-gdk", COL_COLOUR, "background-gdk", COL_BG_COLOUR, @@ -760,7 +758,7 @@ static void view_details_init(GTypeInstance *object, gpointer gclass) /* Type */ cell = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(_("Type"), cell, + column = gtk_tree_view_column_new_with_attributes(_("_Type"), cell, "text", COL_TYPE, "foreground-gdk", COL_COLOUR, "background-gdk", COL_BG_COLOUR, @@ -770,7 +768,7 @@ static void view_details_init(GTypeInstance *object, gpointer gclass) /* Perm */ cell = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(_("Permissions"), + column = gtk_tree_view_column_new_with_attributes(_("_Permissions"), cell, "text", COL_PERM, "foreground-gdk", COL_COLOUR, "background-gdk", COL_BG_COLOUR, @@ -779,7 +777,7 @@ static void view_details_init(GTypeInstance *object, gpointer gclass) /* Owner */ cell = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(_("Owner"), cell, + column = gtk_tree_view_column_new_with_attributes(_("_Owner"), cell, "text", COL_OWNER, "foreground-gdk", COL_COLOUR, "background-gdk", COL_BG_COLOUR, @@ -789,7 +787,7 @@ static void view_details_init(GTypeInstance *object, gpointer gclass) /* Group */ cell = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(_("Group"), cell, + column = gtk_tree_view_column_new_with_attributes(_("_Group"), cell, "text", COL_GROUP, "foreground-gdk", COL_COLOUR, "background-gdk", COL_BG_COLOUR, @@ -799,7 +797,7 @@ static void view_details_init(GTypeInstance *object, gpointer gclass) /* Size */ cell = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(_("Size"), cell, + column = gtk_tree_view_column_new_with_attributes(_("_Size"), cell, "text", COL_SIZE, "foreground-gdk", COL_COLOUR, "background-gdk", COL_BG_COLOUR, @@ -809,7 +807,7 @@ static void view_details_init(GTypeInstance *object, gpointer gclass) /* MTime */ cell = gtk_cell_renderer_text_new(); - column = gtk_tree_view_column_new_with_attributes(_("M-Time"), cell, + column = gtk_tree_view_column_new_with_attributes(_("_M-Time"), cell, "text", COL_MTIME, "foreground-gdk", COL_COLOUR, "background-gdk", COL_BG_COLOUR, @@ -1266,6 +1264,30 @@ static void view_details_wink_item(ViewIface *view, ViewIter *iter) static void view_details_autosize(ViewIface *view) { + ViewDetails *view_details = (ViewDetails *) view; + FilerWindow *filer_window = view_details->filer_window; + GdkWindow *bin; + int max_height = (o_filer_size_limit.int_value * screen_height) / 100; + int h, y; + GtkTreeView *tree = (GtkTreeView *) view; + GtkTreeViewColumn *column; + GtkRequisition req; + + gtk_widget_size_request(GTK_WIDGET(view), &req); + column = gtk_tree_view_get_column(tree, 1); + gtk_tree_view_column_cell_get_size(column, NULL, NULL, NULL, NULL, &h); + + bin = gtk_tree_view_get_bin_window(GTK_TREE_VIEW(view)); + + gdk_window_get_position(bin, NULL, &y); + + h = MAX(h, SMALL_HEIGHT); + + h = (view_details->items->len + 2) * h + y; + + h = MIN(h, max_height); + + filer_window_set_size(filer_window, 5, h); } static gboolean view_details_cursor_visible(ViewIface *view) @@ -1282,7 +1304,6 @@ static void view_details_set_base(ViewIface *view, ViewIter *iter) static void view_details_start_lasso_box(ViewIface *view, GdkEventButton *event) { - g_print("TODO: lasso drag\n"); } static void view_details_extend_tip(ViewIface *view, diff --git a/ROX-Filer/src/view_iface.c b/ROX-Filer/src/view_iface.c index 71210f9c..0077962e 100644 --- a/ROX-Filer/src/view_iface.c +++ b/ROX-Filer/src/view_iface.c @@ -116,6 +116,7 @@ void view_sort(ViewIface *obj) void view_style_changed(ViewIface *obj, int flags) { g_return_if_fail(VIEW_IS_IFACE(obj)); + VIEW_IFACE_GET_CLASS(obj)->style_changed(obj, flags); } -- 2.11.4.GIT