Commit b418bf3a authored by James M. Cape's avatar James M. Cape Committed by James M. Cape
Browse files

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.
parent 43f85261
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 Matthias Clasen <mclasen@redhat.com> 2004-12-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserdefault.c (get_is_file_filtered): Don't * gtk/gtkfilechooserdefault.c (get_is_file_filtered): Don't
......
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 Matthias Clasen <mclasen@redhat.com> 2004-12-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserdefault.c (get_is_file_filtered): Don't * gtk/gtkfilechooserdefault.c (get_is_file_filtered): Don't
......
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 Matthias Clasen <mclasen@redhat.com> 2004-12-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserdefault.c (get_is_file_filtered): Don't * gtk/gtkfilechooserdefault.c (get_is_file_filtered): Don't
......
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 Matthias Clasen <mclasen@redhat.com> 2004-12-15 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilechooserdefault.c (get_is_file_filtered): Don't * gtk/gtkfilechooserdefault.c (get_is_file_filtered): Don't
......
...@@ -74,6 +74,7 @@ This should not be accessed directly. Use the accessor functions below. ...@@ -74,6 +74,7 @@ This should not be accessed directly. Use the accessor functions below.
</para> </para>
@title: @title:
@action:
@Returns: @Returns:
...@@ -83,6 +84,7 @@ This should not be accessed directly. Use the accessor functions below. ...@@ -83,6 +84,7 @@ This should not be accessed directly. Use the accessor functions below.
</para> </para>
@title: @title:
@action:
@backend: @backend:
@Returns: @Returns:
......
...@@ -444,13 +444,14 @@ create_file_button (void) ...@@ -444,13 +444,14 @@ create_file_button (void)
vbox = gtk_vbox_new (FALSE, 12); vbox = gtk_vbox_new (FALSE, 12);
vbox2 = gtk_vbox_new (FALSE, 3); vbox2 = gtk_vbox_new (FALSE, 3);
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
picker = gtk_file_chooser_button_new ("File Chooser Button"); picker = gtk_file_chooser_button_new ("File Chooser Button",
GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_widget_set_size_request (picker, 150, -1); gtk_widget_set_size_request (picker, 150, -1);
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (picker), "/etc/yum.conf"); gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (picker), "/etc/yum.conf");
gtk_container_add (GTK_CONTAINER (align), picker); gtk_container_add (GTK_CONTAINER (align), picker);
gtk_box_pack_start (GTK_BOX (vbox2), align, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox2), align, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox2), gtk_box_pack_start (GTK_BOX (vbox2),
gtk_label_new ("File Button (Open)"), gtk_label_new ("File Button (Files)"),
FALSE, FALSE, 0); FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), gtk_box_pack_start (GTK_BOX (vbox),
...@@ -461,15 +462,14 @@ create_file_button (void) ...@@ -461,15 +462,14 @@ create_file_button (void)
vbox2 = gtk_vbox_new (FALSE, 3); vbox2 = gtk_vbox_new (FALSE, 3);
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
picker = gtk_file_chooser_button_new ("File Chooser Button"); picker = gtk_file_chooser_button_new ("File Chooser Button",
gtk_file_chooser_set_action (GTK_FILE_CHOOSER (picker), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
GTK_FILE_CHOOSER_ACTION_SAVE);
gtk_widget_set_size_request (picker, 150, -1); gtk_widget_set_size_request (picker, 150, -1);
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (picker), "/etc/yum.conf"); gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (picker), "/");
gtk_container_add (GTK_CONTAINER (align), picker); gtk_container_add (GTK_CONTAINER (align), picker);
gtk_box_pack_start (GTK_BOX (vbox2), align, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox2), align, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox2), gtk_box_pack_start (GTK_BOX (vbox2),
gtk_label_new ("File Button (Save)"), gtk_label_new ("File Button (Select Folder)"),
FALSE, FALSE, 0); FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), gtk_box_pack_start (GTK_BOX (vbox),
vbox2, TRUE, TRUE, 0); vbox2, TRUE, TRUE, 0);
......
...@@ -33,12 +33,15 @@ ...@@ -33,12 +33,15 @@
#include "gtkalias.h" #include "gtkalias.h"
#include "gtkintl.h" #include "gtkintl.h"
#include "gtkbutton.h" #include "gtkbutton.h"
#include "gtkcombobox.h"
#include "gtkdnd.h" #include "gtkdnd.h"
#include "gtkicontheme.h" #include "gtkicontheme.h"
#include "gtkiconfactory.h" #include "gtkiconfactory.h"
#include "gtkimage.h" #include "gtkimage.h"
#include "gtklabel.h" #include "gtklabel.h"
#include "gtkliststore.h"
#include "gtkstock.h" #include "gtkstock.h"
#include "gtktreemodelfilter.h"
#include "gtkvseparator.h" #include "gtkvseparator.h"
#include "gtkfilechooserdialog.h" #include "gtkfilechooserdialog.h"
#include "gtkfilechooserprivate.h" #include "gtkfilechooserprivate.h"
...@@ -53,11 +56,12 @@ ...@@ -53,11 +56,12 @@
#define GTK_FILE_CHOOSER_BUTTON_GET_PRIVATE(object) (GTK_FILE_CHOOSER_BUTTON ((object))->priv) #define GTK_FILE_CHOOSER_BUTTON_GET_PRIVATE(object) (GTK_FILE_CHOOSER_BUTTON ((object))->priv)
#define DEFAULT_FILENAME N_("(None)") #define HOME_DISPLAY_NAME N_("Home")
#define MIN_LABEL_WIDTH 100 #define DESKTOP_DISPLAY_NAME N_("Desktop")
#define ENTRY_BUTTON_SPACING 0 #define FALLBACK_DISPLAY_NAME N_("(None)")
#define FALLBACK_ICON_SIZE 20
#define FALLBACK_ICON_NAME "stock_unknown" #define FALLBACK_ICON_NAME "stock_unknown"
#define FALLBACK_ICON_SIZE 20
/* ********************** * /* ********************** *
* Private Enumerations * * Private Enumerations *
...@@ -73,6 +77,33 @@ enum ...@@ -73,6 +77,33 @@ enum
PROP_WIDTH_CHARS PROP_WIDTH_CHARS
}; };
/* TreeModel Columns */
enum
{
ICON_COLUMN,
DISPLAY_NAME_COLUMN,
TYPE_COLUMN,
DATA_COLUMN,
NUM_COLUMNS
};
/* TreeModel Row Types */
typedef enum
{
ROW_TYPE_SPECIAL,
ROW_TYPE_VOLUME,
ROW_TYPE_SHORTCUT,
ROW_TYPE_BOOKMARK_SEPARATOR,
ROW_TYPE_BOOKMARK,
ROW_TYPE_CURRENT_FOLDER_SEPARATOR,
ROW_TYPE_CURRENT_FOLDER,
ROW_TYPE_OTHER_SEPARATOR,
ROW_TYPE_OTHER,
ROW_TYPE_INVALID = -1
}
RowType;
/* ******************** * /* ******************** *
* Private Structures * * Private Structures *
...@@ -84,16 +115,37 @@ struct _GtkFileChooserButtonPrivate ...@@ -84,16 +115,37 @@ struct _GtkFileChooserButtonPrivate
GtkWidget *button; GtkWidget *button;
GtkWidget *image; GtkWidget *image;
GtkWidget *label; GtkWidget *label;
GtkWidget *combo_box;
GtkCellRenderer *icon_cell;
GtkCellRenderer *name_cell;
GtkTreeModel *model;
GtkTreeModel *filter_model;
GtkFilePath *old_path;
gchar *backend; gchar *backend;
GtkFileSystem *fs;
GtkFilePath *old_path;
gulong combo_box_changed_id;
gulong dialog_file_activated_id; gulong dialog_file_activated_id;
gulong dialog_folder_changed_id; gulong dialog_folder_changed_id;
gulong dialog_selection_changed_id; gulong dialog_selection_changed_id;
gulong fs_volumes_changed_id;
gulong fs_bookmarks_changed_id;
gint icon_size; gint icon_size;
guint8 n_special;
guint8 n_volumes;
guint8 n_shortcuts;
guint8 n_bookmarks;
guint8 has_bookmark_separator : 1;
guint8 has_current_folder_separator : 1;
guint8 has_current_folder : 1;
guint8 has_other_separator : 1;
/* Used for hiding/showing the dialog when the button is hidden */ /* Used for hiding/showing the dialog when the button is hidden */
guint8 active : 1; guint8 active : 1;
}; };
...@@ -107,10 +159,20 @@ enum ...@@ -107,10 +159,20 @@ enum
TEXT_URI_LIST TEXT_URI_LIST
}; };
/* ********************* * /* ********************* *
* Function Prototypes * * Function Prototypes *
* ********************* */ * ********************* */
/* GtkFileChooserIface Functions */
static void gtk_file_chooser_button_file_chooser_iface_init (GtkFileChooserIface *iface);
static gboolean gtk_file_chooser_button_add_shortcut_folder (GtkFileChooser *chooser,
const GtkFilePath *path,
GError **error);
static gboolean gtk_file_chooser_button_remove_shortcut_folder (GtkFileChooser *chooser,
const GtkFilePath *path,
GError **error);
/* GObject Functions */ /* GObject Functions */
static GObject *gtk_file_chooser_button_constructor (GType type, static GObject *gtk_file_chooser_button_constructor (GType type,
guint n_params, guint n_params,
...@@ -123,6 +185,7 @@ static void gtk_file_chooser_button_get_property (GObject *ob ...@@ -123,6 +185,7 @@ static void gtk_file_chooser_button_get_property (GObject *ob
guint param_id, guint param_id,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gtk_file_chooser_button_finalize (GObject *object);
/* GtkObject Functions */ /* GtkObject Functions */
static void gtk_file_chooser_button_destroy (GtkObject *object); static void gtk_file_chooser_button_destroy (GtkObject *object);
...@@ -146,30 +209,72 @@ static void gtk_file_chooser_button_style_set (GtkWidget *wi ...@@ -146,30 +209,72 @@ static void gtk_file_chooser_button_style_set (GtkWidget *wi
static void gtk_file_chooser_button_screen_changed (GtkWidget *widget, static void gtk_file_chooser_button_screen_changed (GtkWidget *widget,
GdkScreen *old_screen); GdkScreen *old_screen);
/* Child Widget Callbacks */
static void dialog_update_preview_cb (GtkFileChooser *dialog,
gpointer user_data);
static void dialog_selection_changed_cb (GtkFileChooser *dialog,
gpointer user_data);
static void dialog_file_activated_cb (GtkFileChooser *dialog,
gpointer user_data);
static void dialog_current_folder_changed_cb (GtkFileChooser *dialog,
gpointer user_data);
static void dialog_notify_cb (GObject *dialog,
GParamSpec *pspec,
gpointer user_data);
static gboolean dialog_delete_event_cb (GtkWidget *dialog,
GdkEvent *event,
gpointer user_data);
static void dialog_response_cb (GtkDialog *dialog,
gint response,
gpointer user_data);
static void button_clicked_cb (GtkButton *real_button,
gpointer user_data);
/* Utility Functions */ /* Utility Functions */
static void update_label_and_image (GtkFileChooserButton *button); static GtkIconTheme *get_icon_theme (GtkWidget *widget);
static gchar *get_display_name_for_path (GtkFileSystem *fs,
const GtkFilePath *path);
static gint model_get_type_position (GtkFileChooserButton *button,
RowType row_type);
static void model_free_row_data (GtkFileChooserButton *button,
GtkTreeIter *iter);
static inline void model_add_special (GtkFileChooserButton *button);
static inline void model_add_other (GtkFileChooserButton *button);
static void model_add_volumes (GtkFileChooserButton *button,
GSList *volumes);
static void model_add_bookmarks (GtkFileChooserButton *button,
GSList *bookmarks);
static void model_update_current_folder (GtkFileChooserButton *button,
const GtkFilePath *path);
static void model_remove_rows (GtkFileChooserButton *button,
gint pos,
gint n_rows);
static gboolean filter_model_visible_func (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data);
static gboolean combo_box_row_separator_func (GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data);
static void name_cell_data_func (GtkCellLayout *layout,
GtkCellRenderer *cell,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer user_data);
static void open_dialog (GtkFileChooserButton *button);
static void update_combo_box (GtkFileChooserButton *button);
static void update_label_and_image (GtkFileChooserButton *button);
/* Child Object Callbacks */
static void fs_volumes_changed_cb (GtkFileSystem *fs,
gpointer user_data);
static void fs_bookmarks_changed_cb (GtkFileSystem *fs,
gpointer user_data);
static void combo_box_changed_cb (GtkComboBox *combo_box,
gpointer user_data);
static void button_clicked_cb (GtkButton *real_button,
gpointer user_data);
static void dialog_update_preview_cb (GtkFileChooser *dialog,
gpointer user_data);
static void dialog_selection_changed_cb (GtkFileChooser *dialog,
gpointer user_data);
static void dialog_file_activated_cb (GtkFileChooser *dialog,
gpointer user_data);
static void dialog_current_folder_changed_cb (GtkFileChooser *dialog,
gpointer user_data);
static void dialog_notify_cb (GObject *dialog,
GParamSpec *pspec,
gpointer user_data);
static gboolean dialog_delete_event_cb (GtkWidget *dialog,
GdkEvent *event,
gpointer user_data);
static void dialog_response_cb (GtkDialog *dialog,
gint response,
gpointer user_data);
/* ******************* * /* ******************* *
...@@ -177,7 +282,7 @@ static void update_label_and_image (GtkFileChooserButton ...@@ -177,7 +282,7 @@ static void update_label_and_image (GtkFileChooserButton
* ******************* */ * ******************* */
G_DEFINE_TYPE_WITH_CODE (GtkFileChooserButton, gtk_file_chooser_button, GTK_TYPE_HBOX, { \ G_DEFINE_TYPE_WITH_CODE (GtkFileChooserButton, gtk_file_chooser_button, GTK_TYPE_HBOX, { \
G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER, _gtk_file_chooser_delegate_iface_init) \ G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER, gtk_file_chooser_button_file_chooser_iface_init) \
}); });
...@@ -199,6 +304,7 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class) ...@@ -199,6 +304,7 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
gobject_class->constructor = gtk_file_chooser_button_constructor; gobject_class->constructor = gtk_file_chooser_button_constructor;
gobject_class->set_property = gtk_file_chooser_button_set_property; gobject_class->set_property = gtk_file_chooser_button_set_property;
gobject_class->get_property = gtk_file_chooser_button_get_property; gobject_class->get_property = gtk_file_chooser_button_get_property;
gobject_class->finalize = gtk_file_chooser_button_finalize;
gtkobject_class->destroy = gtk_file_chooser_button_destroy; gtkobject_class->destroy = gtk_file_chooser_button_destroy;
...@@ -259,7 +365,6 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class) ...@@ -259,7 +365,6 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
g_type_class_add_private (class, sizeof (GtkFileChooserButtonPrivate)); g_type_class_add_private (class, sizeof (GtkFileChooserButtonPrivate));
} }
static void static void
gtk_file_chooser_button_init (GtkFileChooserButton *button) gtk_file_chooser_button_init (GtkFileChooserButton *button)
{ {
...@@ -275,6 +380,7 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button) ...@@ -275,6 +380,7 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
gtk_widget_push_composite_child (); gtk_widget_push_composite_child ();
/* Button */
priv->button = gtk_button_new (); priv->button = gtk_button_new ();
g_signal_connect (priv->button, "clicked", G_CALLBACK (button_clicked_cb), g_signal_connect (priv->button, "clicked", G_CALLBACK (button_clicked_cb),
button); button);
...@@ -289,8 +395,8 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button) ...@@ -289,8 +395,8 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
gtk_box_pack_start (GTK_BOX (box), priv->image, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (box), priv->image, FALSE, FALSE, 0);
gtk_widget_show (priv->image); gtk_widget_show (priv->image);
priv->label = gtk_label_new (_(DEFAULT_FILENAME)); priv->label = gtk_label_new (_(FALLBACK_DISPLAY_NAME));
gtk_label_set_ellipsize (GTK_LABEL (priv->label), PANGO_ELLIPSIZE_START); gtk_label_set_ellipsize (GTK_LABEL (priv->label), PANGO_ELLIPSIZE_END);
gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5);
gtk_container_add (GTK_CONTAINER (box), priv->label); gtk_container_add (GTK_CONTAINER (box), priv->label);
gtk_widget_show (priv->label); gtk_widget_show (priv->label);
...@@ -304,6 +410,36 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button) ...@@ -304,6 +410,36 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)