diff options
author | Federico Mena Quintero <federico@gnome.org> | 2011-07-01 12:57:44 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2011-07-01 12:57:44 -0500 |
commit | 345286d4a6d6d17c11b7f408c86475a9e28122cb (patch) | |
tree | a1669321b1eba3d351eced5506fcf541063163f8 | |
parent | d1b823aa8f869df3a5048b449818222e64623649 (diff) | |
download | gtk+-345286d4a6d6d17c11b7f408c86475a9e28122cb.tar.gz |
Create the recently-used widgets and infobar from the pathbar widgets as well
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
-rw-r--r-- | gtk/gtkfilechooserdefault.c | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index e97df71fd3..e451776a98 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -4706,6 +4706,37 @@ location_button_create (GtkFileChooserDefault *impl) atk_object_set_name (gtk_widget_get_accessible (impl->location_button), str); } +/* Creates the info bar for informational messages or warnings, with its icon and label */ +static void +info_bar_create (GtkFileChooserDefault *impl) +{ + GtkWidget *content_area; + + impl->browse_select_a_folder_info_bar = gtk_info_bar_new (); + impl->browse_select_a_folder_warning_icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU); + impl->browse_select_a_folder_label = gtk_label_new (NULL); + + content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (impl->browse_select_a_folder_info_bar)); + gtk_box_set_spacing (GTK_BOX (content_area), 6); + + gtk_box_pack_start (GTK_BOX (content_area), impl->browse_select_a_folder_warning_icon, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (content_area), impl->browse_select_a_folder_label, TRUE, TRUE, 0); + + gtk_widget_show (impl->browse_select_a_folder_label); +} + +/* Creates the recently-used informational widgets, including the info bar */ +static void +recent_widgets_create (GtkFileChooserDefault *impl) +{ + /* Box for recent widgets */ + impl->recent_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); + + /* Info bar */ + info_bar_create (impl); + gtk_box_pack_start (GTK_BOX (impl->recent_hbox), impl->browse_select_a_folder_info_bar, FALSE, FALSE, 0); +} + /* Creates the path bar's container and eveyrthing that goes in it: location button, pathbar, info bar, and Create Folder button */ static void path_bar_widgets_create (GtkFileChooserDefault *impl) @@ -4731,6 +4762,11 @@ path_bar_widgets_create (GtkFileChooserDefault *impl) gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->browse_path_bar); gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->browse_path_bar, TRUE, TRUE, 0); + /* Recent widgets and info bar */ + recent_widgets_create (impl); + gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->recent_hbox); + gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->recent_hbox, TRUE, TRUE, 0); + /* Create Folder */ impl->browse_new_folder_button = gtk_button_new_with_mnemonic (_("Create Fo_lder")); g_signal_connect (impl->browse_new_folder_button, "clicked", @@ -4945,25 +4981,6 @@ unset_file_system_backend (GtkFileChooserDefault *impl) impl->file_system = NULL; } -static void -create_info_bar (GtkFileChooserDefault *impl) -{ - GtkWidget *content_area; - - impl->browse_select_a_folder_info_bar = gtk_info_bar_new (); - impl->browse_select_a_folder_warning_icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU); - impl->browse_select_a_folder_label = gtk_label_new (NULL); - - content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (impl->browse_select_a_folder_info_bar)); - gtk_box_set_spacing (GTK_BOX (content_area), 6); - - gtk_box_pack_start (GTK_BOX (content_area), impl->browse_select_a_folder_warning_icon, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (content_area), impl->browse_select_a_folder_label, TRUE, TRUE, 0); - - gtk_widget_show (impl->browse_select_a_folder_info_bar); - gtk_widget_show (impl->browse_select_a_folder_label); -} - typedef enum { INFO_BAR_SELECT_A_FOLDER, INFO_BAR_ERROR_NO_FILENAME, @@ -9402,18 +9419,9 @@ recent_hide_entry (GtkFileChooserDefault *impl) GtkWidget *image; gchar *tmp; - /* Box for recent widgets */ - impl->recent_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); - - gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->recent_hbox, TRUE, TRUE, 0); - gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->recent_hbox); - gtk_widget_show (impl->recent_hbox); - /* For Save mode, we don't want this icon/label - we want update_path_bar() to do its thing instead */ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE) { - create_info_bar (impl); - gtk_box_pack_start (GTK_BOX (impl->recent_hbox), impl->browse_select_a_folder_info_bar, FALSE, FALSE, 0); set_info_bar (impl, INFO_BAR_SELECT_A_FOLDER); } else |