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_COMPACT_VIEW_ZOOM_WIDGET "compact_view_zoom_combobox"
54 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LIST_VIEW_ZOOM_WIDGET "list_view_zoom_combobox"
55 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET "sort_order_combobox"
56 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_DATE_FORMAT_WIDGET "date_format_combobox"
57 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_TEXT_WIDGET "preview_text_combobox"
58 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_IMAGE_WIDGET "preview_image_combobox"
59 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_SOUND_WIDGET "preview_sound_combobox"
60 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FOLDER_WIDGET "preview_folder_combobox"
62 /* bool preferences */
63 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_FOLDERS_FIRST_WIDGET "sort_folders_first_checkbutton"
64 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_COMPACT_LAYOUT_WIDGET "compact_layout_checkbutton"
65 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LABELS_BESIDE_ICONS_WIDGET "labels_beside_icons_checkbutton"
66 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ALL_COLUMNS_SAME_WIDTH "all_columns_same_width_checkbutton"
67 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_BROWSER_WIDGET "always_use_browser_checkbutton"
68 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_LOCATION_ENTRY_WIDGET "always_use_location_entry_checkbutton"
69 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_CONFIRM_WIDGET "trash_confirm_checkbutton"
70 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_DELETE_WIDGET "trash_delete_checkbutton"
71 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_OPEN_NEW_WINDOW_WIDGET "new_window_checkbutton"
72 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET "hidden_files_checkbutton"
73 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TREE_VIEW_FOLDERS_WIDGET "treeview_folders_checkbutton"
74 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTOMOUNT_OPEN "media_automount_open_checkbutton"
75 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTORUN_NEVER "media_autorun_never_checkbutton"
78 #define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_THUMBNAIL_LIMIT_WIDGET "preview_image_size_combobox"
80 static const char * const default_view_values
[] = {
87 static const char * const zoom_values
[] = {
98 static const char * const sort_order_values
[] = {
107 static const char * const date_format_values
[] = {
114 static const char * const preview_values
[] = {
121 static const char * const click_behavior_components
[] = {
122 "single_click_radiobutton",
123 "double_click_radiobutton",
127 static const char * const click_behavior_values
[] = {
133 static const char * const executable_text_components
[] = {
134 "scripts_execute_radiobutton",
135 "scripts_view_radiobutton",
136 "scripts_confirm_radiobutton",
140 static const char * const executable_text_values
[] = {
147 static const int thumbnail_limit_values
[] = {
159 static const char * const icon_captions_components
[] = {
160 "captions_0_combobox",
161 "captions_1_combobox",
162 "captions_2_combobox",
167 nautilus_file_management_properties_size_group_create (GladeXML
*xml_dialog
,
171 GtkSizeGroup
*size_group
;
175 size_group
= gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL
);
177 for (i
= 0; i
< items
; i
++) {
178 item_name
= g_strdup_printf ("%s_%d", prefix
, i
);
179 gtk_size_group_add_widget (size_group
,
180 glade_xml_get_widget (xml_dialog
, item_name
));
183 g_object_unref (G_OBJECT (size_group
));
187 preferences_show_help (GtkWindow
*parent
,
188 char const *helpfile
,
191 GError
*error
= NULL
;
194 g_assert (helpfile
!= NULL
);
195 g_assert (sect_id
!= NULL
);
197 gnome_help_display_desktop (NULL
,
199 helpfile
, sect_id
, &error
);
202 dialog
= gtk_message_dialog_new (GTK_WINDOW (parent
),
203 GTK_DIALOG_DESTROY_WITH_PARENT
,
206 _("There was an error displaying help: \n%s"),
209 g_signal_connect (G_OBJECT (dialog
),
210 "response", G_CALLBACK (gtk_widget_destroy
),
212 gtk_window_set_resizable (GTK_WINDOW (dialog
), FALSE
);
213 gtk_widget_show (dialog
);
214 g_error_free (error
);
220 nautilus_file_management_properties_dialog_response_cb (GtkDialog
*parent
,
222 GladeXML
*xml_dialog
)
226 if (response_id
== GTK_RESPONSE_HELP
) {
227 switch (gtk_notebook_get_current_page (GTK_NOTEBOOK (glade_xml_get_widget (xml_dialog
, "notebook1")))) {
230 section
= "gosnautilus-438";
233 section
= "gosnautilus-56";
236 section
= "gosnautilus-439";
239 section
= "gosnautilus-490";
242 section
= "gosnautilus-60";
244 preferences_show_help (GTK_WINDOW (parent
), "user-guide.xml", section
);
245 } else if (response_id
== GTK_RESPONSE_CLOSE
) {
246 /* remove gconf monitors */
247 eel_gconf_monitor_remove ("/apps/nautilus/icon_view");
248 eel_gconf_monitor_remove ("/apps/nautilus/list_view");
249 eel_gconf_monitor_remove ("/apps/nautilus/preferences");
250 eel_gconf_monitor_remove ("/desktop/gnome/file_views");
255 columns_changed_callback (NautilusColumnChooser
*chooser
,
256 gpointer callback_data
)
258 char **visible_columns
;
261 nautilus_column_chooser_get_settings (NAUTILUS_COLUMN_CHOOSER (chooser
),
265 eel_preferences_set_string_array (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS
, visible_columns
);
266 eel_preferences_set_string_array (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER
, column_order
);
268 g_strfreev (visible_columns
);
269 g_strfreev (column_order
);
273 free_column_names_array (GPtrArray
*column_names
)
275 g_ptr_array_foreach (column_names
, (GFunc
) g_free
, NULL
);
276 g_ptr_array_free (column_names
, TRUE
);
280 create_icon_caption_combo_box_items (GtkComboBox
*combo_box
,
284 GPtrArray
*column_names
;
286 column_names
= g_ptr_array_new ();
288 gtk_combo_box_append_text (combo_box
, _("None"));
289 g_ptr_array_add (column_names
, g_strdup ("none"));
291 for (l
= columns
; l
!= NULL
; l
= l
->next
) {
292 NautilusColumn
*column
;
296 column
= NAUTILUS_COLUMN (l
->data
);
298 g_object_get (G_OBJECT (column
),
299 "name", &name
, "label", &label
,
302 /* Don't show name here, it doesn't make sense */
303 if (!strcmp (name
, "name")) {
309 gtk_combo_box_append_text (combo_box
, label
);
310 g_ptr_array_add (column_names
, name
);
314 g_object_set_data_full (G_OBJECT (combo_box
), "column_names",
316 (GDestroyNotify
) free_column_names_array
);
320 icon_captions_changed_callback (GtkComboBox
*combo_box
,
327 xml
= GLADE_XML (user_data
);
329 captions
= g_ptr_array_new ();
331 for (i
= 0; icon_captions_components
[i
] != NULL
; i
++) {
332 GtkWidget
*combo_box
;
334 GPtrArray
*column_names
;
337 combo_box
= glade_xml_get_widget
338 (GLADE_XML (xml
), icon_captions_components
[i
]);
339 active
= gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box
));
341 column_names
= g_object_get_data (G_OBJECT (combo_box
),
344 name
= g_ptr_array_index (column_names
, active
);
345 g_ptr_array_add (captions
, name
);
347 g_ptr_array_add (captions
, NULL
);
349 eel_preferences_set_string_array (NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS
,
350 (char **)captions
->pdata
);
351 g_ptr_array_free (captions
, TRUE
);
355 update_caption_combo_box (GladeXML
*xml
,
356 const char *combo_box_name
,
359 GtkWidget
*combo_box
;
361 GPtrArray
*column_names
;
363 combo_box
= glade_xml_get_widget (xml
, combo_box_name
);
365 g_signal_handlers_block_by_func
367 G_CALLBACK (icon_captions_changed_callback
),
370 column_names
= g_object_get_data (G_OBJECT (combo_box
),
373 for (i
= 0; i
< column_names
->len
; ++i
) {
374 if (!strcmp (name
, g_ptr_array_index (column_names
, i
))) {
375 gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box
), i
);
380 g_signal_handlers_unblock_by_func
382 G_CALLBACK (icon_captions_changed_callback
),
387 update_icon_captions_from_gconf (GladeXML
*xml
)
392 captions
= eel_preferences_get_string_array (NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS
);
393 if (captions
== NULL
)
397 icon_captions_components
[i
] != NULL
;
408 update_caption_combo_box (xml
,
409 icon_captions_components
[i
],
413 g_strfreev (captions
);
417 nautilus_file_management_properties_dialog_setup_icon_caption_page (GladeXML
*xml_dialog
)
423 writable
= eel_preferences_key_is_writable (NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS
);
425 columns
= nautilus_get_all_columns ();
427 for (i
= 0; icon_captions_components
[i
] != NULL
; i
++) {
428 GtkWidget
*combo_box
;
430 combo_box
= glade_xml_get_widget (xml_dialog
,
431 icon_captions_components
[i
]);
433 create_icon_caption_combo_box_items (GTK_COMBO_BOX (combo_box
), columns
);
434 gtk_widget_set_sensitive (combo_box
, writable
);
436 g_signal_connect (combo_box
, "changed",
437 G_CALLBACK (icon_captions_changed_callback
),
441 nautilus_column_list_free (columns
);
443 update_icon_captions_from_gconf (xml_dialog
);
447 create_date_format_menu (GladeXML
*xml_dialog
)
449 GtkWidget
*combo_box
;
453 combo_box
= glade_xml_get_widget (xml_dialog
,
454 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_DATE_FORMAT_WIDGET
);
456 now_raw
= time (NULL
);
457 now
= localtime (&now_raw
);
459 date_string
= eel_strdup_strftime ("%c", now
);
460 gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box
), date_string
);
461 g_free (date_string
);
463 date_string
= eel_strdup_strftime ("%Y-%m-%d %H:%M:%S", now
);
464 gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box
), date_string
);
465 g_free (date_string
);
467 date_string
= eel_strdup_strftime (_("today at %-I:%M:%S %p"), now
);
468 gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box
), date_string
);
469 g_free (date_string
);
473 set_columns_from_gconf (NautilusColumnChooser
*chooser
)
475 char **visible_columns
;
478 visible_columns
= eel_preferences_get_string_array (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS
);
479 column_order
= eel_preferences_get_string_array (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER
);
481 nautilus_column_chooser_set_settings (NAUTILUS_COLUMN_CHOOSER (chooser
),
485 g_strfreev (visible_columns
);
486 g_strfreev (column_order
);
490 use_default_callback (NautilusColumnChooser
*chooser
,
493 eel_preferences_unset (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS
);
494 eel_preferences_unset (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER
);
495 set_columns_from_gconf (chooser
);
499 nautilus_file_management_properties_dialog_setup_list_column_page (GladeXML
*xml_dialog
)
504 chooser
= nautilus_column_chooser_new ();
505 g_signal_connect (chooser
, "changed",
506 G_CALLBACK (columns_changed_callback
), chooser
);
507 g_signal_connect (chooser
, "use_default",
508 G_CALLBACK (use_default_callback
), chooser
);
510 set_columns_from_gconf (NAUTILUS_COLUMN_CHOOSER (chooser
));
512 gtk_widget_show (chooser
);
513 box
= glade_xml_get_widget (xml_dialog
, "list_columns_vbox");
515 gtk_box_pack_start (GTK_BOX (box
), chooser
, TRUE
, TRUE
, 0);
519 nautilus_file_management_properties_dialog_update_media_sensitivity (GladeXML
*xml_dialog
)
521 gtk_widget_set_sensitive (glade_xml_get_widget (xml_dialog
, "media_handling_vbox"),
522 ! eel_preferences_get_boolean (NAUTILUS_PREFERENCES_MEDIA_AUTORUN_NEVER
));
526 other_type_combo_box_changed (GtkComboBox
*combo_box
, GtkComboBox
*action_combo_box
)
530 char *x_content_type
;
532 x_content_type
= NULL
;
534 if (!gtk_combo_box_get_active_iter (combo_box
, &iter
)) {
538 model
= gtk_combo_box_get_model (combo_box
);
543 gtk_tree_model_get (model
, &iter
,
547 nautilus_autorun_prepare_combo_box (GTK_WIDGET (action_combo_box
),
553 g_free (x_content_type
);
558 nautilus_file_management_properties_dialog_setup_media_page (GladeXML
*xml_dialog
)
562 GList
*content_types
;
563 GtkWidget
*other_type_combo_box
;
564 GtkListStore
*other_type_list_store
;
565 GtkCellRenderer
*renderer
;
567 const char *s
[] = {"media_audio_cdda_combobox", "x-content/audio-cdda",
568 "media_video_dvd_combobox", "x-content/video-dvd",
569 "media_music_player_combobox", "x-content/audio-player",
570 "media_dcf_combobox", "x-content/image-dcf",
571 "media_software_combobox", "x-content/software",
574 for (n
= 0; s
[n
*2] != NULL
; n
++) {
575 nautilus_autorun_prepare_combo_box (glade_xml_get_widget (xml_dialog
, s
[n
*2]), s
[n
*2 + 1],
576 TRUE
, TRUE
, NULL
, NULL
);
579 other_type_combo_box
= glade_xml_get_widget (xml_dialog
, "media_other_type_combobox");
581 other_type_list_store
= gtk_list_store_new (3,
586 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (other_type_list_store
),
587 1, GTK_SORT_ASCENDING
);
590 content_types
= g_content_types_get_registered ();
592 for (l
= content_types
; l
!= NULL
; l
= l
->next
) {
593 char *content_type
= l
->data
;
596 NautilusIconInfo
*icon_info
;
600 if (!g_str_has_prefix (content_type
, "x-content/"))
602 for (n
= 0; s
[n
*2] != NULL
; n
++) {
603 if (strcmp (content_type
, s
[n
*2 + 1]) == 0) {
608 icon_size
= nautilus_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU
);
610 description
= g_content_type_get_description (content_type
);
611 gtk_list_store_append (other_type_list_store
, &iter
);
612 icon
= g_content_type_get_icon (content_type
);
614 icon_info
= nautilus_icon_info_lookup (icon
, icon_size
);
615 g_object_unref (icon
);
616 pixbuf
= nautilus_icon_info_get_pixbuf_nodefault_at_size (icon_info
, icon_size
);
617 g_object_unref (icon_info
);
622 gtk_list_store_set (other_type_list_store
, &iter
,
628 g_object_unref (pixbuf
);
629 g_free (description
);
633 g_list_foreach (content_types
, (GFunc
) g_free
, NULL
);
634 g_list_free (content_types
);
636 gtk_combo_box_set_model (GTK_COMBO_BOX (other_type_combo_box
), GTK_TREE_MODEL (other_type_list_store
));
638 renderer
= gtk_cell_renderer_pixbuf_new ();
639 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (other_type_combo_box
), renderer
, FALSE
);
640 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (other_type_combo_box
), renderer
,
643 renderer
= gtk_cell_renderer_text_new ();
644 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (other_type_combo_box
), renderer
, TRUE
);
645 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (other_type_combo_box
), renderer
,
649 g_signal_connect (G_OBJECT (other_type_combo_box
),
651 G_CALLBACK (other_type_combo_box_changed
),
652 glade_xml_get_widget (xml_dialog
, "media_other_action_combobox"));
654 gtk_combo_box_set_active (GTK_COMBO_BOX (other_type_combo_box
), 0);
656 nautilus_file_management_properties_dialog_update_media_sensitivity (xml_dialog
);
660 nautilus_file_management_properties_dialog_setup (GladeXML
*xml_dialog
, GtkWindow
*window
)
664 /* setup gconf stuff */
665 eel_gconf_monitor_add ("/apps/nautilus/icon_view");
666 eel_gconf_preload_cache ("/apps/nautilus/icon_view", GCONF_CLIENT_PRELOAD_ONELEVEL
);
667 eel_gconf_monitor_add ("/apps/nautilus/compact_view");
668 eel_gconf_preload_cache ("/apps/nautilus/compact_view", GCONF_CLIENT_PRELOAD_ONELEVEL
);
669 eel_gconf_monitor_add ("/apps/nautilus/list_view");
670 eel_gconf_preload_cache ("/apps/nautilus/list_view", GCONF_CLIENT_PRELOAD_ONELEVEL
);
671 eel_gconf_monitor_add ("/apps/nautilus/preferences");
672 eel_gconf_preload_cache ("/apps/nautilus/preferences", GCONF_CLIENT_PRELOAD_ONELEVEL
);
673 eel_gconf_monitor_add ("/desktop/gnome/file_views");
674 eel_gconf_preload_cache ("/desktop/gnome/file_views", GCONF_CLIENT_PRELOAD_ONELEVEL
);
677 nautilus_file_management_properties_size_group_create (xml_dialog
,
680 nautilus_file_management_properties_size_group_create (xml_dialog
,
683 nautilus_file_management_properties_size_group_create (xml_dialog
,
686 create_date_format_menu (xml_dialog
);
688 /* setup preferences */
689 eel_preferences_glade_connect_bool (xml_dialog
,
690 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_COMPACT_LAYOUT_WIDGET
,
691 NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT
);
692 eel_preferences_glade_connect_bool (xml_dialog
,
693 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LABELS_BESIDE_ICONS_WIDGET
,
694 NAUTILUS_PREFERENCES_ICON_VIEW_LABELS_BESIDE_ICONS
);
695 eel_preferences_glade_connect_bool (xml_dialog
,
696 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ALL_COLUMNS_SAME_WIDTH
,
697 NAUTILUS_PREFERENCES_COMPACT_VIEW_ALL_COLUMNS_SAME_WIDTH
);
698 eel_preferences_glade_connect_bool (xml_dialog
,
699 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_FOLDERS_FIRST_WIDGET
,
700 NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST
);
701 eel_preferences_glade_connect_bool (xml_dialog
,
702 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_BROWSER_WIDGET
,
703 NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER
);
705 eel_preferences_glade_connect_bool (xml_dialog
,
706 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTOMOUNT_OPEN
,
707 NAUTILUS_PREFERENCES_MEDIA_AUTOMOUNT_OPEN
);
708 eel_preferences_glade_connect_bool (xml_dialog
,
709 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTORUN_NEVER
,
710 NAUTILUS_PREFERENCES_MEDIA_AUTORUN_NEVER
);
712 eel_preferences_glade_connect_bool (xml_dialog
,
713 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_CONFIRM_WIDGET
,
714 NAUTILUS_PREFERENCES_CONFIRM_TRASH
);
715 eel_preferences_glade_connect_bool (xml_dialog
,
716 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_DELETE_WIDGET
,
717 NAUTILUS_PREFERENCES_ENABLE_DELETE
);
718 eel_preferences_glade_connect_bool (xml_dialog
,
719 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET
,
720 NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES
);
721 eel_preferences_glade_connect_bool_slave (xml_dialog
,
722 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET
,
723 NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES
);
724 eel_preferences_glade_connect_bool (xml_dialog
,
725 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TREE_VIEW_FOLDERS_WIDGET
,
726 NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES
);
728 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
729 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_DEFAULT_VIEW_WIDGET
,
730 NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER
,
731 (const char **) default_view_values
);
732 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
733 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ICON_VIEW_ZOOM_WIDGET
,
734 NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL
,
735 (const char **) zoom_values
);
736 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
737 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_COMPACT_VIEW_ZOOM_WIDGET
,
738 NAUTILUS_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL
,
739 (const char **) zoom_values
);
740 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
741 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LIST_VIEW_ZOOM_WIDGET
,
742 NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL
,
743 (const char **) zoom_values
);
744 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
745 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET
,
746 NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER
,
747 (const char **) sort_order_values
);
748 eel_preferences_glade_connect_string_enum_combo_box_slave (xml_dialog
,
749 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET
,
750 NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER
);
751 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
752 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_TEXT_WIDGET
,
753 NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS
,
754 (const char **) preview_values
);
755 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
756 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_IMAGE_WIDGET
,
757 NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS
,
758 (const char **) preview_values
);
759 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
760 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_SOUND_WIDGET
,
761 NAUTILUS_PREFERENCES_PREVIEW_SOUND
,
762 (const char **) preview_values
);
763 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
764 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FOLDER_WIDGET
,
765 NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS
,
766 (const char **) preview_values
);
767 eel_preferences_glade_connect_string_enum_combo_box (xml_dialog
,
768 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_DATE_FORMAT_WIDGET
,
769 NAUTILUS_PREFERENCES_DATE_FORMAT
,
770 (const char **) date_format_values
);
772 eel_preferences_glade_connect_string_enum_radio_button (xml_dialog
,
773 (const char **) click_behavior_components
,
774 NAUTILUS_PREFERENCES_CLICK_POLICY
,
775 (const char **) click_behavior_values
);
776 eel_preferences_glade_connect_string_enum_radio_button (xml_dialog
,
777 (const char **) executable_text_components
,
778 NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION
,
779 (const char **) executable_text_values
);
781 eel_preferences_glade_connect_int_enum (xml_dialog
,
782 NAUTILUS_FILE_MANAGEMENT_PROPERTIES_THUMBNAIL_LIMIT_WIDGET
,
783 NAUTILUS_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT
,
784 (const int *) thumbnail_limit_values
);
787 nautilus_file_management_properties_dialog_setup_icon_caption_page (xml_dialog
);
788 nautilus_file_management_properties_dialog_setup_list_column_page (xml_dialog
);
789 nautilus_file_management_properties_dialog_setup_media_page (xml_dialog
);
791 eel_preferences_add_callback (NAUTILUS_PREFERENCES_MEDIA_AUTORUN_NEVER
,
792 (EelPreferencesCallback
) nautilus_file_management_properties_dialog_update_media_sensitivity
,
793 g_object_ref (xml_dialog
));
797 dialog
= glade_xml_get_widget (xml_dialog
, "file_management_dialog");
798 g_signal_connect_data (G_OBJECT (dialog
), "response",
799 G_CALLBACK (nautilus_file_management_properties_dialog_response_cb
),
800 g_object_ref (xml_dialog
),
801 (GClosureNotify
)g_object_unref
,
804 gtk_window_set_icon_name (GTK_WINDOW (dialog
), "file-manager");
807 gtk_window_set_screen (GTK_WINDOW (dialog
), gtk_window_get_screen(window
));
810 gtk_widget_show (dialog
);
814 delete_event_callback (GtkWidget
*widget
,
818 void (*response_callback
) (GtkDialog
*dialog
,
821 response_callback
= data
;
823 response_callback (GTK_DIALOG (widget
), GTK_RESPONSE_CLOSE
);
829 nautilus_file_management_properties_dialog_show (GCallback close_callback
, GtkWindow
*window
)
831 GladeXML
*xml_dialog
;
833 xml_dialog
= glade_xml_new (GLADEDIR
"/nautilus-file-management-properties.glade",
836 g_signal_connect (G_OBJECT (glade_xml_get_widget (xml_dialog
, "file_management_dialog")),
837 "response", close_callback
, NULL
);
838 g_signal_connect (G_OBJECT (glade_xml_get_widget (xml_dialog
, "file_management_dialog")),
839 "delete_event", G_CALLBACK (delete_event_callback
), close_callback
);
841 nautilus_file_management_properties_dialog_setup (xml_dialog
, window
);
843 g_object_unref (xml_dialog
);