+2004-02-29 Federico Mena Quintero <federico@ximian.com>
+
+ * gtk/gtkfilechooserdefault.c
+ (gtk_file_chooser_default_set_property): Handle
+ GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL.
+ (gtk_file_chooser_default_get_property): Likewise.
+ (struct _GtkFileChooserDefault): Added fields for preview_label,
+ use_preview_label, preview_display_name, preview_box. Removed
+ preview_frame.
+ (set_preview_widget): Reorder the widget in relation to the label.
+ (update_preview_widget_visibility): Create or destroy the preview
+ label.
+ (check_preview_change): Update impl->preview_display_name and the
+ label.
+ (find_good_size_from_style): Use the preview_box.
+ (gtk_file_chooser_default_finalize): Free
+ impl->preview_display_name.
+ (gtk_file_chooser_default_init): Initialize
+ impl->use_preview_label.
+
+ * gtk/gtkfilechooser.c (gtk_file_chooser_class_init): Add a
+ "use-preview-label" property.
+ (gtk_file_chooser_set_use_preview_label): New function. This sets
+ whether one wants the file chooser to display a stock label with
+ the previewed filename. Apps that do really fancy previews can
+ turn this off and draw the name themselves.
+ (gtk_file_chooser_get_use_preview_label): New function.
+ (gtk_file_chooser_get_preview_widget_active): Documentation fix.
+
+ * gtk/gtkfilechooserutils.h (GtkFileChooserProp): Add a
+ GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL value.
+
+ * gtk/gtkfilechooserutils.c
+ (_gtk_file_chooser_install_properties): Override the
+ "use-preview-label" property.
+
Sun Feb 29 04:43:29 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentry.c (gtk_entry_completion_key_press): Make Tab and
+2004-02-29 Federico Mena Quintero <federico@ximian.com>
+
+ * gtk/gtkfilechooserdefault.c
+ (gtk_file_chooser_default_set_property): Handle
+ GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL.
+ (gtk_file_chooser_default_get_property): Likewise.
+ (struct _GtkFileChooserDefault): Added fields for preview_label,
+ use_preview_label, preview_display_name, preview_box. Removed
+ preview_frame.
+ (set_preview_widget): Reorder the widget in relation to the label.
+ (update_preview_widget_visibility): Create or destroy the preview
+ label.
+ (check_preview_change): Update impl->preview_display_name and the
+ label.
+ (find_good_size_from_style): Use the preview_box.
+ (gtk_file_chooser_default_finalize): Free
+ impl->preview_display_name.
+ (gtk_file_chooser_default_init): Initialize
+ impl->use_preview_label.
+
+ * gtk/gtkfilechooser.c (gtk_file_chooser_class_init): Add a
+ "use-preview-label" property.
+ (gtk_file_chooser_set_use_preview_label): New function. This sets
+ whether one wants the file chooser to display a stock label with
+ the previewed filename. Apps that do really fancy previews can
+ turn this off and draw the name themselves.
+ (gtk_file_chooser_get_use_preview_label): New function.
+ (gtk_file_chooser_get_preview_widget_active): Documentation fix.
+
+ * gtk/gtkfilechooserutils.h (GtkFileChooserProp): Add a
+ GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL value.
+
+ * gtk/gtkfilechooserutils.c
+ (_gtk_file_chooser_install_properties): Override the
+ "use-preview-label" property.
+
Sun Feb 29 04:43:29 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentry.c (gtk_entry_completion_key_press): Make Tab and
+2004-02-29 Federico Mena Quintero <federico@ximian.com>
+
+ * gtk/gtkfilechooserdefault.c
+ (gtk_file_chooser_default_set_property): Handle
+ GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL.
+ (gtk_file_chooser_default_get_property): Likewise.
+ (struct _GtkFileChooserDefault): Added fields for preview_label,
+ use_preview_label, preview_display_name, preview_box. Removed
+ preview_frame.
+ (set_preview_widget): Reorder the widget in relation to the label.
+ (update_preview_widget_visibility): Create or destroy the preview
+ label.
+ (check_preview_change): Update impl->preview_display_name and the
+ label.
+ (find_good_size_from_style): Use the preview_box.
+ (gtk_file_chooser_default_finalize): Free
+ impl->preview_display_name.
+ (gtk_file_chooser_default_init): Initialize
+ impl->use_preview_label.
+
+ * gtk/gtkfilechooser.c (gtk_file_chooser_class_init): Add a
+ "use-preview-label" property.
+ (gtk_file_chooser_set_use_preview_label): New function. This sets
+ whether one wants the file chooser to display a stock label with
+ the previewed filename. Apps that do really fancy previews can
+ turn this off and draw the name themselves.
+ (gtk_file_chooser_get_use_preview_label): New function.
+ (gtk_file_chooser_get_preview_widget_active): Documentation fix.
+
+ * gtk/gtkfilechooserutils.h (GtkFileChooserProp): Add a
+ GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL value.
+
+ * gtk/gtkfilechooserutils.c
+ (_gtk_file_chooser_install_properties): Override the
+ "use-preview-label" property.
+
Sun Feb 29 04:43:29 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentry.c (gtk_entry_completion_key_press): Make Tab and
+2004-02-29 Federico Mena Quintero <federico@ximian.com>
+
+ * gtk/gtkfilechooserdefault.c
+ (gtk_file_chooser_default_set_property): Handle
+ GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL.
+ (gtk_file_chooser_default_get_property): Likewise.
+ (struct _GtkFileChooserDefault): Added fields for preview_label,
+ use_preview_label, preview_display_name, preview_box. Removed
+ preview_frame.
+ (set_preview_widget): Reorder the widget in relation to the label.
+ (update_preview_widget_visibility): Create or destroy the preview
+ label.
+ (check_preview_change): Update impl->preview_display_name and the
+ label.
+ (find_good_size_from_style): Use the preview_box.
+ (gtk_file_chooser_default_finalize): Free
+ impl->preview_display_name.
+ (gtk_file_chooser_default_init): Initialize
+ impl->use_preview_label.
+
+ * gtk/gtkfilechooser.c (gtk_file_chooser_class_init): Add a
+ "use-preview-label" property.
+ (gtk_file_chooser_set_use_preview_label): New function. This sets
+ whether one wants the file chooser to display a stock label with
+ the previewed filename. Apps that do really fancy previews can
+ turn this off and draw the name themselves.
+ (gtk_file_chooser_get_use_preview_label): New function.
+ (gtk_file_chooser_get_preview_widget_active): Documentation fix.
+
+ * gtk/gtkfilechooserutils.h (GtkFileChooserProp): Add a
+ GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL value.
+
+ * gtk/gtkfilechooserutils.c
+ (_gtk_file_chooser_install_properties): Override the
+ "use-preview-label" property.
+
Sun Feb 29 04:43:29 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentry.c (gtk_entry_completion_key_press): Make Tab and
+2004-02-29 Federico Mena Quintero <federico@ximian.com>
+
+ * gtk/gtkfilechooserdefault.c
+ (gtk_file_chooser_default_set_property): Handle
+ GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL.
+ (gtk_file_chooser_default_get_property): Likewise.
+ (struct _GtkFileChooserDefault): Added fields for preview_label,
+ use_preview_label, preview_display_name, preview_box. Removed
+ preview_frame.
+ (set_preview_widget): Reorder the widget in relation to the label.
+ (update_preview_widget_visibility): Create or destroy the preview
+ label.
+ (check_preview_change): Update impl->preview_display_name and the
+ label.
+ (find_good_size_from_style): Use the preview_box.
+ (gtk_file_chooser_default_finalize): Free
+ impl->preview_display_name.
+ (gtk_file_chooser_default_init): Initialize
+ impl->use_preview_label.
+
+ * gtk/gtkfilechooser.c (gtk_file_chooser_class_init): Add a
+ "use-preview-label" property.
+ (gtk_file_chooser_set_use_preview_label): New function. This sets
+ whether one wants the file chooser to display a stock label with
+ the previewed filename. Apps that do really fancy previews can
+ turn this off and draw the name themselves.
+ (gtk_file_chooser_get_use_preview_label): New function.
+ (gtk_file_chooser_get_preview_widget_active): Documentation fix.
+
+ * gtk/gtkfilechooserutils.h (GtkFileChooserProp): Add a
+ GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL value.
+
+ * gtk/gtkfilechooserutils.c
+ (_gtk_file_chooser_install_properties): Override the
+ "use-preview-label" property.
+
Sun Feb 29 04:43:29 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentry.c (gtk_entry_completion_key_press): Make Tab and
P_("Whether the application supplied widget for custom previews should be shown."),
TRUE,
G_PARAM_READWRITE));
+ g_object_interface_install_property (g_iface,
+ g_param_spec_boolean ("use-preview-label",
+ P_("Use Preview Label"),
+ P_("Whether to display a stock label with the name of the previewed file."),
+ TRUE,
+ G_PARAM_READWRITE));
g_object_interface_install_property (g_iface,
g_param_spec_object ("extra-widget",
P_("Extra widget"),
* gtk_file_chooser_get_preview_widget_active:
* @chooser: a #GtkFileChooser
*
- * Gets whether the preview widget set by
- * gtk_file_chooser_set_preview_widget_active() should be shown for the
- * current filename. See gtk_file_chooser_set_preview_widget_active().
+ * Gets whether the preview widget set by gtk_file_chooser_set_preview_widget()
+ * should be shown for the current filename. See
+ * gtk_file_chooser_set_preview_widget_active().
*
- * Return value: %TRUE if the preview widget is active for the
- * current filename.
+ * Return value: %TRUE if the preview widget is active for the current filename.
*
* Since: 2.4
**/
return active;
}
+/**
+ * gtk_file_chooser_set_use_preview_label:
+ * @chooser: a #GtkFileChooser
+ * @use_label: whether to display a stock label with the name of the previewed file
+ *
+ * Sets whether the file chooser should display a stock label with the name of
+ * the file that is being previewed; the default is %TRUE. Applications that
+ * want to draw the whole preview area themselves should set this to %FALSE and
+ * display the name themselves in their preview widget.
+ *
+ * See also: gtk_file_chooser_set_preview_widget()
+ *
+ * Since: 2.4
+ **/
+void
+gtk_file_chooser_set_use_preview_label (GtkFileChooser *chooser,
+ gboolean use_label)
+{
+ g_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));
+
+ g_object_set (chooser, "use-preview-label", use_label, NULL);
+}
+
+/**
+ * gtk_file_chooser_get_use_preview_label:
+ * @chooser: a #GtkFileChooser
+ *
+ * Gets whether a stock label should be drawn with the name of the previewed
+ * file. See gtk_file_chooser_set_use_preview_label().
+ *
+ * Return value: %TRUE if the file chooser is set to display a label with the
+ * name of the previewed file, %FALSE otherwise.
+ **/
+gboolean
+gtk_file_chooser_get_use_preview_label (GtkFileChooser *chooser)
+{
+ gboolean use_label;
+
+ g_return_val_if_fail (GTK_IS_FILE_CHOOSER (chooser), FALSE);
+
+ g_object_get (chooser, "use-preview-label", &use_label, NULL);
+
+ return use_label;
+}
+
/**
* gtk_file_chooser_get_preview_filename:
* @chooser: a #GtkFileChooser
void gtk_file_chooser_set_preview_widget_active (GtkFileChooser *chooser,
gboolean active);
gboolean gtk_file_chooser_get_preview_widget_active (GtkFileChooser *chooser);
+void gtk_file_chooser_set_use_preview_label (GtkFileChooser *chooser,
+ gboolean use_label);
+gboolean gtk_file_chooser_get_use_preview_label (GtkFileChooser *chooser);
char *gtk_file_chooser_get_preview_filename (GtkFileChooser *chooser);
char *gtk_file_chooser_get_preview_uri (GtkFileChooser *chooser);
GtkTreeModel *browse_shortcuts_model;
GtkFileSystemModel *browse_files_model;
GtkFileSystemModel *browse_directories_model;
-
+
GtkWidget *filter_combo;
+ GtkWidget *preview_box;
+ GtkWidget *preview_label;
GtkWidget *preview_widget;
GtkWidget *extra_widget;
GtkFilePath *current_volume_path;
GtkFilePath *current_folder;
GtkFilePath *preview_path;
-
- GtkWidget *preview_frame;
+ char *preview_display_name;
GtkTreeViewColumn *list_name_column;
GtkCellRenderer *list_name_renderer;
-
/* Flags */
guint local_only : 1;
guint preview_widget_active : 1;
+ guint use_preview_label : 1;
guint select_multiple : 1;
guint show_hidden : 1;
guint list_sort_ascending : 1;
{
impl->local_only = TRUE;
impl->preview_widget_active = TRUE;
+ impl->use_preview_label = TRUE;
impl->select_multiple = FALSE;
impl->show_hidden = FALSE;
if (impl->preview_path)
gtk_file_path_free (impl->preview_path);
+ g_free (impl->preview_display_name);
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
update_preview_widget_visibility (GtkFileChooserDefault *impl)
{
+ if (impl->use_preview_label)
+ {
+ if (!impl->preview_label)
+ {
+ impl->preview_label = gtk_label_new (impl->preview_display_name);
+ gtk_box_pack_start (GTK_BOX (impl->preview_box), impl->preview_label, FALSE, FALSE, 0);
+ gtk_box_reorder_child (GTK_BOX (impl->preview_box), impl->preview_label, 0);
+ gtk_widget_show (impl->preview_label);
+ }
+ }
+ else
+ {
+ if (impl->preview_label)
+ gtk_widget_destroy (impl->preview_label);
+ }
+
if (impl->preview_widget_active && impl->preview_widget)
- gtk_widget_show (impl->preview_frame);
+ gtk_widget_show (impl->preview_box);
else
- gtk_widget_hide (impl->preview_frame);
+ gtk_widget_hide (impl->preview_box);
g_signal_emit_by_name (impl, "default-size-changed");
}
return;
if (impl->preview_widget)
- gtk_container_remove (GTK_CONTAINER (impl->preview_frame),
+ gtk_container_remove (GTK_CONTAINER (impl->preview_box),
impl->preview_widget);
impl->preview_widget = preview_widget;
if (impl->preview_widget)
{
gtk_widget_show_all (impl->preview_widget);
- gtk_container_add (GTK_CONTAINER (impl->preview_frame),
- impl->preview_widget);
+ gtk_box_pack_start (GTK_BOX (impl->preview_box), impl->preview_widget, TRUE, TRUE, 0);
+ gtk_box_reorder_child (GTK_BOX (impl->preview_box),
+ impl->preview_widget,
+ (impl->use_preview_label && impl->preview_label) ? 1 : 0);
}
update_preview_widget_visibility (impl);
remove_bookmark_cb);
}
-
+
bookmarks = gtk_file_system_list_bookmarks (impl->file_system);
impl->num_bookmarks = shortcuts_append_paths (impl, bookmarks);
gtk_file_paths_free (bookmarks);
impl->browse_shortcuts_tree_view = gtk_tree_view_new ();
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), FALSE);
-
+
gtk_drag_dest_set (impl->browse_shortcuts_tree_view,
GTK_DEST_DEFAULT_ALL,
shortcuts_targets,
/* Preview */
- impl->preview_frame = gtk_frame_new (_("Preview"));
- gtk_box_pack_start (GTK_BOX (hbox), impl->preview_frame, FALSE, FALSE, 0);
- /* Don't show preview frame initially */
+ impl->preview_box = gtk_vbox_new (FALSE, 12);
+ gtk_box_pack_start (GTK_BOX (hbox), impl->preview_box, FALSE, FALSE, 0);
+ /* Don't show preview box initially */
/* Filename entry and filter combo */
hbox = gtk_hbox_new (FALSE, 0);
impl);
gtk_widget_show_all (alignment);
- return vbox;
+ return vbox;
}
/* Creates the main hpaned with the widgets shared by Open and Save mode */
impl->bookmarks_changed_id = 0;
g_object_unref (impl->file_system);
}
-
+
impl->file_system = NULL;
if (backend)
impl->file_system = _gtk_file_system_create (backend);
-
+
if (!impl->file_system)
{
#if defined (G_OS_UNIX)
#error "No default filesystem implementation on the platform"
#endif
}
-
+
if (impl->file_system)
{
impl->volumes_changed_id = g_signal_connect (impl->file_system, "volumes-changed",
}
/* This function is basically a do_all function.
- *
+ *
* It sets the visibility on all the widgets based on the current state, and
* moves the custom_widget if needed.
*/
impl->preview_widget_active = g_value_get_boolean (value);
update_preview_widget_visibility (impl);
break;
+ case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL:
+ impl->use_preview_label = g_value_get_boolean (value);
+ update_preview_widget_visibility (impl);
+ break;
case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET:
set_extra_widget (impl, g_value_get_object (value));
update_appearance (impl);
case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE:
g_value_set_boolean (value, impl->preview_widget_active);
break;
+ case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL:
+ g_value_set_boolean (value, impl->use_preview_label);
+ break;
case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET:
g_value_set_object (value, impl->extra_widget);
break;
GtkFilePath *base_path, *parent_path;
base_path = NULL;
-
+
volume = gtk_file_system_get_volume_for_path (impl->file_system, path);
-
+
if (volume)
base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
-
+
if (base_path == NULL)
{
base_path = gtk_file_path_copy (path);
out:
gtk_file_path_free (base_path);
- if (volume)
+ if (volume)
gtk_file_system_volume_free (impl->file_system, volume);
}
gtk_widget_size_request (widget, &req);
if (impl->preview_widget_active && impl->preview_widget)
- gtk_widget_size_request (impl->preview_frame, &preview_req);
+ gtk_widget_size_request (impl->preview_box, &preview_req);
else
preview_req.width = 0;
check_preview_change (GtkFileChooserDefault *impl)
{
const GtkFilePath *new_path = NULL;
+ const GtkFileInfo *new_info = NULL;
/* FIXME #132255: Fixing preview for multiple selection involves getting the
* full selection and diffing to find out what the most recently selected file
&child_iter, &iter);
new_path = _gtk_file_system_model_get_path (impl->browse_files_model, &child_iter);
+ new_info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter);
}
}
gtk_file_path_compare (new_path, impl->preview_path) == 0))
{
if (impl->preview_path)
- gtk_file_path_free (impl->preview_path);
+ {
+ gtk_file_path_free (impl->preview_path);
+ g_free (impl->preview_display_name);
+ }
if (new_path)
- impl->preview_path = gtk_file_path_copy (new_path);
+ {
+ impl->preview_path = gtk_file_path_copy (new_path);
+ impl->preview_display_name = g_strdup (gtk_file_info_get_display_name (new_info));
+ }
else
- impl->preview_path = NULL;
+ {
+ impl->preview_path = NULL;
+ impl->preview_display_name = NULL;
+ }
+
+ if (impl->use_preview_label && impl->preview_label)
+ gtk_label_set_text (GTK_LABEL (impl->preview_label), impl->preview_display_name);
g_signal_emit_by_name (impl, "update-preview");
}
g_object_class_override_property (klass,
GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE,
"preview-widget-active");
+ g_object_class_override_property (klass,
+ GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL,
+ "use-preview-label");
g_object_class_override_property (klass,
GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE,
"select-multiple");
GTK_FILE_CHOOSER_PROP_LOCAL_ONLY,
GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET,
GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE,
+ GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL,
GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET,
GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE,
GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN,