Deprecate gtk_widget_push_composite_child, gtk_widget_pop_composite_child,
gtk_widget_set_composite_name, gtk_widget_get_composite_name.
This API is just bloat and was never useful, this patch deprecates
it and removes all internal calls to the composite child APIs
Change of plans to match the tests from the previous commit.
The state of the underlying dialog is never reflected by GtkFileChooserButton's API,
as the dialog is a transient thing. The file chooser button only updates its state from the dialog,
and reflects the dialog's state, when the dialog has been confirmed and dismissed by the user.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
The idea is that the button will only update its state of the selection and current folder
when changes to those are done either by the calling program (with the filechooser's API)
or when the user actually confirms and dismisses the underlying GtkFileChooserDialog.
If the user makes changes to the dialog but has not dismissed it yet, those changes
will not be reflected in the button (as one would expect).
This commit also makes sure the current-folder-changed and selection-changed signals
are emitted at the right times.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
We only emitted that signal when the selection changed through the underlying GtkFileChooserDialog.
To do this when the dialog is not active and the selection is changed by the calling program
(instead of by the user), we need to wait until the GtkFileChooserButton's UI has been updated
via an async callback from GIO. So, we keep track of whether an entry point into the
button's API caused a programmatic change in the selection.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
The currently-selected file *is* the selection even in SELECT_FOLDER mode. Do not confuse this
with the current folder.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
We assumed that we didn't have to update the combo box if the dialog got cancelled,
as it should simply retain its previous contents. But this assumption doesn't work
as the dialog is brought up with the 'Other...' item - we don't want the
combo box to keep showing 'Other...' if the dialog is cancelled.
The test from the previous commit now passes.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This is surprisingly tricky, since the (None) item *has* to be a visible item while
the combo box is *not* popped up, so that it can show its contents. But the item
has to be *not* visible when the combo box is popped up.
Also, update the whole button's selection, not just the underlying dialog's, when
the combo box changes its selection - based on a patch by Paul Davis in
https://bugzilla.gnome.org/show_bug.cgi?id=691040#c20
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
This way the internal labels will show the correct selection even if nothing
has been selected programmatically.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
We didn't change it when the file chooser button's dialog was inactive, and so
the actual file chooser button would not visually reflect the current selection.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
We do some gymnastics to pull the string out of the GtkButton or the GtkComboBox that is
being used in GtkFileChooserButton to show the current selection when the dialog
is inactive - namely, we look for the subwidget with the correct ATK role, and pull its
accessible name.
Currently the test fails; this is https://bugzilla.gnome.org/show_bug.cgi?id=691040#c18
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
In the case of checking for local_only, g_file_is_native() is not useful, since it
will return FALSE for something in a FUSE mount.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
The file chooser button only supports single-selection modes, so
switch the code to a simpler gtk_file_chooser_get_file() to avoid
dealing with GSLists of a single file.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
We only emit that signal when the user confirms the button's internal GtkFileChooserDialog,
or when he drags-and-drops stuff into the button.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
If the user didn't explicitly select anything, BUT the file chooser button has
a current_folder set, do the same as what GtkFileChooserDefault would do:
return the current folder as the selection.
This makes the tests in tests/filechooser pass!
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
If no file was originally selected in the GtkFileChooserButton, then its
internal dialog is brought up and cancelled, then we need to restore the
selection back to none. GtkFileChooser, though, doesn't like to
select a NULL file, so call _unselect_all() in that condition.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
The button's underlying file chooser dialog should not be used to store the file selection
while the dialog is unmapped. Instead, the file chooser button now stores the
selection itself.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
It used to fetch a possibly multiple selection from the GtkFileChooserDialog, and then
pick just the first item from the selection list. But since GtkFileChooserButton
operates in single-selection mode only, it can simply use gtk_file_chooser_get_file()
instead.
Also, the right way to reset the selection for GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
is with gtk_file_chooser_select_file(), not with _set_current_folder_file().
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
It's unfortunate that now we have two instances of the bookmarks manager
for each GtkFileChooserButton; one for the button itself and one for the
underlying GtkFileChooserDefault. We may refactor that in the future.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
The file chooser is asynchronous, so doing 'select_file (old_file)' and subsequently querying
the file for updating the labels is not going to work. However, the underlying file chooser
will emit 'selection-changed' as appropriate when it finishes restoring the old file. So,
we only need to update the labels when the file chooser dialog is confirmed, not cancelled.
In particular gtksettings.h and gtkstylecontext.h needed to be included
in lots of places now.
Also, I order the includes alphabetically in a bunch of headers.
The model_cancellables have an extra ref when we get them from gtk_tree_model_get().
So, we need to unref them always. On the other hand, the cancellables that get
passed as arguments to the callbacks in question are memory-managed by
GtkFileSystemModel.
Reported by Morten Welinder <mortenw@gnome.org>
https://bugzilla.gnome.org/show_bug.cgi?id=646460
Deprecate widget flag macros GTK_WIDGET_STATE, GTK_WIDGET_SAVED_STATE,
GTK_WIDGET_FLAGS, GTK_WIDGET_TOPLEVEL, GTK_WIDGET_NO_WINDOW and
GTK_WIDGET_COMPOSITE_CHILD.
Also deprecate the type macros GTK_WIDGET_TYPE, GTK_OBJECT_TYPE_NAME and
GTK_OBJECT_TYPE which have become redundant.
Instances of GTK_WIDGET_TOPLEVEL are replaced with gtk_widget_is_toplevel,
GTK_WIDGET_TYPE is replaced with G_OBJECT_TYPE, GTK_WIDGET_COMPOSITE_CHILD
is replaced with use of the "composite-child" property and uses of
GTK_WIDGET_NO_WINDOW are adjusted to use gtk_widget_get_has_window.
Uses of GTK_WIDGET_SAVED_STATE and GTK_WIDGET_FLAGS inside GtkWidget are
changed to direct flag usage.
Documentation is updated to refer to gtk_widget_set_has_window and
gtk_widget_get_has_window.
Gail and tests are updated as well.
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=69872
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/gtkfilesystem.[hc] (_gtk_file_info_consider_as_directory):
Privately export this method. It classifies directories and mountables
the same.
* gtk/gtkfilesystem.c (enclosing_volume_mount_cb): Silently drop
G_IO_ERROR_ALREADY_MOUNTED error for gvfs backends without visible
mounts.
* gtk/gtkfilesystemmodel.c:
* gtk/gtkfilechooserbutton.c:
* gtk/gtkfilechooserentry.c:
* gtk/gtkfilechooserdefault.c: Use the new function instead of
direct checks for G_FILE_TYPE_DIRECTORY throughout.
svn path=/trunk/; revision=21898
2008-12-10 Matthias Clasen <mclasen@redhat.com>
Bug 563991 – gtk_file_chooser_button_new_with_backend is deprecated
-- but what should be used instead?
* gtk/gtkfilechooserbutton.c: Enhanced deprecation annotation.
svn path=/trunk/; revision=21868
2008-08-12 Michael Natterer <mitch@imendio.com>
* gtk/*.c: consistently chain up using
GTK_FOO_CLASS(parent_class)->bar(instance) instead of
(*GTK_FOO_CLASS(parent_class))->bar(instance).
svn path=/trunk/; revision=21085
2008-08-04 Carlos Garnacho <carlos@imendio.com>
* gtk/gtk.symbols:
* gtk/gtkfilechooser.[ch]: Make GFile-oriented API public. Fixes
#545978.
* gtk/gtkfilechooserbutton.c:
* gtk/gtkfilechooserdefault.c:
* gtk/gtkfilechooserutils.c: Update to use public GFile API.
svn path=/trunk/; revision=20971
* gtk/gtkfilechooserbutton.c (update_label_and_image): Unset
the image when the label is set to "(None)". Reported by
Neil Roberts
svn path=/trunk/; revision=20833
2008-06-11 Michael Natterer <mitch@imendio.com>
* gtk/gtkfilechooserbutton.c: fix local prototype of
_gtk_file_chooser_label_for_file() (takes a GFile, not const gchar*).
svn path=/trunk/; revision=20352
2008-06-10 Carlos Garnacho <carlos@imendio.com>
Bug 520874 - Should use gio directly.
* gtk/gtkfilesystem.[ch]: Turn into a private object, which mostly
provides helper functions for asynchronous calls, folder abstraction
and uniform handling of volumes/drives/mounts.
* gtk/gtkfilesystemwin32.[ch]:
* gtk/gtkfilesystemunix.[ch]: Removed, these are no longer required.
* gtk/gtkfilechooser.c:
* gtk/gtkfilechooserbutton.c:
* gtk/gtkfilechooserdefault.c:
* gtk/gtkfilechooserentry.[ch]:
* gtk/gtkfilechooserprivate.h:
* gtk/gtkfilechooserutils.c:
* gtk/gtkfilesystemmodel.[ch]:
* gtk/gtkpathbar.[ch]: Use GIO internally. Adapt to GtkFileSystem API.
Do not load filesystem implementation modules.
* gtk/Makefile.am:
* gtk/gtk.symbols: the gtkfilesystem.h private header isn't installed
anymore, nor the unix/win32 implementations.
* README.in: Add blurb about these changes.
svn path=/trunk/; revision=20342
2008-03-03 Sven Neumann <sven@gimp.org>
* gtk/gtkfilechooserbutton.c (G_DEFINE_TYPE_WITH_CODE): fixed a
typo in the documentation of the GtkFileChooserButtons::file-set
signal (see bug #353196).
svn path=/trunk/; revision=19696
2007-11-26 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserbutton.c:
* gtk/gtktoolbar.c: Don't use guint8 for bitfields, since
some compilers choke on that. (#467722)
svn path=/trunk/; revision=19051
2007-09-11 Michael Natterer <mitch@imendio.com>
* gtk/gtkfilechooserbutton.c: remove useless member "has_title"
from the private struct and simply set the default title in
constructor() whenever we create a dialog or the supplied one has
no title. Also accept RESPONSE_ACCEPT *and* RESPONSE_OK as
affirmative responses and document that accordingly. Fixes bug
#436576. Fixed all compiler warnings in the file.
svn path=/trunk/; revision=18796
2007-03-12 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserbutton.c (change_icon_theme_get_info_cb):
Handle the row reference path being NULL. (#410565, Joe Markus
Clarke, patch by Chris Wilson)
svn path=/trunk/; revision=17487
2006-12-20 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_new_with_dialog):
Allow any GtkDialog that implements GtkFileChooser as
dialog. (#335473, Tommi Komulainen)
2006-09-30 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserbutton.c (update_combo_box): Protect
against base_path being NULL. (#358405, many reporters)
2006-09-22 Matthias Clasen <mclasen@redhat.com>
Make remote bookmarks work better (#354887)
* gtk/gtkfilechooserdefault.c (shortcuts_reload_icons):
(shortcuts_insert_path):
* gtk/gtkfilechooserbutton.c (change_icon_theme):
(model_add_bookmarks):
(model_update_current_folder):
(update_label_and_image):
If the bookmark points to a remote file, don't call get_info(),
since that may a) take a long time and b) pop up an auth dialog.
Instead, just use a folder icon and create a display name
from the uri.
* gtk/gtkfilechooserdefault.c (_gtk_file_chooser_label_for_uri):
New function to create a suitable display name for a remote
uri. This should really be done in GtkFileSystem.
2006-09-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserbutton.c: Don't add remote volumes and
bookmarks to the model in local-only mode, to avoid
authentication dialogs pop up for invisible bookmarks, and
to fix issues with separators not being hidden when
they should. (#354887, Dennis Cranston)
2006-09-10 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserbutton.c (model_add_special): Request
the display name too, otherwise "Desktop" does not appear
in the file chooser button.
2006-09-02 Kristian Rietveld <kris@imendio.com>
First part of file chooser fixes.
* gtk/gtkfilechooserbutton.c (model_add_special): also set the
handle in the model for the desktopdir case.
* gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder): free
volume in case we retrieved it but don't pass it on to insert_path,
(shortcuts_model_create): change the column type for the handles
to pointer instead of GObject so our handle ref counting is not
disturbed,
(show_and_select_paths_finished_loading): don't forget to unref
the dialog.
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_class_init),
(gtk_file_system_unix_init), (gtk_file_system_unix_dispose):
remove pending execute_callbacks_idle during dispose, also
execute all callbacks waiting to be run in the next idle,
(queue_*callback), (execute_callbacks_idle): refactor to maintain
a list of callbacks to call per file system instead of globally,
guard the file system during callback invocation,
(gtk_file_system_unix_get_folder): only add load folder idle if
none has been added yet.