MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / ghb_dvd_set_current

Function ghb_dvd_set_current

gtk/src/hb-dvd.c:343–396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341}
342
343void
344ghb_dvd_set_current(const gchar *name, signal_user_data_t *ud)
345{
346#if !defined(_WIN32)
347 GFile *gfile;
348 GFileInfo *info;
349 gchar *resolved = ghb_resolve_symlink(name);
350
351 if (ud->current_dvd_device != NULL)
352 {
353 g_free(ud->current_dvd_device);
354 ud->current_dvd_device = NULL;
355 }
356 gfile = g_file_new_for_path(resolved);
357 info = g_file_query_info(gfile,
358 G_FILE_ATTRIBUTE_STANDARD_TYPE,
359 G_FILE_QUERY_INFO_NONE, NULL, NULL);
360 if (info != NULL)
361 {
362 if (g_file_info_get_file_type(info) == G_FILE_TYPE_SPECIAL)
363 {
364 // I could go through the trouble to scan the connected drives and
365 // verify that this device is connected and is a DVD. But I don't
366 // think its necessary.
367 ud->current_dvd_device = resolved;
368 }
369 else
370 {
371 g_free(resolved);
372 }
373 g_object_unref(info);
374 }
375 else
376 {
377 g_free(resolved);
378 }
379 g_object_unref(gfile);
380#else
381 gchar drive[4];
382 guint dtype;
383
384 if (ud->current_dvd_device != NULL)
385 {
386 g_free(ud->current_dvd_device);
387 ud->current_dvd_device = NULL;
388 }
389 g_strlcpy(drive, name, 4);
390 dtype = GetDriveType(drive);
391 if (dtype == DRIVE_CDROM)
392 {
393 ud->current_dvd_device = g_strdup(name);
394 }
395#endif
396}

Callers 4

video_file_drop_receivedFunction · 0.85
ghb_application_activateFunction · 0.85
source_dialog_start_scanFunction · 0.85
dvd_source_activate_cbFunction · 0.85

Calls 1

ghb_resolve_symlinkFunction · 0.85

Tested by

no test coverage detected