Skip to content

Commit 12081f4

Browse files
authored
Add option to disable or enable content type detection of mounted media. (#2913)
1 parent c271a6b commit 12081f4

File tree

5 files changed

+37
-7
lines changed

5 files changed

+37
-7
lines changed

gresources/nemo-file-management-properties.glade

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,22 @@ along with . If not, see <http://www.gnu.org/licenses/>.
14941494
<property name="position">3</property>
14951495
</packing>
14961496
</child>
1497+
<child>
1498+
<object class="GtkCheckButton" id="media_detect_content_checkbutton">
1499+
<property name="label" translatable="yes">Detect content of media and suggest application to open</property>
1500+
<property name="visible">True</property>
1501+
<property name="can_focus">True</property>
1502+
<property name="receives_default">False</property>
1503+
<property name="use_underline">True</property>
1504+
<property name="xalign">0</property>
1505+
<property name="draw_indicator">True</property>
1506+
</object>
1507+
<packing>
1508+
<property name="expand">False</property>
1509+
<property name="fill">False</property>
1510+
<property name="position">4</property>
1511+
</packing>
1512+
</child>
14971513
</object>
14981514
</child>
14991515
</object>

libnemo-private/nemo-global-preferences.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,10 @@ typedef enum
226226

227227
/* media handling */
228228

229-
#define GNOME_DESKTOP_MEDIA_HANDLING_AUTOMOUNT "automount"
230-
#define GNOME_DESKTOP_MEDIA_HANDLING_AUTOMOUNT_OPEN "automount-open"
231-
#define GNOME_DESKTOP_MEDIA_HANDLING_AUTORUN "autorun-never"
229+
#define GNOME_DESKTOP_MEDIA_HANDLING_AUTOMOUNT "automount"
230+
#define GNOME_DESKTOP_MEDIA_HANDLING_AUTOMOUNT_OPEN "automount-open"
231+
#define GNOME_DESKTOP_MEDIA_HANDLING_AUTORUN "autorun-never"
232+
#define NEMO_PREFERENCES_MEDIA_HANDLING_DETECT_CONTENT "detect-content"
232233

233234
/* Terminal */
234235
#define GNOME_DESKTOP_TERMINAL_EXEC "exec"

libnemo-private/org.nemo.gschema.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,10 @@
415415
<default>false</default>
416416
<summary>Suppress any safeguards when running nemo/nemo-desktop as the root user. For some systems there is only a root user.</summary>
417417
</key>
418+
<key name="detect-content" type="b">
419+
<default>true</default>
420+
<summary>If true, enable detection of the type of content of a mounted media and display a suggested application to open the media.</summary>
421+
</key>
418422
</schema>
419423

420424
<schema id="org.nemo.icon-view" path="/org/nemo/icon-view/" gettext-domain="nemo">

src/nemo-file-management-properties.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
#define NEMO_FILE_MANAGEMENT_PROPERTIES_AUTOMOUNT_MEDIA_WIDGET "media_automount_checkbutton"
9292
#define NEMO_FILE_MANAGEMENT_PROPERTIES_AUTOOPEN_MEDIA_WIDGET "media_autoopen_checkbutton"
9393
#define NEMO_FILE_MANAGEMENT_PROPERTIES_AUTORUN_MEDIA_WIDGET "media_autorun_checkbutton"
94+
#define NEMO_FILE_MANAGEMENT_PROPERTIES_DETECT_CONTENT_MEDIA_WIDGET "media_detect_content_checkbutton"
9495
#define NEMO_FILE_MANAGEMENT_PROPERTIES_SHOW_ADVANCED_PERMISSIONS_WIDGET "show_advanced_permissions_checkbutton"
9596
#define NEMO_FILE_MANAGEMENT_PROPERTIES_START_WITH_DUAL_PANE_WIDGET "start_with_dual_pane_checkbutton"
9697
#define NEMO_FILE_MANAGEMENT_PROPERTIES_IGNORE_VIEW_METADATA_WIDGET "ignore_view_metadata_checkbutton"
@@ -997,6 +998,10 @@ nemo_file_management_properties_dialog_setup (GtkBuilder *builder,
997998
NEMO_FILE_MANAGEMENT_PROPERTIES_AUTORUN_MEDIA_WIDGET,
998999
GNOME_DESKTOP_MEDIA_HANDLING_AUTORUN);
9991000

1001+
bind_builder_bool (builder, nemo_preferences,
1002+
NEMO_FILE_MANAGEMENT_PROPERTIES_DETECT_CONTENT_MEDIA_WIDGET,
1003+
NEMO_PREFERENCES_MEDIA_HANDLING_DETECT_CONTENT);
1004+
10001005
bind_builder_bool (builder, nemo_preferences,
10011006
NEMO_FILE_MANAGEMENT_PROPERTIES_CLOSE_DEVICE_VIEW_ON_EJECT_WIDGET,
10021007
NEMO_PREFERENCES_CLOSE_DEVICE_VIEW_ON_EJECT);

src/nemo-window-manage-views.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,10 +1439,14 @@ found_mount_cb (GObject *source_object,
14391439
NULL);
14401440
if (mount != NULL) {
14411441
data->mount = mount;
1442-
nemo_get_x_content_types_for_mount_async (mount,
1443-
found_content_type_cb,
1444-
data->cancellable,
1445-
data);
1442+
1443+
if (g_settings_get_boolean (nemo_preferences, NEMO_PREFERENCES_MEDIA_HANDLING_DETECT_CONTENT)) {
1444+
nemo_get_x_content_types_for_mount_async (mount,
1445+
found_content_type_cb,
1446+
data->cancellable,
1447+
data);
1448+
}
1449+
14461450
return;
14471451
}
14481452

0 commit comments

Comments
 (0)