diff options
author | jstebbins <[email protected]> | 2013-01-15 08:23:53 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2013-01-15 08:23:53 +0000 |
commit | 51c25da188b437d689860432f89ba3329eaf083e (patch) | |
tree | 22e8266fe79999200f515c45352af92fa73fef83 /gtk/src | |
parent | 3086efa56616c0e062eac6dfd4bc6b7c0031df14 (diff) |
LinGui: Fix compatibility with GTK versions < 2.32
Ubuntu 11.04 and 11.10 use this and I'm not quite ready to drop support
for these.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5172 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r-- | gtk/src/audiohandler.c | 6 | ||||
-rw-r--r-- | gtk/src/callbacks.c | 28 | ||||
-rw-r--r-- | gtk/src/callbacks.h | 8 | ||||
-rw-r--r-- | gtk/src/main.c | 15 |
4 files changed, 40 insertions, 17 deletions
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c index 8c4707266..d7171c3d4 100644 --- a/gtk/src/audiohandler.c +++ b/gtk/src/audiohandler.c @@ -516,7 +516,7 @@ ghb_audio_list_refresh_selected(signal_user_data_t *ud) selection = gtk_tree_view_get_selection (treeview); if (gtk_tree_selection_get_selected(selection, &store, &iter)) { - const gchar *track, *codec, *br, *sr, *mix; + const gchar *track, *codec, *br = NULL, *sr, *mix; gchar *s_drc, *s_gain, *s_quality = NULL; gdouble drc, gain; // Get the row number @@ -588,7 +588,7 @@ ghb_audio_list_refresh(signal_user_data_t *ud) { do { - const gchar *track, *codec, *br, *sr, *mix; + const gchar *track, *codec, *br = NULL, *sr, *mix; gchar *s_drc, *s_gain, *s_quality = NULL; gdouble drc, gain; GValue *asettings; @@ -986,7 +986,7 @@ ghb_add_audio_to_ui(GtkBuilder *builder, const GValue *settings) GtkTreeIter iter; GtkListStore *store; GtkTreeSelection *selection; - const gchar *track, *codec, *br, *sr, *mix; + const gchar *track, *codec, *br = NULL, *sr, *mix; gchar *s_drc, *s_gain, *s_quality = NULL; gdouble drc; gdouble gain; diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 65ba409ef..42fd3fa03 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -410,7 +410,10 @@ get_dvd_device_name(GDrive *gd) #endif static GHashTable *volname_hash = NULL; -static GMutex volname_mutex; +#if GTK_CHECK_VERSION(2, 32, 0) +static GMutex volname_mutex_static; +#endif +static GMutex *volname_mutex; static void free_volname_key(gpointer data) @@ -458,9 +461,9 @@ get_dvd_volume_name(gpointer gd) gchar *drive; drive = get_dvd_device_name(gd); - g_mutex_lock(&volname_mutex); + g_mutex_lock(volname_mutex); label = g_strdup(g_hash_table_lookup(volname_hash, drive)); - g_mutex_unlock(&volname_mutex); + g_mutex_unlock(volname_mutex); if (label != NULL) { if (uppers_and_unders(label)) @@ -485,7 +488,12 @@ get_dvd_volume_name(gpointer gd) void ghb_volname_cache_init(void) { - g_mutex_init(&volname_mutex); +#if GTK_CHECK_VERSION(2, 32, 0) + g_mutex_init(&volname_mutex_static); + volname_mutex = &volname_mutex_static; +#else + volname_mutex = g_mutex_new(); +#endif volname_hash = g_hash_table_new_full(g_str_hash, g_str_equal, free_volname_key, free_volname_value); } @@ -510,7 +518,7 @@ ghb_cache_volnames(signal_user_data_t *ud) if (drives == NULL) return NULL; - g_mutex_lock(&volname_mutex); + g_mutex_lock(volname_mutex); g_hash_table_remove_all(volname_hash); while (link != NULL) { @@ -542,7 +550,7 @@ ghb_cache_volnames(signal_user_data_t *ud) free_drive(link->data); link = link->next; } - g_mutex_unlock(&volname_mutex); + g_mutex_unlock(volname_mutex); g_list_free(drives); @@ -3183,7 +3191,7 @@ ghb_timer_cb(gpointer data) ghb_settings_set_int64(ud->settings, "last_update_check", tt); ghb_pref_save(ud->settings, "last_update_check"); - g_thread_new("Update Check", (GThreadFunc)ghb_check_update, ud); + GHB_THREAD_NEW("Update Check", (GThreadFunc)ghb_check_update, ud); } } } @@ -4097,7 +4105,7 @@ handle_media_change(const gchar *device, gboolean insert, signal_user_data_t *ud ins_count++; if (ins_count == 2) { - g_thread_new("Cache Volume Names", + GHB_THREAD_NEW("Cache Volume Names", (GThreadFunc)ghb_cache_volnames, ud); if (ghb_settings_get_boolean(ud->settings, "AutoScan") && ud->current_dvd_device != NULL && @@ -4118,7 +4126,7 @@ handle_media_change(const gchar *device, gboolean insert, signal_user_data_t *ud rem_count++; if (rem_count == 2) { - g_thread_new("Cache Volume Names", + GHB_THREAD_NEW("Cache Volume Names", (GThreadFunc)ghb_cache_volnames, ud); if (ud->current_dvd_device != NULL && strcmp(device, ud->current_dvd_device) == 0) @@ -4194,7 +4202,7 @@ drive_changed_cb(GVolumeMonitor *gvm, GDrive *gd, signal_user_data_t *ud) gint state; g_debug("drive_changed_cb()"); - g_thread_new("Cache Volume Names", (GThreadFunc)ghb_cache_volnames, ud); + GHB_THREAD_NEW("Cache Volume Names", (GThreadFunc)ghb_cache_volnames, ud); state = ghb_get_scan_state(); device = g_drive_get_identifier(gd, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE); diff --git a/gtk/src/callbacks.h b/gtk/src/callbacks.h index b4a9654ee..3a22b4c2c 100644 --- a/gtk/src/callbacks.h +++ b/gtk/src/callbacks.h @@ -32,6 +32,14 @@ #include <gtk/gtk.h> #include "settings.h" +#if GTK_CHECK_VERSION(2, 32, 0) +#define GHB_THREAD_NEW(n, f, p) \ + g_thread_new(n, (GThreadFunc)(f), (p)) +#else +#define GHB_THREAD_NEW(n, f, p) \ + g_thread_create((GThreadFunc)(f), (p), TRUE, NULL) +#endif + void ghb_check_all_depencencies(signal_user_data_t *ud); gboolean ghb_timer_cb(gpointer data); gboolean ghb_log_cb(GIOChannel *source, GIOCondition cond, gpointer data); diff --git a/gtk/src/main.c b/gtk/src/main.c index 77cb439d6..891abd088 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -745,14 +745,12 @@ GtkEntry { \n\ \n\ #preview_event_box, \n\ #live_preview_play, \n\ -#live_encode_progress, \n\ #live_duration, \n\ #preview_fullscreen, \n\ #hide_settings \n\ { \n\ background: @black; \n\ background-color: @gray18; \n\ - border-color: @white; \n\ color: @white; \n\ } \n\ \n\ @@ -763,11 +761,12 @@ GtkEntry { \n\ color: @white; \n\ } \n\ \n\ +#live_encode_progress, \n\ #live_preview_progress, \n\ #preview_frame \n\ { \n\ background: @black; \n\ - background-color: @black; \n\ + background-color: @gray46; \n\ color: @white; \n\ } \n\ \n\ @@ -780,6 +779,14 @@ GtkEntry { \n\ } \n\ \n\ #preview_fullscreen:active, \n\ +#hide_settings:selected:focused \n\ +{ \n\ + background: @black; \n\ + background-color: @gray32; \n\ + color: @white; \n\ +} \n\ + \n\ +#preview_fullscreen:active, \n\ #hide_settings:active \n\ { \n\ background: @black; \n\ @@ -1069,7 +1076,7 @@ main(int argc, char *argv[]) // Add dvd devices to File menu ghb_volname_cache_init(); - g_thread_new("Cache Volume Names", (GThreadFunc)ghb_cache_volnames, ud); + GHB_THREAD_NEW("Cache Volume Names", (GThreadFunc)ghb_cache_volnames, ud); #if defined(_USE_APP_IND) GtkUIManager * uim = GTK_UI_MANAGER(GHB_OBJECT(ud->builder, "uimanager1")); |