Commit cae57667 authored by Darin Adler's avatar Darin Adler

GNOME2_CONVERSION_COMPLETE eradication campaign

	* libnautilus-private/nautilus-icon-factory.c: (cache_icon_new):
	No last_unref_handler any more.
	(cache_icon_unref): Just keep one ref for the factory, just like
	in the old days, since we don't have a "last_unref_handler" any
	more.
	(nautilus_icon_factory_possibly_free_cached_icon): Look at
	ref_count rather than looking at "outstanding" flag.
	(nautilus_icon_factory_get_pixbuf_for_icon): Just ref, no fancy
	"oustanding" logic.
	(embed_text): Rewrite to use Pango.

	* src/file-manager/fm-list-model.h: Tweak formatting and order.
	* src/file-manager/fm-list-model.c: Tweak formatting and order.
	* src/file-manager/fm-list-view.h: Tweak formatting and order.
	* src/file-manager/fm-list-view.c: Tweak formatting and order.

	* src/file-manager/fm-properties-window.c:
	(select_image_button_callback): Turn this code back on.

	* src/nautilus-bookmarks-window.c: (on_row_move): Remove puts.

	* src/nautilus-complex-search-bar.c:
	(nautilus_complex_search_bar_queue_resize): GnomeDock -> BonoboDock.

	* src/nautilus-property-browser.c: (nautilus_emblem_dialog_new):
	Finish porting to GtkDialog.
	(nautilus_color_selection_dialog_new): Finish porting to
	GtkDialog.
	(add_new_pattern): Re-enable some code.
	(labeled_image_configure): Re-enable some code, take out other stuff.
	(labeled_image_new): Take out some dead code.
	(property_browser_category_button_new): Take out some dead code.

	* src/nautilus-sidebar-tabs.c: (tab_item_destroy),
	(tab_indicator_changed_callback),
	(nautilus_sidebar_tabs_connect_view):
	Use a listener object now, not a listener ID.

	* src/nautilus-simple-search-bar.c:
	(nautilus_simple_search_bar_class_init): Remove some undo code.

	* src/nautilus-switchable-navigation-bar.c:
	(nautilus_switchable_navigation_bar_set_mode): GnomeDock -> BonoboDock.

	* src/nautilus-switchable-search-bar.c:
	(nautilus_switchable_search_bar_set_mode): GnomeDock -> BonoboDock.

	* src/nautilus-view-frame.c: (destroy_view): Make deregister code use
	the BonoboUIEngine instead of the BonoboWindow.
parent 5db444dc
2002-01-24 Darin Adler <darin@bentspoon.com>
GNOME2_CONVERSION_COMPLETE eradication campaign
* libnautilus-private/nautilus-icon-factory.c: (cache_icon_new):
No last_unref_handler any more.
(cache_icon_unref): Just keep one ref for the factory, just like
in the old days, since we don't have a "last_unref_handler" any
more.
(nautilus_icon_factory_possibly_free_cached_icon): Look at
ref_count rather than looking at "outstanding" flag.
(nautilus_icon_factory_get_pixbuf_for_icon): Just ref, no fancy
"oustanding" logic.
(embed_text): Rewrite to use Pango.
* src/file-manager/fm-list-model.h: Tweak formatting and order.
* src/file-manager/fm-list-model.c: Tweak formatting and order.
* src/file-manager/fm-list-view.h: Tweak formatting and order.
* src/file-manager/fm-list-view.c: Tweak formatting and order.
* src/file-manager/fm-properties-window.c:
(select_image_button_callback): Turn this code back on.
* src/nautilus-bookmarks-window.c: (on_row_move): Remove puts.
* src/nautilus-complex-search-bar.c:
(nautilus_complex_search_bar_queue_resize): GnomeDock -> BonoboDock.
* src/nautilus-property-browser.c: (nautilus_emblem_dialog_new):
Finish porting to GtkDialog.
(nautilus_color_selection_dialog_new): Finish porting to
GtkDialog.
(add_new_pattern): Re-enable some code.
(labeled_image_configure): Re-enable some code, take out other stuff.
(labeled_image_new): Take out some dead code.
(property_browser_category_button_new): Take out some dead code.
* src/nautilus-sidebar-tabs.c: (tab_item_destroy),
(tab_indicator_changed_callback),
(nautilus_sidebar_tabs_connect_view):
Use a listener object now, not a listener ID.
* src/nautilus-simple-search-bar.c:
(nautilus_simple_search_bar_class_init): Remove some undo code.
* src/nautilus-switchable-navigation-bar.c:
(nautilus_switchable_navigation_bar_set_mode): GnomeDock -> BonoboDock.
* src/nautilus-switchable-search-bar.c:
(nautilus_switchable_search_bar_set_mode): GnomeDock -> BonoboDock.
* src/nautilus-view-frame.c: (destroy_view): Make deregister code use
the BonoboUIEngine instead of the BonoboWindow.
2002-01-24 Darin Adler <darin@bentspoon.com>
GNOME2_CONVERSION_COMPLETE eradication campaign
......
......@@ -45,6 +45,7 @@
#include <eel/eel-gdk-pixbuf-extensions.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-macros.h>
#include <eel/eel-pango-extensions.h>
#include <eel/eel-string.h>
#include <eel/eel-vfs-extensions.h>
#include <gtk/gtksignal.h>
......@@ -202,9 +203,6 @@ typedef struct {
GdkPixbuf *pixbuf;
NautilusIconDetails details;
/* If true, outside clients have refs to the pixbuf. */
gboolean outstanding;
/* Number of internal clients with refs to the pixbuf. */
guint internal_ref_count;
......@@ -386,26 +384,6 @@ cache_key_destroy (CacheKey *key)
g_free (key);
}
#if GNOME2_CONVERSION_COMPLETE
static void
mark_icon_not_outstanding (GdkPixbuf *pixbuf, gpointer callback_data)
{
NautilusIconFactory *factory;
CacheIcon *icon;
g_assert (callback_data == NULL);
factory = get_icon_factory ();
icon = g_hash_table_lookup (factory->cache_icons, pixbuf);
g_return_if_fail (icon != NULL);
g_return_if_fail (icon->pixbuf == pixbuf);
g_return_if_fail (icon->outstanding);
icon->outstanding = FALSE;
}
#endif
static CacheIcon *
cache_icon_new (GdkPixbuf *pixbuf,
IconRequest request,
......@@ -422,10 +400,6 @@ cache_icon_new (GdkPixbuf *pixbuf,
/* Grab the pixbuf since we are keeping it. */
g_object_ref (pixbuf);
#if GNOME2_CONVERSION_COMPLETE
gdk_pixbuf_set_last_unref_handler
(pixbuf, mark_icon_not_outstanding, NULL);
#endif
/* Make the icon. */
icon = g_new0 (CacheIcon, 1);
......@@ -508,18 +482,7 @@ cache_icon_unref (CacheIcon *icon)
/* Remove from the cache icons table. */
g_hash_table_remove (factory->cache_icons, icon->pixbuf);
/* Since it's no longer in the cache, we don't need to notice the last unref. */
#if GNOME2_CONVERSION_COMPLETE
gdk_pixbuf_set_last_unref_handler (icon->pixbuf, NULL, NULL);
#endif
/* Let go of the pixbuf if we were holding a reference to it.
* If it was still outstanding, we didn't have a reference to it,
* and we were counting on the unref handler to catch it.
*/
if (!icon->outstanding) {
g_object_unref (icon->pixbuf);
}
g_object_unref (icon->pixbuf);
g_free (icon);
}
......@@ -601,7 +564,7 @@ nautilus_icon_factory_possibly_free_cached_icon (gpointer key,
}
/* Don't free a cache entry if the pixbuf is still in use. */
if (icon->outstanding) {
if (G_OBJECT (icon->pixbuf)->ref_count > 1) {
return FALSE;
}
......@@ -1609,11 +1572,10 @@ load_specific_icon (NautilusScalableIcon *scalable_icon,
return icon;
}
#if GNOME2_CONVESION_COMPLETE
static void
destroy_fallback_icon (void)
{
#if 0
CacheIcon *icon;
icon = fallback_icon;
......@@ -1621,9 +1583,8 @@ destroy_fallback_icon (void)
cache_icon_ref (icon);
fallback_icon = NULL;
cache_icon_unref (icon);
}
#endif
}
/* This load function is not allowed to return NULL. */
static CacheIcon *
......@@ -1675,9 +1636,7 @@ load_icon_for_scaling (NautilusScalableIcon *scalable_icon,
NULL);
fallback_icon = cache_icon_new (pixbuf, FALSE, FALSE, NULL);
fallback_icon->is_fallback = TRUE;
#if GNOME2_CONVERSION_COMPLETE
eel_debug_call_at_shutdown (destroy_fallback_icon);
#endif
}
*actual_size_result = NAUTILUS_ICON_SIZE_STANDARD;
......@@ -2036,19 +1995,8 @@ nautilus_icon_factory_get_pixbuf_for_icon (NautilusScalableIcon *scalable_icon,
return NULL;
}
/* The first time we hand out an icon we just leave it with a
* single ref (we'll get called back for the unref), but
* subsequent times we add additional refs.
*/
pixbuf = icon->pixbuf;
if (!icon->outstanding) {
icon->outstanding = TRUE;
#ifndef GNOME2_CONVERSION_COMPLETE
g_object_ref (pixbuf);
#endif
} else {
g_object_ref (pixbuf);
}
g_object_ref (pixbuf);
cache_icon_unref (icon);
return pixbuf;
......@@ -2211,17 +2159,19 @@ embedded_text_font_free (void)
static GdkPixbuf *
embed_text (GdkPixbuf *pixbuf_without_text,
ArtIRect embedded_text_rect,
ArtIRect text_rect,
const char *text)
{
GdkPixbuf *pixbuf_with_text;
PangoLayout *layout;
static PangoContext *context;
g_return_val_if_fail (pixbuf_without_text != NULL, NULL);
/* Quick out for the case where there's no place to embed the
* text or the place is too small or there's no text.
*/
if (!embedded_text_rect_usable (embedded_text_rect) || eel_strlen (text) == 0) {
if (!embedded_text_rect_usable (text_rect) || eel_strlen (text) == 0) {
return NULL;
}
......@@ -2239,32 +2189,21 @@ embed_text (GdkPixbuf *pixbuf_without_text,
}
g_return_val_if_fail (EEL_IS_SCALABLE_FONT (embedded_text_font), NULL);
smooth_text_layout = eel_smooth_text_layout_new (text,
eel_strlen (text),
embedded_text_font,
EMBEDDED_TEXT_FONT_SIZE,
FALSE);
g_return_val_if_fail (EEL_IS_SMOOTH_TEXT_LAYOUT (smooth_text_layout), NULL);
eel_smooth_text_layout_set_line_spacing (smooth_text_layout, EMBEDDED_TEXT_LINE_SPACING);
eel_smooth_text_layout_set_empty_line_height (smooth_text_layout, EMBEDDED_TEXT_EMPTY_LINE_HEIGHT);
#endif
pixbuf_with_text = gdk_pixbuf_copy (pixbuf_without_text);
#if GNOME2_CONVERSION_COMPLETE
eel_smooth_text_layout_draw_to_pixbuf (smooth_text_layout,
pixbuf_with_text,
0,
0,
embedded_text_rect,
GTK_JUSTIFY_LEFT,
FALSE,
EEL_RGB_COLOR_BLACK,
EEL_OPACITY_FULLY_OPAQUE);
if (context == NULL) {
context = eel_pango_ft2_get_context ();
eel_debug_call_at_shutdown_with_data (g_object_unref, context);
}
layout = pango_layout_new (context);
pango_layout_set_text (layout, text, -1);
g_object_unref (smooth_text_layout);
#endif
pixbuf_with_text = gdk_pixbuf_copy (pixbuf_without_text);
/* FIXME: Need a version of eel_gdk_pixbuf_draw_layout that does clipping. */
eel_gdk_pixbuf_draw_layout (pixbuf_with_text,
text_rect.x0, text_rect.y0,
EEL_RGB_COLOR_BLACK, layout);
g_object_unref (layout);
return pixbuf_with_text;
}
......
......@@ -32,7 +32,7 @@
#define G_SLIST(x) ((GSList *) x)
struct _FMListModelDetails {
struct FMListModelDetails {
GSList *files;
GSList *tail;
int length;
......@@ -50,7 +50,7 @@ typedef struct {
int sort_column_id;
} AttributeEntry;
AttributeEntry attributes[] = {
static const AttributeEntry attributes[] = {
{ "name", FM_LIST_MODEL_NAME_COLUMN },
{ "icon", FM_LIST_MODEL_TYPE_COLUMN },
#ifdef GNOME2_CONVERSION_COMPLETE
......@@ -61,128 +61,6 @@ AttributeEntry attributes[] = {
{ "date_modified", FM_LIST_MODEL_DATE_MODIFIED_COLUMN },
};
static void fm_list_model_init (FMListModel *list_store);
static void fm_list_model_class_init (FMListModelClass *klass);
static void fm_list_model_tree_model_init (GtkTreeModelIface *iface);
static void fm_list_model_sortable_init (GtkTreeSortableIface *iface);
static void fm_list_model_drag_source_init (GtkTreeDragSourceIface *iface);
static guint fm_list_model_get_flags (GtkTreeModel *tree_model);
static int fm_list_model_get_n_columns (GtkTreeModel *tree_model);
static GType fm_list_model_get_column_type (GtkTreeModel *tree_model,
int index);
static gboolean fm_list_model_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path);
static GtkTreePath *fm_list_model_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static void fm_list_model_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
int column,
GValue *value);
static gboolean fm_list_model_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static gboolean fm_list_model_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent);
static gboolean fm_list_model_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static int fm_list_model_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static gboolean fm_list_model_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent,
int n);
static gboolean fm_list_model_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *child);
/* Sortable */
static gboolean fm_list_model_get_sort_column_id (GtkTreeSortable *sortable,
gint *sort_column_id,
GtkSortType *order);
GType
fm_list_model_get_type (void)
{
static GType object_type = 0;
if (object_type == 0) {
static const GTypeInfo object_info = {
sizeof (FMListModelClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) fm_list_model_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (FMListModel),
0,
(GInstanceInitFunc) fm_list_model_init,
};
static const GInterfaceInfo tree_model_info = {
(GInterfaceInitFunc) fm_list_model_tree_model_init,
NULL,
NULL
};
static const GInterfaceInfo sortable_info = {
(GInterfaceInitFunc) fm_list_model_sortable_init,
NULL,
NULL
};
static const GInterfaceInfo drag_source_info = {
(GInterfaceInitFunc) fm_list_model_drag_source_init,
NULL,
NULL
};
object_type = g_type_register_static (G_TYPE_OBJECT, "FMListModel", &object_info, 0);
g_type_add_interface_static (object_type,
GTK_TYPE_TREE_MODEL,
&tree_model_info);
g_type_add_interface_static (object_type,
GTK_TYPE_TREE_SORTABLE,
&sortable_info);
g_type_add_interface_static (object_type,
GTK_TYPE_TREE_DRAG_SOURCE,
&drag_source_info);
}
return object_type;
}
static void
fm_list_model_init (FMListModel *model)
{
model->details = g_new0 (FMListModelDetails, 1);
model->details->stamp = g_random_int ();
model->details->sort_column_id = -1;
}
static void
fm_list_model_class_init (FMListModelClass *klass)
{
}
static void
fm_list_model_tree_model_init (GtkTreeModelIface *iface)
{
iface->get_flags = fm_list_model_get_flags;
iface->get_n_columns = fm_list_model_get_n_columns;
iface->get_column_type = fm_list_model_get_column_type;
iface->get_iter = fm_list_model_get_iter;
iface->get_path = fm_list_model_get_path;
iface->get_value = fm_list_model_get_value;
iface->iter_next = fm_list_model_iter_next;
iface->iter_children = fm_list_model_iter_children;
iface->iter_has_child = fm_list_model_iter_has_child;
iface->iter_n_children = fm_list_model_iter_n_children;
iface->iter_nth_child = fm_list_model_iter_nth_child;
iface->iter_parent = fm_list_model_iter_parent;
}
static guint
fm_list_model_get_flags (GtkTreeModel *tree_model)
{
......@@ -597,14 +475,6 @@ fm_list_model_has_default_sort_func (GtkTreeSortable *sortable)
return FALSE;
}
static void
fm_list_model_sortable_init (GtkTreeSortableIface *iface)
{
iface->get_sort_column_id = fm_list_model_get_sort_column_id;
iface->set_sort_column_id = fm_list_model_set_sort_column_id;
iface->has_default_sort_func = fm_list_model_has_default_sort_func;
}
static gboolean
fm_list_model_row_draggable (GtkTreeDragSource *drag_source, GtkTreePath *path)
{
......@@ -619,13 +489,6 @@ fm_list_model_drag_data_get (GtkTreeDragSource *drag_source, GtkTreePath *path,
}
static void
fm_list_model_drag_source_init (GtkTreeDragSourceIface *iface)
{
iface->row_draggable = fm_list_model_row_draggable;
iface->drag_data_get = fm_list_model_drag_data_get;
}
void
fm_list_model_add_file (FMListModel *model, NautilusFile *file)
{
......@@ -856,3 +719,100 @@ fm_list_model_get_sort_column_id_from_sort_type (NautilusFileSortType sort_type)
return -1;
}
static void
fm_list_model_init (FMListModel *model)
{
model->details = g_new0 (FMListModelDetails, 1);
model->details->stamp = g_random_int ();
model->details->sort_column_id = -1;
}
static void
fm_list_model_class_init (FMListModelClass *klass)
{
}
static void
fm_list_model_tree_model_init (GtkTreeModelIface *iface)
{
iface->get_flags = fm_list_model_get_flags;
iface->get_n_columns = fm_list_model_get_n_columns;
iface->get_column_type = fm_list_model_get_column_type;
iface->get_iter = fm_list_model_get_iter;
iface->get_path = fm_list_model_get_path;
iface->get_value = fm_list_model_get_value;
iface->iter_next = fm_list_model_iter_next;
iface->iter_children = fm_list_model_iter_children;
iface->iter_has_child = fm_list_model_iter_has_child;
iface->iter_n_children = fm_list_model_iter_n_children;
iface->iter_nth_child = fm_list_model_iter_nth_child;
iface->iter_parent = fm_list_model_iter_parent;
}
static void
fm_list_model_sortable_init (GtkTreeSortableIface *iface)
{
iface->get_sort_column_id = fm_list_model_get_sort_column_id;
iface->set_sort_column_id = fm_list_model_set_sort_column_id;
iface->has_default_sort_func = fm_list_model_has_default_sort_func;
}
static void
fm_list_model_drag_source_init (GtkTreeDragSourceIface *iface)
{
iface->row_draggable = fm_list_model_row_draggable;
iface->drag_data_get = fm_list_model_drag_data_get;
}
GType
fm_list_model_get_type (void)
{
static GType object_type = 0;
if (object_type == 0) {
static const GTypeInfo object_info = {
sizeof (FMListModelClass),
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) fm_list_model_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (FMListModel),
0,
(GInstanceInitFunc) fm_list_model_init,
};
static const GInterfaceInfo tree_model_info = {
(GInterfaceInitFunc) fm_list_model_tree_model_init,
NULL,
NULL
};
static const GInterfaceInfo sortable_info = {
(GInterfaceInitFunc) fm_list_model_sortable_init,
NULL,
NULL
};
static const GInterfaceInfo drag_source_info = {
(GInterfaceInitFunc) fm_list_model_drag_source_init,
NULL,
NULL
};
object_type = g_type_register_static (G_TYPE_OBJECT, "FMListModel", &object_info, 0);
g_type_add_interface_static (object_type,
GTK_TYPE_TREE_MODEL,
&tree_model_info);
g_type_add_interface_static (object_type,
GTK_TYPE_TREE_SORTABLE,
&sortable_info);
g_type_add_interface_static (object_type,
GTK_TYPE_TREE_DRAG_SOURCE,
&drag_source_info);
}
return object_type;
}
......@@ -44,30 +44,32 @@ enum {
FM_LIST_MODEL_NUM_COLUMNS
};
typedef struct _FMListModel FMListModel;
typedef struct _FMListModelClass FMListModelClass;
typedef struct _FMListModelDetails FMListModelDetails;
typedef struct FMListModelDetails FMListModelDetails;
struct _FMListModel {
typedef struct FMListModel {
GObject parent_instance;
FMListModelDetails *details;
};
} FMListModel;
struct _FMListModelClass {
typedef struct {
GObjectClass parent_class;
};
GType fm_list_model_get_type (void);
void fm_list_model_add_file (FMListModel *model, NautilusFile *file);
void fm_list_model_file_changed (FMListModel *model, NautilusFile *file);
gboolean fm_list_model_is_empty (FMListModel *model);
void fm_list_model_remove_file (FMListModel *model, NautilusFile *file);
void fm_list_model_clear (FMListModel *model);
gboolean fm_list_model_get_tree_iter_from_file (FMListModel *model, NautilusFile *file, GtkTreeIter *iter);
void fm_list_model_set_should_sort_directories_first (FMListModel *model, gboolean sort_directories_first);
int fm_list_model_get_sort_column_id_from_attribute (const char *attribute);
int fm_list_model_get_sort_column_id_from_sort_type (NautilusFileSortType sort_type);
} FMListModelClass;
GType fm_list_model_get_type (void);
void fm_list_model_add_file (FMListModel *model,
NautilusFile *file);
void fm_list_model_file_changed (FMListModel *model,
NautilusFile *file);
gboolean fm_list_model_is_empty (FMListModel *model);
void fm_list_model_remove_file (FMListModel *model,
NautilusFile *file);
void fm_list_model_clear (FMListModel *model);
gboolean fm_list_model_get_tree_iter_from_file (FMListModel *model,
NautilusFile *file,
GtkTreeIter *iter);
void fm_list_model_set_should_sort_directories_first (FMListModel *model,
gboolean sort_directories_first);
int fm_list_model_get_sort_column_id_from_attribute (const char *attribute);
int fm_list_model_get_sort_column_id_from_sort_type (NautilusFileSortType sort_type);
#endif /* FM_LIST_MODEL_H */
......@@ -30,17 +30,17 @@
#include "fm-list-model.h"
#include <eel/eel-cell-renderer-pixbuf-list.h>
#include <eel/eel-dnd.h>
#include <eel/eel-gtk-macros.h>
#include <gtk/gtkcellrendererpixbuf.h>
#include <gtk/gtkcellrenderertext.h>
#include <gtk/gtktreeselection.h>
#include <gtk/gtktreeview.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-macros.h>
#include <libnautilus-private/nautilus-directory-background.h>
#include <libnautilus-private/nautilus-global-preferences.h>
#include <libnautilus-private/nautilus-metadata.h>
struct _FMListViewDetails {
struct FMListViewDetails {
GtkTreeView *tree_view;
FMListModel *model;
};
......@@ -61,34 +61,10 @@ static GtkTargetEntry drag_types [] = {
static NautilusFileSortType default_sort_order_auto_value;
static gboolean default_sort_reversed_auto_value;
static void fm_list_view_init (FMListView *list_view);
static void fm_list_view_class_init (FMListViewClass *klass);
static void create_and_set_up_tree_view (FMListView *view);
static void fm_list_view_begin_loading (FMDirectoryView *view);
static GtkWidget * fm_list_view_get_background_widget (FMDirectoryView *view);
static GList * fm_list_view_get_selection (FMDirectoryView *view);
static gboolean fm_list_view_is_empty (FMDirectoryView *view);
static void fm_list_view_remove_file (FMDirectoryView *view,
NautilusFile *file);
static void fm_list_view_set_selection (FMDirectoryView *view,
GList *selection);
static void fm_list_view_sort_directories_first_changed (FMDirectoryView *view);
EEL_CLASS_BOILERPLATE (FMListView,
fm_list_view,
FM_TYPE_DIRECTORY_VIEW)
static void
fm_list_view_init (FMListView *list_view)
{
list_view->details = g_new0 (FMListViewDetails, 1);
list_view->details->model = g_object_new (FM_TYPE_LIST_MODEL, NULL);
fm_list_model_set_should_sort_directories_first (list_view->details->model,
fm_directory_view_should_sort_directories_first (FM_DIRECTORY_VIEW (list_view)));
create_and_set_up_tree_view (list_view);
}
GNOME_CLASS_BOILERPLATE (FMListView, fm_list_view,
FMDirectoryView, FM_TYPE_DIRECTORY_VIEW)
static void
list_selection_changed_callback (GtkTreeSelection *selection, gpointer user_data)
......@@ -126,6 +102,7 @@ create_and_set_up_tree_view (FMListView *view)
g_signal_connect (view->details->tree_view, "row_activated",
G_CALLBACK (list_activate_callback), view);
view->details->model = g_object_new (FM_TYPE_LIST_MODEL, NULL);
gtk_tree_view_set_model (view->details->tree_view, GTK_TREE_MODEL (view->details->model));
g_object_unref (view->details->model);
......@@ -212,9 +189,8 @@ set_sort_order_from_metadata_and_preferences (FMListView *list_view)
sort_attribute);
if (sort_attribute == NULL) {
sort_column_id= fm_list_model_get_sort_column_id_from_sort_type (default_sort_order_auto_value);
}
else {
sort_column_id = fm_list_model_get_sort_column_id_from_sort_type (default_sort_order_auto_value);
} else {
sort_column_id = fm_list_model_get_sort_column_id_from_attribute (sort_attribute);
}
......@@ -319,13 +295,14 @@ fm_list_view_set_selection (FMDirectoryView *view, GList *selection)
for (list = selection; list; list = list->next) {
file = list->data;
if (fm_list_model_get_tree_iter_from_file (list_view->details->model, file, &iter) == TRUE) {
if (fm_list_model_get_tree_iter_from_file (list_view->details->model, file, &iter)) {
gtk_tree_selection_select_iter (gtk_tree_view_get_selection (list_view->details->tree_view), &iter);
}
}
}
#if 0
static char *
get_attribute_from_sort_type (NautilusFileSortType sort_type)
{
......@@ -363,13 +340,18 @@ fm_list_view_sort_directories_first_changed (FMDirectoryView *view)
fm_list_model_set_should_sort_directories_first (list_view->details->model,
fm_directory_view_should_sort_directories_first (view));
}
static void
fm_list_view_finalize (GObject *object)
{
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
FMListView *list_view;
list_view = FM_LIST_VIEW (object);
g_free (list_view->details);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
......@@ -399,3 +381,13 @@ fm_list_view_class_init (FMListViewClass *klass)
eel_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
&default_sort_reversed_auto_value);
}
static void
fm_list_view_instance_init (FMListView *list_view)
{
list_view->details = g_new0 (FMListViewDetails, 1);
create_and_set_up_tree_view (list_view);
fm_list_view_sort_directories_first_changed (FM_DIRECTORY_VIEW (list_view));
}
......@@ -35,19 +35,16 @@
#define FM_IS_LIST_VIEW(obj) (GTK_CHECK_TYPE ((obj), FM_TYPE_LIST_VIEW))
#define FM_IS_LIST_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), FM_TYPE_LIST_VIEW))
typedef struct _FMListView FMListView;
typedef struct _FMListViewClass FMListViewClass;
typedef struct _FMListViewDetails FMListViewDetails;
typedef struct FMListViewDetails FMListViewDetails;
struct _FMListView {
typedef struct {
FMDirectoryView parent_instance;
FMListViewDetails *details;
};
} FMListView;
struct _FMListViewClass {
typedef struct {
FMDirectoryViewClass parent_class;
};
} FMListViewClass;
GType fm_list_view_get_type (void);