1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
3 /* nautilus-file-management-properties.c - Functions to create and show the nautilus preference dialog.
5 Copyright (C) 2002 Jan Arne Petersen
7 The Gnome Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 The Gnome Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with the Gnome Library; see the file COPYING.LIB. If not,
19 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
22 Authors: Jan Arne Petersen <jpetersen@uni-bonn.de>
27 #include "nautilus-file-management-properties.h"
34 #include <libgnome/gnome-help.h>
35 #include <glib/gi18n.h>
37 #include <glade/glade.h>
39 #include <eel/eel-gconf-extensions.h>
40 #include <eel/eel-glib-extensions.h>
41 #include <eel/eel-preferences-glade.h>
43 #include <libnautilus-private/nautilus-column-chooser.h>
44 #include <libnautilus-private/nautilus-column-utilities.h>
45 #include <libnautilus-private/nautilus-global-preferences.h>
46 #include <libnautilus-private/nautilus-module.h>
48 #include <libnautilus-private/nautilus-autorun.h>
50 /* string enum preferences */
51 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_DEFAULT_VIEW_WIDGET "default_view_combobox"
52 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ICON_VIEW_ZOOM_WIDGET "icon_view_zoom_combobox"
53 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LIST_VIEW_ZOOM_WIDGET "list_view_zoom_combobox"
54 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET "sort_order_combobox"
55 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_DATE_FORMAT_WIDGET "date_format_combobox"
56 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_TEXT_WIDGET "preview_text_combobox"
57 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_IMAGE_WIDGET "preview_image_combobox"
58 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_SOUND_WIDGET "preview_sound_combobox"
59 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FOLDER_WIDGET "preview_folder_combobox"
61 /* bool preferences */
62 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_FOLDERS_FIRST_WIDGET "sort_folders_first_checkbutton"
63 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_COMPACT_LAYOUT_WIDGET "compact_layout_checkbutton"
64 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LABELS_BESIDE_ICONS_WIDGET "labels_beside_icons_checkbutton"
65 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_BROWSER_WIDGET "always_use_browser_checkbutton"
66 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_LOCATION_ENTRY_WIDGET "always_use_location_entry_checkbutton"
67 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_CONFIRM_WIDGET "trash_confirm_checkbutton"
68 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_DELETE_WIDGET "trash_delete_checkbutton"
69 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_OPEN_NEW_WINDOW_WIDGET "new_window_checkbutton"
70 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET "hidden_files_checkbutton"
71 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TREE_VIEW_FOLDERS_WIDGET "treeview_folders_checkbutton"
72 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTOMOUNT_OPEN "media_automount_open_checkbutton"
73 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTORUN_NEVER "media_autorun_never_checkbutton"
76 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_THUMBNAIL_LIMIT_WIDGET "preview_image_size_combobox"
78 static const char * const default_view_values
[] = {
84 static const char * const zoom_values
[] = {
95 static const char * const sort_order_values
[] = {
104 static const char * const date_format_values
[] = {
111 static const char * const preview_values
[] = {
118 static const char * const click_behavior_components
[] = {
119 "single_click_radiobutton",
120 "double_click_radiobutton",
124 static const char * const click_behavior_values
[] = {
130 static const char * const executable_text_components
[] = {
131 "scripts_execute_radiobutton",
132 "scripts_view_radiobutton",
133 "scripts_confirm_radiobutton",
137 static const char * const executable_text_values
[] = {
144 static const int thumbnail_limit_values
[] = {
156 static const char * const icon_captions_components
[] = {
157 "captions_0_combobox",
158 "captions_1_combobox",
159 "captions_2_combobox",
164 nautilus_file_management_properties_size_group_create (GladeXML
*xml_dialog
,
168 GtkSizeGroup
*size_group
;
172 size_group
= gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL
);
174 for (i
= 0; i
< items
; i
++) {
175 item_name
= g_strdup_printf ("%s_%d", prefix
, i
);
176 gtk_size_group_add_widget (size_group
,
177 glade_xml_get_widget (xml_dialog
, item_name
));
180 g_object_unref (G_OBJECT (size_group
));
184 preferences_show_help (GtkWindow
*parent
,
185 char const *helpfile
,
188 GError
*error
= NULL
;
191 g_return_if_fail (helpfile
!= NULL
);
192 g_return_if_fail (sect_id
!= NULL
);
194 gnome_help_display_desktop (NULL
,
196 helpfile
, sect_id
, &error
);
199 dialog
= gtk_message_dialog_new (GTK_WINDOW (parent
),
200 GTK_DIALOG_DESTROY_WITH_PARENT
,
203 _("There was an error displaying help: \n%s"),
206 g_signal_connect (G_OBJECT (dialog
),
207 "response", G_CALLBACK (gtk_widget_destroy
),
209 gtk_window_set_resizable (GTK_WINDOW (dialog
), FALSE
);
210 gtk_widget_show (dialog
);
211 g_error_free (error
);
217 nautilus_file_management_properties_dialog_response_cb (GtkDialog
*parent
,
219 GladeXML
*xml_dialog
)
223 if (response_id
== GTK_RESPONSE_HELP
) {
224 switch (gtk_notebook_get_current_page (GTK_NOTEBOOK (glade_xml_get_widget (xml_dialog
, "notebook1")))) {
227 section
= "gosnautilus-438";
230 section
= "gosnautilus-56";
233 section
= "gosnautilus-439";
236 section
= "gosnautilus-490";
239 section
= "gosnautilus-60";
241 preferences_show_help (GTK_WINDOW (parent
), "user-guide.xml", section
);
242 } else if (response_id
== GTK_RESPONSE_CLOSE
) {
243 /* remove gconf monitors */
244 eel_gconf_monitor_remove ("/apps/nautilus/icon_view");
245 eel_gconf_monitor_remove ("/apps/nautilus/list_view");
246 eel_gconf_monitor_remove ("/apps/nautilus/preferences");
247 eel_gconf_monitor_remove ("/desktop/gnome/file_views");
252 columns_changed_callback (NautilusColumnChooser
*chooser
,
253 gpointer callback_data
)
255 char **visible_columns
;
258 nautilus_column_chooser_get_settings (NAUTILUS_COLUMN_CHOOSER (chooser
),
262 eel_preferences_set_string_array (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS
, visible_columns
);
263 eel_preferences_set_string_array (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER
, column_order
);
265 g_strfreev (visible_columns
);
266 g_strfreev (column_order
);
270 free_column_names_array (GPtrArray
*column_names
)
272 g_ptr_array_foreach (column_names
, (GFunc
) g_free
, NULL
);
273 g_ptr_array_free (column_names
, TRUE
);
277 create_icon_caption_combo_box_items (GtkComboBox
*combo_box
,
281 GPtrArray
*column_names
;
283 column_names
= g_ptr_array_new ();
285 gtk_combo_box_append_text (combo_box
, _("None"));
286 g_ptr_array_add (column_names
, g_strdup ("none"));
288 for (l
= columns
; l
!= NULL
; l
= l
->next
) {
289 NautilusColumn
*column
;
293 column
= NAUTILUS_COLUMN (l
->data
);
295 g_object_get (G_OBJECT (column
),
296 "name", &name
, "label", &label
,
299 /* Don't show name here, it doesn't make sense */
300 if (!strcmp (name
, "name")) {
306 gtk_combo_box_append_text (combo_box
, label
);
307 g_ptr_array_add (column_names
, name
);
311 g_object_set_data_full (G_OBJECT (combo_box
), "column_names",
313 (GDestroyNotify
) free_column_names_array
);
317 icon_captions_changed_callback (GtkComboBox
*combo_box
,
324 xml
= GLADE_XML (user_data
);
326 captions
= g_ptr_array_new ();
328 for (i
= 0; icon_captions_components
[i
] != NULL
; i
++) {
329 GtkWidget
*combo_box
;
331 GPtrArray
*column_names
;
334 combo_box
= glade_xml_get_widget
335 (GLADE_XML (xml
), icon_captions_components
[i
]);
336 active
= gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box
));
338 column_names
= g_object_get_data (G_OBJECT (combo_box
),
341 name
= g_ptr_array_index (column_names
, active
);
342 g_ptr_array_add (captions
, name
);
344 g_ptr_array_add (captions
, NULL
);
346 eel_preferences_set_string_array (NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS
,
347 (char **)captions
->pdata
);
348 g_ptr_array_free (captions
, TRUE
);
352 update_caption_combo_box (GladeXML
*xml
,
353 const char *combo_box_name
,
356 GtkWidget
*combo_box
;
358 GPtrArray
*column_names
;
360 combo_box
= glade_xml_get_widget (xml
, combo_box_name
);
362 g_signal_handlers_block_by_func
364 G_CALLBACK (icon_captions_changed_callback
),
367 column_names
= g_object_get_data (G_OBJECT (combo_box
),
370 for (i
= 0; i
< column_names
->len
; ++i
) {
371 if (!strcmp (name
, g_ptr_array_index (column_names
, i
))) {
372 gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box
), i
);
377 g_signal_handlers_unblock_by_func
379 G_CALLBACK (icon_captions_changed_callback
),
384 update_icon_captions_from_gconf (GladeXML
*xml
)
389 captions
= eel_preferences_get_string_array (NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS
);
390 if (captions
== NULL
)
394 icon_captions_components
[i
] != NULL
;
405 update_caption_combo_box (xml
,
406 icon_captions_components
[i
],
410 g_strfreev (captions
);
414 nautilus_file_management_properties_dialog_setup_icon_caption_page (GladeXML
*xml_dialog
)
420 writable
= eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS
);
422 columns
= nautilus_get_all_columns ();
424 for (i
= 0; icon_captions_components
[i
] != NULL
; i
++) {
425 GtkWidget
*combo_box
;
427 combo_box
= glade_xml_get_widget (xml_dialog
,
428 icon_captions_components
[i
]);
430 create_icon_caption_combo_box_items (GTK_COMBO_BOX (combo_box
), columns
);
431 gtk_widget_set_sensitive (combo_box
, writable
);
433 g_signal_connect (combo_box
, "changed",
434 G_CALLBACK (icon_captions_changed_callback
),
438 nautilus_column_list_free (columns
);
440 update_icon_captions_from_gconf (xml_dialog
);
444 create_date_format_menu (GladeXML
*xml_dialog
)
446 GtkWidget
*combo_box
;
450 combo_box
= glade_xml_get_widget (xml_dialog
,
451 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_DATE_FORMAT_WIDGET
);
453 now_raw
= time (NULL
);
454 now
= localtime (&now_raw
);
456 date_string
= eel_strdup_strftime ("%c", now
);
457 gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box
), date_string
);
458 g_free (date_string
);
460 date_string
= eel_strdup_strftime ("%Y-%m-%d %H:%M:%S", now
);
461 gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box
), date_string
);
462 g_free (date_string
);
464 date_string
= eel_strdup_strftime (_("today at %-I:%M:%S %p"), now
);
465 gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box
), date_string
);
466 g_free (date_string
);
470 set_columns_from_gconf (NautilusColumnChooser
*chooser
)
472 char **visible_columns
;
475 visible_columns
= eel_preferences_get_string_array (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS
);
476 column_order
= eel_preferences_get_string_array (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER
);
478 nautilus_column_chooser_set_settings (NAUTILUS_COLUMN_CHOOSER (chooser
),
482 g_strfreev (visible_columns
);
483 g_strfreev (column_order
);
487 use_default_callback (NautilusColumnChooser
*chooser
,
490 eel_preferences_unset (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS
);
491 eel_preferences_unset (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER
);
492 set_columns_from_gconf (chooser
);
496 nautilus_file_management_properties_dialog_setup_list_column_page (GladeXML
*xml_dialog
)
501 chooser
= nautilus_column_chooser_new ();
502 g_signal_connect (chooser
, "changed",
503 G_CALLBACK (columns_changed_callback
), chooser
);
504 g_signal_connect (chooser
, "use_default",
505 G_CALLBACK (use_default_callback
), chooser
);
507 set_columns_from_gconf (NAUTILUS_COLUMN_CHOOSER (chooser
));
509 gtk_widget_show (chooser
);
510 box
= glade_xml_get_widget (xml_dialog
, "list_columns_vbox");
512 gtk_box_pack_start (GTK_BOX (box
), chooser
, TRUE
, TRUE
, 0);
516 nautilus_file_management_properties_dialog_update_media_sensitivity (GladeXML
*xml_dialog
)
518 gtk_widget_set_sensitive (glade_xml_get_widget (xml_dialog
, "media_handling_vbox"),
519 ! eel_preferences_get_boolean (NAUTILUS_PREFERENCES_MEDIA_AUTORUN_NEVER
));
523 other_type_combo_box_changed (GtkComboBox
*combo_box
, GtkComboBox
*action_combo_box
)
527 char *x_content_type
;
529 x_content_type
= NULL
;
531 if (!gtk_combo_box_get_active_iter (combo_box
, &iter
)) {
535 model
= gtk_combo_box_get_model (combo_box
);
540 gtk_tree_model_get (model
, &iter
,
544 nautilus_autorun_prepare_combo_box (GTK_WIDGET (action_combo_box
),
550 g_free (x_content_type
);
555 nautilus_file_management_properties_dialog_setup_media_page (GladeXML
*xml_dialog
)
559 GList
*content_types
;
560 GtkWidget
*other_type_combo_box
;
561 GtkListStore
*other_type_list_store
;
562 GtkCellRenderer
*renderer
;
564 const char *s
[] = {"media_audio_cdda_combobox", "x-content/audio-cdda",
565 "media_video_dvd_combobox", "x-content/video-dvd",
566 "media_music_player_combobox", "x-content/audio-player",
567 "media_dcf_combobox", "x-content/image-dcf",
568 "media_software_combobox", "x-content/software",
571 for (n
= 0; s
[n
*2] != NULL
; n
++) {
572 nautilus_autorun_prepare_combo_box (glade_xml_get_widget (xml_dialog
, s
[n
*2]), s
[n
*2 + 1],
573 TRUE
, TRUE
, NULL
, NULL
);
576 other_type_combo_box
= glade_xml_get_widget (xml_dialog
, "media_other_type_combobox");
578 other_type_list_store
= gtk_list_store_new (3,
583 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (other_type_list_store
),
584 1, GTK_SORT_ASCENDING
);
587 content_types
= g_content_types_get_registered ();
589 for (l
= content_types
; l
!= NULL
; l
= l
->next
) {
590 char *content_type
= l
->data
;
593 NautilusIconInfo
*icon_info
;
597 if (!g_str_has_prefix (content_type
, "x-content/"))
599 for (n
= 0; s
[n
*2] != NULL
; n
++) {
600 if (strcmp (content_type
, s
[n
*2 + 1]) == 0) {
605 icon_size
= nautilus_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU
);
607 description
= g_content_type_get_description (content_type
);
608 gtk_list_store_append (other_type_list_store
, &iter
);
609 icon
= g_content_type_get_icon (content_type
);
611 icon_info
= nautilus_icon_info_lookup (icon
, icon_size
);
612 g_object_unref (icon
);
613 pixbuf
= nautilus_icon_info_get_pixbuf_nodefault_at_size (icon_info
, icon_size
);
614 g_object_unref (icon_info
);
619 gtk_list_store_set (other_type_list_store
, &iter
,
625 g_object_unref (pixbuf
);
626 g_free (description
);
630 g_list_foreach (content_types
, (GFunc
) g_free
, NULL
);
631 g_list_free (content_types
);
633 gtk_combo_box_set_model (GTK_COMBO_BOX (other_type_combo_box
), GTK_TREE_MODEL (other_type_list_store
));
635 renderer
= gtk_cell_renderer_pixbuf_new ();
636 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (other_type_combo_box
), renderer
, FALSE
);
637 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (other_type_combo_box
), renderer
,
640 renderer
= gtk_cell_renderer_text_new ();
641 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (other_type_combo_box
), renderer
, TRUE
);
642 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (other_type_combo_box
), renderer
,
646 g_signal_connect (G_OBJECT (other_type_combo_box
),
648 G_CALLBACK (other_type_combo_box_changed
),
649 glade_xml_get_widget (xml_dialog
, "media_other_action_combobox"));
651 gtk_combo_box_set_active (GTK_COMBO_BOX (other_type_combo_box
), 0);
653 nautilus_file_management_properties_dialog_update_media_sensitivity (xml_dialog
);
657 nautilus_file_management_properties_dialog_setup (GladeXML
*xml_dialog
, GtkWindow
*window
)
661 /* setup gconf stuff */
662 eel_gconf_monitor_add ("/apps/nautilus/icon_view");
663 eel_gconf_preload_cache ("/apps/nautilus/icon_view", GCONF_CLIENT_PRELOAD_ONELEVEL
);
664 eel_gconf_monitor_add ("/apps/nautilus/list_view");
665 eel_gconf_preload_cache ("/apps/nautilus/list_view", GCONF_CLIENT_PRELOAD_ONELEVEL
);
666 eel_gconf_monitor_add ("/apps/nautilus/preferences");
667 eel_gconf_preload_cache ("/apps/nautilus/preferences", GCONF_CLIENT_PRELOAD_ONELEVEL
);
668 eel_gconf_monitor_add ("/desktop/gnome/file_views");
669 eel_gconf_preload_cache ("/desktop/gnome/file_views", GCONF_CLIENT_PRELOAD_ONELEVEL
);
672 nautilus_file_management_properties_size_group_create (xml_dialog
,
675 nautilus_file_management_properties_size_group_create (xml_dialog
,
678 nautilus_file_management_properties_size_group_create (xml_dialog
,
681 create_date_format_menu (xml_dialog
);
683 /* setup preferences */
684 eel_preferences_glade_connect_bool (xml_dialog
,
685 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_COMPACT_LAYOUT_WIDGET
,
686 NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT
);
687 eel_preferences_glade_connect_bool (xml_dialog
,
688 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LABELS_BESIDE_ICONS_WIDGET
,
689 NAUTILUS_PREFERENCES_ICON_VIEW_LABELS_BESIDE_ICONS
);
690 eel_preferences_glade_connect_bool (xml_dialog
,
691 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_FOLDERS_FIRST_WIDGET
,
692 NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST
);
693 eel_preferences_glade_connect_bool (xml_dialog
,
694 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_BROWSER_WIDGET
,
695 NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER
);
697 eel_preferences_glade_connect_bool (xml_dialog
,
698 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTOMOUNT_OPEN
,
699 NAUTILUS_PREFERENCES_MEDIA_AUTOMOUNT_OPEN
);
700 eel_preferences_glade_connect_bool (xml_dialog
,
701 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTORUN_NEVER
,
702 NAUTILUS_PREFERENCES_MEDIA_AUTORUN_NEVER
);
704 eel_preferences_glade_connect_bool (xml_dialog
,
705 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_CONFIRM_WIDGET
,
706 NAUTILUS_PREFERENCES_CONFIRM_TRASH
);
707 eel_preferences_glade_connect_bool (xml_dialog
,
708 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_DELETE_WIDGET
,
709 NAUTILUS_PREFERENCES_ENABLE_DELETE
);
710 eel_preferences_glade_connect_bool (xml_dialog
,
711 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET
,
712 NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES
);
713 eel_preferences_glade_connect_bool_slave (xml_dialog
,
714 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET
,
715 NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES
);
716 eel_preferences_glade_connect_bool (xml_dialog
,
717 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TREE_VIEW_FOLDERS_WIDGET
,
718 NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES
);
720 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
721 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_DEFAULT_VIEW_WIDGET
,
722 NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER
,
723 (const char **) default_view_values
);
724 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
725 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ICON_VIEW_ZOOM_WIDGET
,
726 NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL
,
727 (const char **) zoom_values
);
728 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
729 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LIST_VIEW_ZOOM_WIDGET
,
730 NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL
,
731 (const char **) zoom_values
);
732 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
733 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET
,
734 NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER
,
735 (const char **) sort_order_values
);
736 eel_preferences_glade_connect_string_enum_combo_box_slave (xml_dialog
,
737 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET
,
738 NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER
);
739 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
740 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_TEXT_WIDGET
,
741 NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS
,
742 (const char **) preview_values
);
743 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
744 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_IMAGE_WIDGET
,
745 NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS
,
746 (const char **) preview_values
);
747 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
748 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_SOUND_WIDGET
,
749 NAUTILUS_PREFERENCES_PREVIEW_SOUND
,
750 (const char **) preview_values
);
751 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
752 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FOLDER_WIDGET
,
753 NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS
,
754 (const char **) preview_values
);
755 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
756 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_DATE_FORMAT_WIDGET
,
757 NAUTILUS_PREFERENCES_DATE_FORMAT
,
758 (const char **) date_format_values
);
760 eel_preferences_glade_connect_string_enum_radio_button (xml_dialog
,
761 (const char **) click_behavior_components
,
762 NAUTILUS_PREFERENCES_CLICK_POLICY
,
763 (const char **) click_behavior_values
);
764 eel_preferences_glade_connect_string_enum_radio_button (xml_dialog
,
765 (const char **) executable_text_components
,
766 NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION
,
767 (const char **) executable_text_values
);
769 eel_preferences_glade_connect_int_enum (xml_dialog
,
770 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_THUMBNAIL_LIMIT_WIDGET
,
771 NAUTILUS_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT
,
772 (const int *) thumbnail_limit_values
);
775 nautilus_file_management_properties_dialog_setup_icon_caption_page (xml_dialog
);
776 nautilus_file_management_properties_dialog_setup_list_column_page (xml_dialog
);
777 nautilus_file_management_properties_dialog_setup_media_page (xml_dialog
);
779 eel_preferences_add_callback (NAUTILUS_PREFERENCES_MEDIA_AUTORUN_NEVER
,
780 (EelPreferencesCallback
) nautilus_file_management_properties_dialog_update_media_sensitivity
,
781 g_object_ref (xml_dialog
));
785 dialog
= glade_xml_get_widget (xml_dialog
, "file_management_dialog");
786 g_signal_connect_data (G_OBJECT (dialog
), "response",
787 G_CALLBACK (nautilus_file_management_properties_dialog_response_cb
),
788 g_object_ref (xml_dialog
),
789 (GClosureNotify
)g_object_unref
,
792 gtk_window_set_icon_name (GTK_WINDOW (dialog
), "file-manager");
795 gtk_window_set_screen (GTK_WINDOW (dialog
), gtk_window_get_screen(window
));
798 gtk_widget_show (dialog
);
802 delete_event_callback (GtkWidget
*widget
,
806 void (*response_callback
) (GtkDialog
*dialog
,
809 response_callback
= data
;
811 response_callback (GTK_DIALOG (widget
), GTK_RESPONSE_CLOSE
);
817 nautilus_file_management_properties_dialog_show (GCallback close_callback
, GtkWindow
*window
)
819 GladeXML
*xml_dialog
;
821 xml_dialog
= glade_xml_new (GLADEDIR
"/nautilus-file-management-properties.glade",
824 g_signal_connect (G_OBJECT (glade_xml_get_widget (xml_dialog
, "file_management_dialog")),
825 "response", close_callback
, NULL
);
826 g_signal_connect (G_OBJECT (glade_xml_get_widget (xml_dialog
, "file_management_dialog")),
827 "delete_event", G_CALLBACK (delete_event_callback
), close_callback
);
829 nautilus_file_management_properties_dialog_setup (xml_dialog
, window
);
831 g_object_unref (xml_dialog
);