gtk/tests/testfilechooserbutton.c

366 lines
12 KiB
C
Raw Normal View History

Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 2 -*- */
/* GTK+: gtkfilechooserbutton.c
*
* Copyright (c) 2004 James M. Cape <jcape@ignore-your.tv>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <gtk/gtk.h>
#ifdef G_OS_WIN32
#include <direct.h> /* for _getcwd() */
#endif
#include "prop-editor.h"
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
static gchar *backend = "gtk+";
static gboolean rtl = FALSE;
static GOptionEntry entries[] = {
{ "backend", 'b', 0, G_OPTION_ARG_STRING, &backend, "The filesystem backend to use.", "gtk+" },
{ "right-to-left", 'r', 0, G_OPTION_ARG_NONE, &rtl, "Force right-to-left layout.", NULL },
{ NULL }
};
static gchar *gtk_src_dir = NULL;
static void
win_style_set_cb (GtkWidget *win)
{
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (win)->vbox), 12);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (win)->vbox), 24);
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (win)->action_area), 0);
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (win)->action_area), 6);
}
static gboolean
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
delete_event_cb (GtkWidget *editor,
gint response,
gpointer user_data)
{
gtk_widget_hide (editor);
return TRUE;
}
static void
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
properties_button_clicked_cb (GtkWidget *button,
GObject *entry)
{
GtkWidget *editor;
editor = g_object_get_data (entry, "properties-dialog");
if (editor == NULL)
{
editor = create_prop_editor (G_OBJECT (entry), G_TYPE_INVALID);
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
gtk_container_set_border_width (GTK_CONTAINER (editor), 12);
gtk_window_set_transient_for (GTK_WINDOW (editor),
GTK_WINDOW (gtk_widget_get_toplevel (button)));
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
g_signal_connect (editor, "delete-event", G_CALLBACK (delete_event_cb), NULL);
g_object_set_data (entry, "properties-dialog", editor);
}
gtk_window_present (GTK_WINDOW (editor));
}
static void
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
print_selected_path_clicked_cb (GtkWidget *button,
gpointer user_data)
{
gchar *folder, *filename;
folder = gtk_file_chooser_get_current_folder (user_data);
filename = gtk_file_chooser_get_filename (user_data);
g_message ("Currently Selected:\n\tFolder: `%s'\n\tFilename: `%s'\nDone.\n",
folder, filename);
g_free (folder);
g_free (filename);
}
static void
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
add_pwds_parent_as_shortcut_clicked_cb (GtkWidget *button,
gpointer user_data)
{
GError *err = NULL;
if (!gtk_file_chooser_add_shortcut_folder (user_data, gtk_src_dir, &err))
{
g_message ("Couldn't add `%s' as shortcut folder: %s", gtk_src_dir,
err->message);
g_error_free (err);
}
else
{
g_message ("Added `%s' as shortcut folder.", gtk_src_dir);
}
}
static void
del_pwds_parent_as_shortcut_clicked_cb (GtkWidget *button,
gpointer user_data)
{
GError *err = NULL;
if (!gtk_file_chooser_remove_shortcut_folder (user_data, gtk_src_dir, &err))
{
g_message ("Couldn't remove `%s' as shortcut folder: %s", gtk_src_dir,
err->message);
g_error_free (err);
}
else
{
g_message ("Removed `%s' as shortcut folder.", gtk_src_dir);
}
}
static void
tests_button_clicked_cb (GtkButton *real_button,
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
gpointer user_data)
{
GtkWidget *tests;
tests = g_object_get_data (user_data, "tests-dialog");
if (tests == NULL)
{
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
GtkWidget *box, *button;
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
tests = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (tests),
"Tests - TestFileChooserButton");
gtk_container_set_border_width (GTK_CONTAINER (tests), 12);
gtk_window_set_transient_for (GTK_WINDOW (tests),
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
GTK_WINDOW (gtk_widget_get_toplevel (user_data)));
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
box = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (tests), box);
gtk_widget_show (box);
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
button = gtk_button_new_with_label ("Print Selected Path");
g_signal_connect (button, "clicked",
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
G_CALLBACK (print_selected_path_clicked_cb), user_data);
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = gtk_button_new_with_label ("Add $PWD's Parent as Shortcut");
g_signal_connect (button, "clicked",
G_CALLBACK (add_pwds_parent_as_shortcut_clicked_cb), user_data);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = gtk_button_new_with_label ("Remove $PWD's Parent as Shortcut");
g_signal_connect (button, "clicked",
G_CALLBACK (del_pwds_parent_as_shortcut_clicked_cb), user_data);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
gtk_widget_show (button);
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
g_signal_connect (tests, "delete-event", G_CALLBACK (delete_event_cb), NULL);
g_object_set_data (user_data, "tests-dialog", tests);
}
gtk_window_present (GTK_WINDOW (tests));
}
static void
chooser_current_folder_changed_cb (GtkFileChooser *chooser,
gpointer user_data)
{
gchar *folder, *filename;
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
folder = gtk_file_chooser_get_current_folder_uri (chooser);
filename = gtk_file_chooser_get_uri (chooser);
Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, 2004-10-25 James M. Cape <jcape@ignore-your.tv> Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, #154390, #156272. * docs/reference/gtk/gtk-docs.sgml: Moved GtkFileChooserButton below GtkFileChooser. * docs/reference/gtk/gtk-sections.txt: Added gtk_file_chooser_button_get_width_chars(), gtk_file_chooser_button_set_width_chars(), gtk_label_set_width_chars(), gtk_label_get_width_chars(). * docs/reference/gtk/gtk.types: Added gtk_cell_renderer_combo_get_type, gtk_cell_view_get_type, gtk_text_iter_get_type. * docs/reference/gtk/tmpl/gtkaboutdialog.sgml: Add "logo-icon-name" property. * docs/reference/gtk/tmpl/gtkcellview.sgml: Updates for properties (b/c of get_type() inclusion above). * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * docs/reference/gtk/tmpl/gtklabel.sgml: Add "width-chars" property, getters/setters. * docs/reference/gtk/tmpl/gtkcellrenderercombo.sgml: Added. * gtk/gtkentrycompletion.c: (_gtk_entry_completion_popdown): Don't show if the entry isn't mapped. * gtk/gtkfilechooserbutton.[c,h]: (*): About 45% rewritten, adds "width-chars" property, icons, working save modes, volume/Home/Desktop friendly-naming support. * gtk/gtklabel.[c,h]: (gtk_label_class_init), (gtk_label_init), (gtk_label_get_property), (gtk_label_set_property), (gtk_label_get_width_chars), (gtk_label_set_width_chars), (gtk_label_size_request): Add "width-chars" property. * tests/testfilechooserbutton.c: Update, use 4 different buttons for the different ACTIONs. * gtk/.cvsignore: Ignore gtk-update-icon-cache. * tests/.cvsignore: Ignore testimage.
2004-10-26 04:29:56 +00:00
g_message ("%s::current-folder-changed\n\tFolder: `%s'\n\tFilename: `%s'\nDone.\n",
G_OBJECT_TYPE_NAME (chooser), folder, filename);
g_free (folder);
g_free (filename);
}
static void
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
chooser_selection_changed_cb (GtkFileChooser *chooser,
gpointer user_data)
{
Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, 2004-10-25 James M. Cape <jcape@ignore-your.tv> Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, #154390, #156272. * docs/reference/gtk/gtk-docs.sgml: Moved GtkFileChooserButton below GtkFileChooser. * docs/reference/gtk/gtk-sections.txt: Added gtk_file_chooser_button_get_width_chars(), gtk_file_chooser_button_set_width_chars(), gtk_label_set_width_chars(), gtk_label_get_width_chars(). * docs/reference/gtk/gtk.types: Added gtk_cell_renderer_combo_get_type, gtk_cell_view_get_type, gtk_text_iter_get_type. * docs/reference/gtk/tmpl/gtkaboutdialog.sgml: Add "logo-icon-name" property. * docs/reference/gtk/tmpl/gtkcellview.sgml: Updates for properties (b/c of get_type() inclusion above). * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * docs/reference/gtk/tmpl/gtklabel.sgml: Add "width-chars" property, getters/setters. * docs/reference/gtk/tmpl/gtkcellrenderercombo.sgml: Added. * gtk/gtkentrycompletion.c: (_gtk_entry_completion_popdown): Don't show if the entry isn't mapped. * gtk/gtkfilechooserbutton.[c,h]: (*): About 45% rewritten, adds "width-chars" property, icons, working save modes, volume/Home/Desktop friendly-naming support. * gtk/gtklabel.[c,h]: (gtk_label_class_init), (gtk_label_init), (gtk_label_get_property), (gtk_label_set_property), (gtk_label_get_width_chars), (gtk_label_set_width_chars), (gtk_label_size_request): Add "width-chars" property. * tests/testfilechooserbutton.c: Update, use 4 different buttons for the different ACTIONs. * gtk/.cvsignore: Ignore gtk-update-icon-cache. * tests/.cvsignore: Ignore testimage.
2004-10-26 04:29:56 +00:00
gchar *filename;
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
filename = gtk_file_chooser_get_uri (chooser);
Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, 2004-10-25 James M. Cape <jcape@ignore-your.tv> Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, #154390, #156272. * docs/reference/gtk/gtk-docs.sgml: Moved GtkFileChooserButton below GtkFileChooser. * docs/reference/gtk/gtk-sections.txt: Added gtk_file_chooser_button_get_width_chars(), gtk_file_chooser_button_set_width_chars(), gtk_label_set_width_chars(), gtk_label_get_width_chars(). * docs/reference/gtk/gtk.types: Added gtk_cell_renderer_combo_get_type, gtk_cell_view_get_type, gtk_text_iter_get_type. * docs/reference/gtk/tmpl/gtkaboutdialog.sgml: Add "logo-icon-name" property. * docs/reference/gtk/tmpl/gtkcellview.sgml: Updates for properties (b/c of get_type() inclusion above). * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * docs/reference/gtk/tmpl/gtklabel.sgml: Add "width-chars" property, getters/setters. * docs/reference/gtk/tmpl/gtkcellrenderercombo.sgml: Added. * gtk/gtkentrycompletion.c: (_gtk_entry_completion_popdown): Don't show if the entry isn't mapped. * gtk/gtkfilechooserbutton.[c,h]: (*): About 45% rewritten, adds "width-chars" property, icons, working save modes, volume/Home/Desktop friendly-naming support. * gtk/gtklabel.[c,h]: (gtk_label_class_init), (gtk_label_init), (gtk_label_get_property), (gtk_label_set_property), (gtk_label_get_width_chars), (gtk_label_set_width_chars), (gtk_label_size_request): Add "width-chars" property. * tests/testfilechooserbutton.c: Update, use 4 different buttons for the different ACTIONs. * gtk/.cvsignore: Ignore gtk-update-icon-cache. * tests/.cvsignore: Ignore testimage.
2004-10-26 04:29:56 +00:00
g_message ("%s::selection-changed\n\tSelection:`%s'\nDone.\n",
G_OBJECT_TYPE_NAME (chooser), filename);
g_free (filename);
}
static void
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
chooser_file_activated_cb (GtkFileChooser *chooser,
gpointer user_data)
{
gchar *folder, *filename;
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
folder = gtk_file_chooser_get_current_folder_uri (chooser);
filename = gtk_file_chooser_get_uri (chooser);
Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, 2004-10-25 James M. Cape <jcape@ignore-your.tv> Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, #154390, #156272. * docs/reference/gtk/gtk-docs.sgml: Moved GtkFileChooserButton below GtkFileChooser. * docs/reference/gtk/gtk-sections.txt: Added gtk_file_chooser_button_get_width_chars(), gtk_file_chooser_button_set_width_chars(), gtk_label_set_width_chars(), gtk_label_get_width_chars(). * docs/reference/gtk/gtk.types: Added gtk_cell_renderer_combo_get_type, gtk_cell_view_get_type, gtk_text_iter_get_type. * docs/reference/gtk/tmpl/gtkaboutdialog.sgml: Add "logo-icon-name" property. * docs/reference/gtk/tmpl/gtkcellview.sgml: Updates for properties (b/c of get_type() inclusion above). * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * docs/reference/gtk/tmpl/gtklabel.sgml: Add "width-chars" property, getters/setters. * docs/reference/gtk/tmpl/gtkcellrenderercombo.sgml: Added. * gtk/gtkentrycompletion.c: (_gtk_entry_completion_popdown): Don't show if the entry isn't mapped. * gtk/gtkfilechooserbutton.[c,h]: (*): About 45% rewritten, adds "width-chars" property, icons, working save modes, volume/Home/Desktop friendly-naming support. * gtk/gtklabel.[c,h]: (gtk_label_class_init), (gtk_label_init), (gtk_label_get_property), (gtk_label_set_property), (gtk_label_get_width_chars), (gtk_label_set_width_chars), (gtk_label_size_request): Add "width-chars" property. * tests/testfilechooserbutton.c: Update, use 4 different buttons for the different ACTIONs. * gtk/.cvsignore: Ignore gtk-update-icon-cache. * tests/.cvsignore: Ignore testimage.
2004-10-26 04:29:56 +00:00
g_message ("%s::file-activated\n\tFolder: `%s'\n\tFilename: `%s'\nDone.\n",
G_OBJECT_TYPE_NAME (chooser), folder, filename);
g_free (folder);
g_free (filename);
}
static void
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
chooser_update_preview_cb (GtkFileChooser *chooser,
gpointer user_data)
{
gchar *filename;
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
filename = gtk_file_chooser_get_preview_uri (chooser);
if (filename != NULL)
{
g_message ("%s::update-preview\n\tPreview Filename: `%s'\nDone.\n",
G_OBJECT_TYPE_NAME (chooser), filename);
g_free (filename);
}
}
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
int
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
main (int argc,
char *argv[])
{
Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, 2004-10-25 James M. Cape <jcape@ignore-your.tv> Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, #154390, #156272. * docs/reference/gtk/gtk-docs.sgml: Moved GtkFileChooserButton below GtkFileChooser. * docs/reference/gtk/gtk-sections.txt: Added gtk_file_chooser_button_get_width_chars(), gtk_file_chooser_button_set_width_chars(), gtk_label_set_width_chars(), gtk_label_get_width_chars(). * docs/reference/gtk/gtk.types: Added gtk_cell_renderer_combo_get_type, gtk_cell_view_get_type, gtk_text_iter_get_type. * docs/reference/gtk/tmpl/gtkaboutdialog.sgml: Add "logo-icon-name" property. * docs/reference/gtk/tmpl/gtkcellview.sgml: Updates for properties (b/c of get_type() inclusion above). * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * docs/reference/gtk/tmpl/gtklabel.sgml: Add "width-chars" property, getters/setters. * docs/reference/gtk/tmpl/gtkcellrenderercombo.sgml: Added. * gtk/gtkentrycompletion.c: (_gtk_entry_completion_popdown): Don't show if the entry isn't mapped. * gtk/gtkfilechooserbutton.[c,h]: (*): About 45% rewritten, adds "width-chars" property, icons, working save modes, volume/Home/Desktop friendly-naming support. * gtk/gtklabel.[c,h]: (gtk_label_class_init), (gtk_label_init), (gtk_label_get_property), (gtk_label_set_property), (gtk_label_get_width_chars), (gtk_label_set_width_chars), (gtk_label_size_request): Add "width-chars" property. * tests/testfilechooserbutton.c: Update, use 4 different buttons for the different ACTIONs. * gtk/.cvsignore: Ignore gtk-update-icon-cache. * tests/.cvsignore: Ignore testimage.
2004-10-26 04:29:56 +00:00
GtkWidget *win, *vbox, *frame, *alignment, *group_box;
GtkWidget *hbox, *label, *chooser, *button;
GtkSizeGroup *label_group;
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
GOptionContext *context;
gchar cwd[2048];
context = g_option_context_new ("- test GtkFileChooserButton widget");
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_add_group (context, gtk_get_option_group (TRUE));
g_option_context_parse (context, &argc, &argv, NULL);
g_option_context_free (context);
gtk_init (&argc, &argv);
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
/* to test rtl layout, use "--right-to-left" */
if (rtl)
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
getcwd (cwd, sizeof (cwd));
gtk_src_dir = g_path_get_dirname (cwd);
win = gtk_dialog_new_with_buttons ("TestFileChooserButton", NULL, GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_QUIT, GTK_RESPONSE_CLOSE, NULL);
g_signal_connect (win, "style-set", G_CALLBACK (win_style_set_cb), NULL);
g_signal_connect (win, "response", G_CALLBACK (gtk_main_quit), NULL);
vbox = gtk_vbox_new (FALSE, 18);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (win)->vbox), vbox);
frame = gtk_frame_new ("<b>GtkFileChooserButton</b>");
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
gtk_label_set_use_markup (GTK_LABEL (gtk_frame_get_label_widget (GTK_FRAME (frame))), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
gtk_container_add (GTK_CONTAINER (frame), alignment);
label_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
group_box = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (alignment), group_box);
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
/* OPEN */
hbox = gtk_hbox_new (FALSE, 12);
Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, 2004-10-25 James M. Cape <jcape@ignore-your.tv> Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, #154390, #156272. * docs/reference/gtk/gtk-docs.sgml: Moved GtkFileChooserButton below GtkFileChooser. * docs/reference/gtk/gtk-sections.txt: Added gtk_file_chooser_button_get_width_chars(), gtk_file_chooser_button_set_width_chars(), gtk_label_set_width_chars(), gtk_label_get_width_chars(). * docs/reference/gtk/gtk.types: Added gtk_cell_renderer_combo_get_type, gtk_cell_view_get_type, gtk_text_iter_get_type. * docs/reference/gtk/tmpl/gtkaboutdialog.sgml: Add "logo-icon-name" property. * docs/reference/gtk/tmpl/gtkcellview.sgml: Updates for properties (b/c of get_type() inclusion above). * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * docs/reference/gtk/tmpl/gtklabel.sgml: Add "width-chars" property, getters/setters. * docs/reference/gtk/tmpl/gtkcellrenderercombo.sgml: Added. * gtk/gtkentrycompletion.c: (_gtk_entry_completion_popdown): Don't show if the entry isn't mapped. * gtk/gtkfilechooserbutton.[c,h]: (*): About 45% rewritten, adds "width-chars" property, icons, working save modes, volume/Home/Desktop friendly-naming support. * gtk/gtklabel.[c,h]: (gtk_label_class_init), (gtk_label_init), (gtk_label_get_property), (gtk_label_set_property), (gtk_label_get_width_chars), (gtk_label_set_width_chars), (gtk_label_size_request): Add "width-chars" property. * tests/testfilechooserbutton.c: Update, use 4 different buttons for the different ACTIONs. * gtk/.cvsignore: Ignore gtk-update-icon-cache. * tests/.cvsignore: Ignore testimage.
2004-10-26 04:29:56 +00:00
gtk_box_pack_start (GTK_BOX (group_box), hbox, FALSE, FALSE, 0);
2004-09-19 05:40:00 +00:00
label = gtk_label_new_with_mnemonic ("_Open:");
gtk_size_group_add_widget (GTK_SIZE_GROUP (label_group), label);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
chooser = gtk_file_chooser_button_new_with_backend ("Select A File - testfilechooserbutton",
GTK_FILE_CHOOSER_ACTION_OPEN,
backend);
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (chooser), gtk_src_dir, NULL);
gtk_file_chooser_remove_shortcut_folder (GTK_FILE_CHOOSER (chooser), gtk_src_dir, NULL);
Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, 2004-10-25 James M. Cape <jcape@ignore-your.tv> Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, #154390, #156272. * docs/reference/gtk/gtk-docs.sgml: Moved GtkFileChooserButton below GtkFileChooser. * docs/reference/gtk/gtk-sections.txt: Added gtk_file_chooser_button_get_width_chars(), gtk_file_chooser_button_set_width_chars(), gtk_label_set_width_chars(), gtk_label_get_width_chars(). * docs/reference/gtk/gtk.types: Added gtk_cell_renderer_combo_get_type, gtk_cell_view_get_type, gtk_text_iter_get_type. * docs/reference/gtk/tmpl/gtkaboutdialog.sgml: Add "logo-icon-name" property. * docs/reference/gtk/tmpl/gtkcellview.sgml: Updates for properties (b/c of get_type() inclusion above). * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * docs/reference/gtk/tmpl/gtklabel.sgml: Add "width-chars" property, getters/setters. * docs/reference/gtk/tmpl/gtkcellrenderercombo.sgml: Added. * gtk/gtkentrycompletion.c: (_gtk_entry_completion_popdown): Don't show if the entry isn't mapped. * gtk/gtkfilechooserbutton.[c,h]: (*): About 45% rewritten, adds "width-chars" property, icons, working save modes, volume/Home/Desktop friendly-naming support. * gtk/gtklabel.[c,h]: (gtk_label_class_init), (gtk_label_init), (gtk_label_get_property), (gtk_label_set_property), (gtk_label_get_width_chars), (gtk_label_set_width_chars), (gtk_label_size_request): Add "width-chars" property. * tests/testfilechooserbutton.c: Update, use 4 different buttons for the different ACTIONs. * gtk/.cvsignore: Ignore gtk-update-icon-cache. * tests/.cvsignore: Ignore testimage.
2004-10-26 04:29:56 +00:00
gtk_label_set_mnemonic_widget (GTK_LABEL (label), chooser);
g_signal_connect (chooser, "current-folder-changed",
G_CALLBACK (chooser_current_folder_changed_cb), NULL);
g_signal_connect (chooser, "selection-changed", G_CALLBACK (chooser_selection_changed_cb), NULL);
g_signal_connect (chooser, "file-activated", G_CALLBACK (chooser_file_activated_cb), NULL);
g_signal_connect (chooser, "update-preview", G_CALLBACK (chooser_update_preview_cb), NULL);
gtk_container_add (GTK_CONTAINER (hbox), chooser);
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
button = gtk_button_new_from_stock (GTK_STOCK_PROPERTIES);
Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, 2004-10-25 James M. Cape <jcape@ignore-your.tv> Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, #154390, #156272. * docs/reference/gtk/gtk-docs.sgml: Moved GtkFileChooserButton below GtkFileChooser. * docs/reference/gtk/gtk-sections.txt: Added gtk_file_chooser_button_get_width_chars(), gtk_file_chooser_button_set_width_chars(), gtk_label_set_width_chars(), gtk_label_get_width_chars(). * docs/reference/gtk/gtk.types: Added gtk_cell_renderer_combo_get_type, gtk_cell_view_get_type, gtk_text_iter_get_type. * docs/reference/gtk/tmpl/gtkaboutdialog.sgml: Add "logo-icon-name" property. * docs/reference/gtk/tmpl/gtkcellview.sgml: Updates for properties (b/c of get_type() inclusion above). * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * docs/reference/gtk/tmpl/gtklabel.sgml: Add "width-chars" property, getters/setters. * docs/reference/gtk/tmpl/gtkcellrenderercombo.sgml: Added. * gtk/gtkentrycompletion.c: (_gtk_entry_completion_popdown): Don't show if the entry isn't mapped. * gtk/gtkfilechooserbutton.[c,h]: (*): About 45% rewritten, adds "width-chars" property, icons, working save modes, volume/Home/Desktop friendly-naming support. * gtk/gtklabel.[c,h]: (gtk_label_class_init), (gtk_label_init), (gtk_label_get_property), (gtk_label_set_property), (gtk_label_get_width_chars), (gtk_label_set_width_chars), (gtk_label_size_request): Add "width-chars" property. * tests/testfilechooserbutton.c: Update, use 4 different buttons for the different ACTIONs. * gtk/.cvsignore: Ignore gtk-update-icon-cache. * tests/.cvsignore: Ignore testimage.
2004-10-26 04:29:56 +00:00
g_signal_connect (button, "clicked", G_CALLBACK (properties_button_clicked_cb), chooser);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
button = gtk_button_new_with_label ("Tests");
g_signal_connect (button, "clicked", G_CALLBACK (tests_button_clicked_cb), chooser);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
/* SELECT_FOLDER */
Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, 2004-10-25 James M. Cape <jcape@ignore-your.tv> Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, #154390, #156272. * docs/reference/gtk/gtk-docs.sgml: Moved GtkFileChooserButton below GtkFileChooser. * docs/reference/gtk/gtk-sections.txt: Added gtk_file_chooser_button_get_width_chars(), gtk_file_chooser_button_set_width_chars(), gtk_label_set_width_chars(), gtk_label_get_width_chars(). * docs/reference/gtk/gtk.types: Added gtk_cell_renderer_combo_get_type, gtk_cell_view_get_type, gtk_text_iter_get_type. * docs/reference/gtk/tmpl/gtkaboutdialog.sgml: Add "logo-icon-name" property. * docs/reference/gtk/tmpl/gtkcellview.sgml: Updates for properties (b/c of get_type() inclusion above). * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * docs/reference/gtk/tmpl/gtklabel.sgml: Add "width-chars" property, getters/setters. * docs/reference/gtk/tmpl/gtkcellrenderercombo.sgml: Added. * gtk/gtkentrycompletion.c: (_gtk_entry_completion_popdown): Don't show if the entry isn't mapped. * gtk/gtkfilechooserbutton.[c,h]: (*): About 45% rewritten, adds "width-chars" property, icons, working save modes, volume/Home/Desktop friendly-naming support. * gtk/gtklabel.[c,h]: (gtk_label_class_init), (gtk_label_init), (gtk_label_get_property), (gtk_label_set_property), (gtk_label_get_width_chars), (gtk_label_set_width_chars), (gtk_label_size_request): Add "width-chars" property. * tests/testfilechooserbutton.c: Update, use 4 different buttons for the different ACTIONs. * gtk/.cvsignore: Ignore gtk-update-icon-cache. * tests/.cvsignore: Ignore testimage.
2004-10-26 04:29:56 +00:00
hbox = gtk_hbox_new (FALSE, 12);
gtk_box_pack_start (GTK_BOX (group_box), hbox, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic ("Select _Folder:");
gtk_size_group_add_widget (GTK_SIZE_GROUP (label_group), label);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
Use a GtkComboBox in SELECT_FOLDER mode (#157726). 2004-12-15 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_file_chooser_iface_init) (gtk_file_chooser_button_add_shortcut_folder) (gtk_file_chooser_button_remove_shortcut_folder) (gtk_file_chooser_button_constructor) (gtk_file_chooser_button_set_property) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_finalize) (get_icon_theme) (get_display_name_for_path) (model_get_type_position) (model_free_row_data) (model_add_special) (model_add_other) (model_add_volumes) (model_add_bookmarks) (model_update_current_folder) (model_remove_rows) (filter_model_visible_func) (combo_box_row_separator_func) (name_cell_data_func) (update_combo_box) (fs_volumes_changed_cb) (fs_bookmarks_changed_cb) (combo_box_changed_cb) (change_icon_size): Use a GtkComboBox in SELECT_FOLDER mode (#157726). * gtk/gtkfilechooserbutton.c: * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_new) (gtk_file_chooser_button_new_with_backend): Add @action to constructors to match other GtkFileChooser impls. API CHANGE. * docs/tools/widgets.c (create_file_button): * tests/testfilechooserbutton.c (main): Update callers. * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: Reflect API change. * tests/testfilechooserbutton.c: Add LGPL license. (main): Added GOption parser for --backend and --right-to-left cmd line args. (add_pwds_parent_as_shortcut_clicked_cb) (del_pwds_parent_as_shortcut_clicked_cb) (tests_button_clicked_cb): Add shortcut_folders test. (chooser_current_folder_changed_cb) (chooser_selection_changed_cb) (chooser_file_activated_cb) (chooser_update_preview_cb): Print URIS, not filenames.
2004-12-15 14:58:39 +00:00
chooser = gtk_file_chooser_button_new_with_backend ("Select A Folder - testfilechooserbutton",
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
backend);
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (chooser), gtk_src_dir, NULL);
gtk_file_chooser_remove_shortcut_folder (GTK_FILE_CHOOSER (chooser), gtk_src_dir, NULL);
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (chooser), gtk_src_dir, NULL);
Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, 2004-10-25 James M. Cape <jcape@ignore-your.tv> Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, #154390, #156272. * docs/reference/gtk/gtk-docs.sgml: Moved GtkFileChooserButton below GtkFileChooser. * docs/reference/gtk/gtk-sections.txt: Added gtk_file_chooser_button_get_width_chars(), gtk_file_chooser_button_set_width_chars(), gtk_label_set_width_chars(), gtk_label_get_width_chars(). * docs/reference/gtk/gtk.types: Added gtk_cell_renderer_combo_get_type, gtk_cell_view_get_type, gtk_text_iter_get_type. * docs/reference/gtk/tmpl/gtkaboutdialog.sgml: Add "logo-icon-name" property. * docs/reference/gtk/tmpl/gtkcellview.sgml: Updates for properties (b/c of get_type() inclusion above). * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * docs/reference/gtk/tmpl/gtklabel.sgml: Add "width-chars" property, getters/setters. * docs/reference/gtk/tmpl/gtkcellrenderercombo.sgml: Added. * gtk/gtkentrycompletion.c: (_gtk_entry_completion_popdown): Don't show if the entry isn't mapped. * gtk/gtkfilechooserbutton.[c,h]: (*): About 45% rewritten, adds "width-chars" property, icons, working save modes, volume/Home/Desktop friendly-naming support. * gtk/gtklabel.[c,h]: (gtk_label_class_init), (gtk_label_init), (gtk_label_get_property), (gtk_label_set_property), (gtk_label_get_width_chars), (gtk_label_set_width_chars), (gtk_label_size_request): Add "width-chars" property. * tests/testfilechooserbutton.c: Update, use 4 different buttons for the different ACTIONs. * gtk/.cvsignore: Ignore gtk-update-icon-cache. * tests/.cvsignore: Ignore testimage.
2004-10-26 04:29:56 +00:00
gtk_label_set_mnemonic_widget (GTK_LABEL (label), chooser);
g_signal_connect (chooser, "current-folder-changed",
G_CALLBACK (chooser_current_folder_changed_cb), NULL);
g_signal_connect (chooser, "selection-changed", G_CALLBACK (chooser_selection_changed_cb), NULL);
g_signal_connect (chooser, "file-activated", G_CALLBACK (chooser_file_activated_cb), NULL);
g_signal_connect (chooser, "update-preview", G_CALLBACK (chooser_update_preview_cb), NULL);
gtk_container_add (GTK_CONTAINER (hbox), chooser);
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
button = gtk_button_new_from_stock (GTK_STOCK_PROPERTIES);
Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, 2004-10-25 James M. Cape <jcape@ignore-your.tv> Rework of GtkFileChooserButton, some cleanups. Fixes #154388, #154390, #154390, #156272. * docs/reference/gtk/gtk-docs.sgml: Moved GtkFileChooserButton below GtkFileChooser. * docs/reference/gtk/gtk-sections.txt: Added gtk_file_chooser_button_get_width_chars(), gtk_file_chooser_button_set_width_chars(), gtk_label_set_width_chars(), gtk_label_get_width_chars(). * docs/reference/gtk/gtk.types: Added gtk_cell_renderer_combo_get_type, gtk_cell_view_get_type, gtk_text_iter_get_type. * docs/reference/gtk/tmpl/gtkaboutdialog.sgml: Add "logo-icon-name" property. * docs/reference/gtk/tmpl/gtkcellview.sgml: Updates for properties (b/c of get_type() inclusion above). * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * docs/reference/gtk/tmpl/gtklabel.sgml: Add "width-chars" property, getters/setters. * docs/reference/gtk/tmpl/gtkcellrenderercombo.sgml: Added. * gtk/gtkentrycompletion.c: (_gtk_entry_completion_popdown): Don't show if the entry isn't mapped. * gtk/gtkfilechooserbutton.[c,h]: (*): About 45% rewritten, adds "width-chars" property, icons, working save modes, volume/Home/Desktop friendly-naming support. * gtk/gtklabel.[c,h]: (gtk_label_class_init), (gtk_label_init), (gtk_label_get_property), (gtk_label_set_property), (gtk_label_get_width_chars), (gtk_label_set_width_chars), (gtk_label_size_request): Add "width-chars" property. * tests/testfilechooserbutton.c: Update, use 4 different buttons for the different ACTIONs. * gtk/.cvsignore: Ignore gtk-update-icon-cache. * tests/.cvsignore: Ignore testimage.
2004-10-26 04:29:56 +00:00
g_signal_connect (button, "clicked", G_CALLBACK (properties_button_clicked_cb), chooser);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
removed "GtkFileChooserButton:active" property and getter/setter. 2004-11-30 James M. Cape <jcape@ignore-your.tv> * gtk/gtkfilechooserbutton.h (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * gtk/gtkfilechooserbutton.c (gtk_file_chooser_button_class_init) (gtk_file_chooser_button_get_active) (gtk_file_chooser_button_set_active): * docs/reference/gtk/gtk-sections.txt: * docs/reference/gtk/tmpl/gtkfilechooserbutton.sgml: * gtk/gtk.symbols: removed "GtkFileChooserButton:active" property and getter/setter. * gtk/gtkfilechooserbutton.c (struct _GtkFileChooserButtonPrivate) (button_toggled_cb) (dialog_response_cb) (button_notify_active_cb) (gtk_file_chooser_button_init) (button_clicked_cb) (gtk_file_chooser_button_show): Use a GtkButton instead of a GtkToggleButton. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_destroy) (gtk_file_chooser_button_style_set) (gtk_file_chooser_button_screen_changed): Don't bother with the (remove_settings_signal) (settings_notify_cb) (check_icon_theme): Don't use GtkSettings at all, just call change_icon_theme() directly. (struct _GtkFileChooserButtonPrivate) (gtk_file_chooser_button_init) (gtk_file_chooser_button_drag_data_received) (gtk_file_chooser_button_mnemonic_activate) (gtk_file_chooser_button_set_width_chars) (gtk_file_chooser_button_get_width_chars) (entry_changed_cb) (update_idler) (update_entry) (update_dialog) (dialog_selection_changed_cb) (dialog_response_cb) (entry_size_allocate_cb): Remove all references to the now-defunct entry, store the old path (to support "Cancel") in an instance member. (update_label_and_image) (update_label) (update_image) (gtk_file_chooser_button_init) (dialog_response_cb) (dialog_selection_changed_cb): Merge label/image updates, only display the filename (not the whole path, fixes #157725). (struct _GtkFileChooserButtonPrivate) (dialog_selection_changed_cb) (dialog_selection_changed_proxy_cb): Merge "selection-changed" handlers, block while dialog is visible (fixes #158482). * tests/testfilechooserbutton.c (delete_event_cb) (properties_button_clicked_cb) (print_selected_path_clicked_cb) (tests_button_clicked_cb) (main): Add per-chooser "tests" window, don't delete on WM close, update properties_button_clicked_cb() "delete-event" callback.
2004-11-30 21:06:48 +00:00
button = gtk_button_new_with_label ("Tests");
g_signal_connect (button, "clicked", G_CALLBACK (tests_button_clicked_cb), chooser);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
g_object_unref (label_group);
gtk_widget_show_all (win);
gtk_window_present (GTK_WINDOW (win));
gtk_main ();
return 0;
}