GPOINTER_TO_UINT() *does* drop the upper 32 bits on 64-bit
Windows. After all, it by definition produces a (32-bit) unsigned int.
The GLib commit mentioned in the reverted commit's log message just
means that it does this without any compiler warning about casting
from pointer to integer of smaller size, as it first casts to a 64-bit
integer, then casts that to a (32-bit) int.
We must use the GdkNativeWindow cast here so that on 64-bit Windows
the gpointer data in embedded_list is converted to a (64-bit) native
window handle without going through 32-bit truncation. If ifdefs are
required to avoid compiler warnings on X11, so be it then. Probably it
would be best to introduce a GDK_GPOINTER_TO_NATIVE_WINDOW() macro in
gdktypes.h.
This reverts commit 78151dc7d4.
Add support for putting widgets in the tab area, before or after
the tabs. This was requested a long time ago in bug 116650. The
implementation is the work of Johannes Schmid.
Either g_type_register_static_simple (used by G_DEFINE_TYPE_EXTENDED)
and G_IMPLEMENT_INTERFACE use automatic variables for GTypeInfo and
GInterfaceInfo structs, while tutorials and source code often use
static variables. This commit consistently adopts the former method.
https://bugzilla.gnome.org/show_bug.cgi?id=600158
This allows disposing of the filesystemmodel while the file enumeration
is still happening.
As the filechooser does not disconnect its signals because it assumes it
is the only owner of the model, this also prevents a SEGV when emitting
the "load-finished" signal in that case.
The translation_domain argument should be const gchar * to allow compilation
with -Wwrite-strings. It only passes the argument to
g_option_context_add_main_entries() which is already const gchar*.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=583305
Run gtk_icon_view_layout() if necessary before attempting to paint the
icon view items during an expose event. This ensures all the items have
valid sizes, as some themes don't take kindly to negative dimensions.
Previously the filename would get re-set on the button if one cleared the selection,
as an async cancellable was not getting canceled in that case.
Signed-off-by: Federico Mena Quintero <federico@novell.com>
GTK_ENTRY()->editing_canceled should really have been a parameter of the
GtkCellEditable::editing-done signal, it should be a property on the cell
editable interface
https://bugzilla.gnome.org/show_bug.cgi?id=594962
Although, you can use:
gtk_widget_get_parent_window (gtk_bin_get_child (GTK_BIN (widget)))
there already are gtk_tree_view_get_bin_window() and
gtk_layout_get_bin_window() in GTK+ api.
https://bugzilla.gnome.org/show_bug.cgi?id=594960
When GtkMisc padding is set on an image, the optimization for only
recalculating size after a clear() breaks, since the requisition is
not (0, 0). We need a separate 'need_calc' flag.
Every call to _gtk_file_system_model_new*() gets the same list of column types,
so we now keep the list in a macro instead of having duplicated copies all around.
Signed-off-by: Federico Mena Quintero <federico@novell.com>
The old semantics was to return a GFile* owned by the file system model; the new
semantics is to hand out new references whenever possible.
Signed-off-by: Federico Mena Quintero <federico@novell.com>
There was some confusion between "index" as used for the model->files[] array,
and node->index as used for our 1-based row numbers. Now we use "index" only
for indices in the model->files[] array, and node->row for row numbers. Functions
and variables are renamed to clarify whether they refer to indexes or rows.
Signed-off-by: Federico Mena Quintero <federico@novell.com>
The non-standard "filechooser::mime-type" was a remnant of the recent-files code using
a hand-built GFileInfo; now we just query the file info ourselves.
Signed-off-by: Federico Mena Quintero <federico@novell.com>
g_array_new() doesn't reserve any size by default, so during the initial population
of the file array, we'll do more reallocs than strictly needed. We'll start with
a reasonable preallocated size, in this case the number of files which we can
get in a single chunk out of GIO.
Signed-off-by: Federico Mena Quintero <federico@novell.com>
There's no point in running a GtkFileSystemModel with invalid column types.
This way we can also avoid clearing the memory of the column_types array.
Signed-off-by: Federico Mena Quintero <federico@novell.com>
The previous function enumerated the whole directory and used a lot of
outdated API to decide how to show files.
The new code queries the filesystem model to decide about this.
The now unused old functions were removed.
Previously information about file sizes was not available for search
results and recent files, so the column was always hidden. As this
information is now available, we can stop the special handling and use
the same setting as in browse mode.
Use the faster _gtk_file_system_model_get_value() function instead of
gtk_tree_model_get() inside the sort functions. This gives a significant
speed-up when sorting large lists.
In a test case with 40.000 files, the sorting time went from ~5 seconds
to less than 0.5 seconds for my test case. There is 2 significant
problems with gtk_tree_model_get() that cause this:
1) The value is copied, which takes quite a bit of time for strings.
~25% of excessive time or ~1 second in my test
2) The tree model functions need to lookup the interface vfunc. And
gtk_tree_model_get() doesn't do that only once, but multiple times
(verifying column id, getting the actual value, ...)
~75% of excessive time or ~3 seconds in my test
Replace the list model code with the file system model and use all the
file system model API niceties we get from that.
Also adds the function _gtk_file_system_model_add_and_query_file() which
g_file_query_info()'s the file before adding it, so it gets added with
the right information.
Since the time taken by g_file_enumerate_children() depends a lot on the
attributes that are queried, we query the minimum attributes that need
to be queired to display the file chooser.
In particular, the attributes for loading the icon are ignored, as icons
are loaded on demand (see previous commit).
Because loading icons takes a noticable performance, this code loads the
pixbuf on demand and only loads icons for rows that are visible. There
is a few caveats to this:
- The pixbuf cell renderer must report the proer size even if the icon
is not yet loaded. This is achieved by setting a fixed size.
- On theme changes the cahced pixbufs and the cell renderer must be
updated to conform to the new theme.
Previously, there was a GtkTreeSortModel wrapped around the filesystem
model to make it sortable. As the new implementation implements the
GtkTreeSortable interface, we can use this instead.
A lot of code special cases accesses to the tree view for the different
browse modes, which was previously necessary, because the models were
different. Now that they are identical in the first columns, there is no
such need anymore, and the functions don't need to be special cased.
Previously custom functions were used to compute the data passed to the
cell renderers. Now that all this data is saved by the tree models with
compatible nodes, the usual default attribute-to-column mapping can be
used.
With this, caching of the values can happen in the tree model, which
avoids costly lookups of icons or computation of strings. Last but not
least it avoids spurious bugs that could happen when strings changed
without anyone noticing, like the mtime when a new day begins.
All tree models in browse mode now share the first 10 column types
containing all the necessary information to display the model on screen.
Therefor it is now easy to just operate on the tree model associated
with the file tree view and in most cases it isn't necessary anymore to
special case the browse modes.
The new model is mostly API-compatible with the old model (minimal
changes were required), but is a lot faster and has a lot of very
desirable features.
- the model does no longer support a tree, just a list of files in a
given directory
- the storage has been moved to a GArray as opposed to a tree
- no more dependency on GtkFileSystem
- columns are managed by the creator of the model, so any number of
nodes can be added as needed. This also makes the API more similar
to GtkListStore.
- Values are filled on demand using a function given when creating the
model.
- The function can decide to let the model cache returned values or
decide to be called again the next time the value is queried.
- implements GtkTreeSortable
- _gtk_file_system_model_get_value() was added to significantly speed
up value access, which is necessary when sorting large models.