return result;
}
#endif
+
static gchar*
-get_dvd_volume_name(GDrive *gd)
+get_dvd_volume_name(gpointer gd)
{
gchar *label = NULL;
gchar *result;
gchar *drive;
drive = get_dvd_device_name(gd);
- if (g_drive_has_media (gd))
+ g_mutex_lock(volname_mutex);
+ label = g_strdup(g_hash_table_lookup(volname_hash, drive));
+ g_mutex_unlock(volname_mutex);
+ if (label != NULL)
{
- g_mutex_lock(volname_mutex);
- label = g_strdup(g_hash_table_lookup(volname_hash, drive));
- g_mutex_unlock(volname_mutex);
- if (label != NULL)
+ if (uppers_and_unders(label))
{
- if (uppers_and_unders(label))
- {
- camel_convert(label);
- }
+ camel_convert(label);
+ }
#if defined(_WIN32)
- result = g_strdup_printf("%s (%s)", label, drive);
+ result = g_strdup_printf("%s (%s)", label, drive);
#else
- result = g_strdup_printf("%s - %s", drive, label);
+ result = g_strdup_printf("%s - %s", drive, label);
#endif
- g_free(label);
- }
- else
- {
- result = g_strdup_printf("%s", drive);
- }
+ g_free(label);
}
else
{
free_volname_key, free_volname_value);
}
+static void
+free_drive(gpointer drive)
+{
+#if defined(_WIN32)
+ g_free(drive);
+#else
+ g_object_unref(drive);
+#endif
+}
+
gpointer
ghb_cache_volnames(signal_user_data_t *ud)
{
g_hash_table_remove_all(volname_hash);
while (link != NULL)
{
- gchar *drive = get_dvd_device_name(link->data);
- gchar *name = get_direct_dvd_volume_name(drive);
+ gchar *name, *drive;
+
+#if !defined(_WIN32)
+ if (!g_drive_has_media (link->data))
+ {
+ g_object_unref(link->data);
+ link = link->next;
+ continue;
+ }
+#endif
+ drive = get_dvd_device_name(link->data);
+ name = get_direct_dvd_volume_name(drive);
+
if (drive != NULL && name != NULL)
{
g_hash_table_insert(volname_hash, drive, name);
g_free(name);
}
- g_object_unref(link->data);
+ free_drive(link->data);
link = link->next;
}
g_mutex_unlock(volname_mutex);
gchar *name = get_dvd_device_name(link->data);
gtk_combo_box_append_text(combo, name);
g_free(name);
- g_object_unref(link->data);
+ free_drive(link->data);
link = link->next;
}
g_list_free(drives);
static GtkActionGroup *agroup = NULL;
static gint merge_id;
- g_debug("ghb_file_menu_add_dvd()\n");
+ g_debug("ghb_file_menu_add_dvd()");
link = drives = dvd_device_list();
if (drives != NULL)
{
(GCallback)dvd_source_activate_cb, ud);
g_free(name);
g_free(drive);
- g_object_unref(link->data);
+ free_drive(link->data);
link = link->next;
}
g_list_free(drives);
ins_count++;
if (ins_count == 2)
{
- ghb_file_menu_add_dvd(ud);
+ g_thread_create((GThreadFunc)ghb_cache_volnames, ud, FALSE, NULL);
if (ud->current_dvd_device != NULL &&
strcmp(device, ud->current_dvd_device) == 0)
{
rem_count++;
if (rem_count == 2)
{
- ghb_file_menu_add_dvd(ud);
+ g_thread_create((GThreadFunc)ghb_cache_volnames, ud, FALSE, NULL);
if (ud->current_dvd_device != NULL &&
strcmp(device, ud->current_dvd_device) == 0)
{
gtk_widget_set_size_request(html, 420, 240);
gtk_widget_show(html);
}
+ webkit_web_view_open(WEBKIT_WEB_VIEW(html), description);
#endif
dialog = GHB_WIDGET(ud->builder, "update_dialog");
- webkit_web_view_open(WEBKIT_WEB_VIEW(html), description);
response = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_hide(dialog);
if (response == GTK_RESPONSE_OK)