X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=gtk%2Fsrc%2Fcallbacks.c;h=8fd2b7a94ed02a5ea4ae324d2928089996350fec;hb=5f753d54ac498a7d363f82ee1203b182ec4bb310;hp=da6039ce68c9c38da678c51ccf873defc1c71545;hpb=9955e0efdbd3f95d352cbcddbf1cff5cd362f83e;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index da6039ce..8fd2b7a9 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -405,36 +405,30 @@ get_direct_dvd_volume_name(const gchar *drive) 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 { @@ -452,6 +446,16 @@ ghb_volname_cache_init(void) 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) { @@ -466,8 +470,19 @@ 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); @@ -480,7 +495,7 @@ ghb_cache_volnames(signal_user_data_t *ud) g_free(name); } - g_object_unref(link->data); + free_drive(link->data); link = link->next; } g_mutex_unlock(volname_mutex); @@ -792,7 +807,7 @@ source_dialog_extra_widgets( 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); @@ -1338,7 +1353,6 @@ title_changed_cb(GtkWidget *widget, signal_user_data_t *ud) ghb_update_ui_combo_box (ud, "AudioTrack", titleindex, FALSE); ghb_update_ui_combo_box (ud, "SubtitleTrack", titleindex, FALSE); - ghb_set_pref_subtitle(titleindex, ud); if (ghb_get_title_info (&tinfo, titleindex)) { show_title_info(ud, &tinfo); @@ -1346,6 +1360,7 @@ title_changed_cb(GtkWidget *widget, signal_user_data_t *ud) update_chapter_list (ud); ghb_adjust_audio_rate_combos(ud); ghb_set_pref_audio(titleindex, ud); + ghb_set_pref_subtitle(titleindex, ud); if (ghb_settings_get_boolean(ud->settings, "vquality_type_target")) { gint bitrate = ghb_calculate_target_bitrate (ud->settings, titleindex); @@ -2230,6 +2245,12 @@ ghb_backend_events(signal_user_data_t *ud) ghb_settings_set_int(js, "job_status", qstatus); ghb_save_queue(ud->queue); ud->cancel_encode = FALSE; +#if !GTK_CHECK_VERSION(2, 16, 0) + GtkStatusIcon *si; + + si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status")); + gtk_status_icon_set_tooltip(si, "HandBrake"); +#endif } else if (status.queue.state & GHB_STATE_MUXING) { @@ -2276,6 +2297,12 @@ ghb_backend_events(signal_user_data_t *ud) status_str = working_status_string(ud, &status.queue); label = GTK_LABEL(GHB_WIDGET(ud->builder, "queue_status")); gtk_label_set_text (label, status_str); +#if !GTK_CHECK_VERSION(2, 16, 0) + GtkStatusIcon *si; + + si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status")); + gtk_status_icon_set_tooltip(si, status_str); +#endif g_free(status_str); } if (status.scan.state & GHB_STATE_WORKING) @@ -2305,6 +2332,7 @@ ghb_backend_events(signal_user_data_t *ud) } } +#if GTK_CHECK_VERSION(2, 16, 0) G_MODULE_EXPORT gboolean status_icon_query_tooltip_cb( GtkStatusIcon *si, @@ -2330,6 +2358,7 @@ status_icon_query_tooltip_cb( g_free(status_str); return TRUE; } +#endif G_MODULE_EXPORT gboolean ghb_timer_cb(gpointer data) @@ -2537,7 +2566,7 @@ ghb_log(gchar *log, ...) _now = time(NULL); now = localtime( &_now ); - snprintf(fmt, 362, "[%02d:%02d:%02d] lingui: %s\n", + snprintf(fmt, 362, "[%02d:%02d:%02d] gtkgui: %s\n", now->tm_hour, now->tm_min, now->tm_sec, log); va_start(args, log); vfprintf(stderr, fmt, args); @@ -2962,7 +2991,7 @@ ghb_file_menu_add_dvd(signal_user_data_t *ud) 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) { @@ -3009,7 +3038,7 @@ ghb_file_menu_add_dvd(signal_user_data_t *ud) (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); @@ -3115,7 +3144,7 @@ handle_media_change(const gchar *device, gboolean insert, signal_user_data_t *ud 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) { @@ -3136,7 +3165,7 @@ handle_media_change(const gchar *device, gboolean insert, signal_user_data_t *ud 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) { @@ -3611,9 +3640,9 @@ process_appcast(signal_user_data_t *ud) 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)