[rhythmbox] drop all gdk_threads_enter/gdk_threads_leave pairs



commit 02af9858cbba968e07b487f4d2e44be13bc9d7fa
Author: Jonathan Matthew <jonathan d14n org>
Date:   Fri Dec 6 16:56:09 2013 +1000

    drop all gdk_threads_enter/gdk_threads_leave pairs
    
    All GTK+ calls are now made from the main thread so we don't need
    these deprecated functions.

 lib/rb-tree-dnd.c                                 |   10 --------
 lib/rb-util.c                                     |    2 -
 plugins/daap/rb-daap-plugin.c                     |    9 -------
 plugins/daap/rb-daap-source.c                     |    2 -
 plugins/daap/rb-dacp-pairing-page.c               |    8 ------
 plugins/generic-player/rb-generic-player-source.c |    4 ---
 plugins/grilo/rb-grilo-source.c                   |    2 -
 plugins/ipod/rb-ipod-source.c                     |    3 --
 plugins/iradio/rb-iradio-source.c                 |    8 +-----
 plugins/rb/Loader.py                              |   17 +++++--------
 podcast/rb-podcast-manager.c                      |   26 ---------------------
 rhythmdb/rhythmdb-property-model.c                |    3 --
 rhythmdb/rhythmdb-query-model.c                   |    4 ---
 rhythmdb/rhythmdb.c                               |    7 -----
 shell/main.c                                      |    1 -
 shell/rb-play-order.c                             |    4 ---
 shell/rb-removable-media-manager.c                |   10 --------
 shell/rb-shell-clipboard.c                        |    5 ----
 shell/rb-shell-player.c                           |   21 -----------------
 shell/rb-shell.c                                  |   13 ----------
 shell/rb-statusbar.c                              |    5 ----
 sources/rb-source.c                               |    3 --
 sources/rb-streaming-source.c                     |    2 -
 tests/bench-rhythmdb-load.c                       |    4 ---
 tests/test-audioscrobbler.c                       |    2 -
 tests/test-rb-lib.c                               |    2 -
 tests/test-rhythmdb-query.c                       |    4 ---
 tests/test-rhythmdb-tree-serialization.c          |    4 ---
 tests/test-rhythmdb-view.c                        |    4 ---
 tests/test-utils.c                                |    1 -
 widgets/rb-entry-view.c                           |    3 --
 widgets/rb-header.c                               |    5 ----
 widgets/rb-search-entry.c                         |    3 --
 33 files changed, 9 insertions(+), 192 deletions(-)
---
diff --git a/lib/rb-tree-dnd.c b/lib/rb-tree-dnd.c
index ff0c38d..0329743 100644
--- a/lib/rb-tree-dnd.c
+++ b/lib/rb-tree-dnd.c
@@ -471,8 +471,6 @@ scroll_row_timeout (gpointer data)
        GdkWindow *window;
        GdkDeviceManager *device_manager;
 
-       GDK_THREADS_ENTER ();
-
        priv_data = g_object_get_data (G_OBJECT (tree_view), RB_TREE_DND_STRING);
        g_return_val_if_fail(priv_data != NULL, TRUE);
 
@@ -487,7 +485,6 @@ scroll_row_timeout (gpointer data)
        /* see if we are near the edge. */
        if (x < visible_rect.x && x > visible_rect.x + visible_rect.width)
        {
-               GDK_THREADS_LEAVE ();
                priv_data->scroll_timeout = 0;
                return FALSE;
        }
@@ -498,7 +495,6 @@ scroll_row_timeout (gpointer data)
                offset = y - (visible_rect.y + visible_rect.height - 2 * SCROLL_EDGE_SIZE);
                if (offset < 0) 
                {
-                       GDK_THREADS_LEAVE ();
                        priv_data->scroll_timeout = 0;
                        return FALSE;
                }
@@ -515,8 +511,6 @@ scroll_row_timeout (gpointer data)
        if (ABS (vadj_value - value) > 0.0001)
                remove_select_on_drag_timeout(tree_view);
 
-       GDK_THREADS_LEAVE ();
-
        return TRUE;
 }
 
@@ -528,8 +522,6 @@ select_on_drag_timeout (gpointer data)
        GtkTreeSelection *selection;
        RbTreeDndData *priv_data;
 
-       GDK_THREADS_ENTER ();
-
        priv_data = g_object_get_data (G_OBJECT (tree_view), RB_TREE_DND_STRING);
        g_return_val_if_fail(priv_data != NULL, FALSE);
        g_return_val_if_fail(priv_data->previous_dest_path != NULL, FALSE);
@@ -543,8 +535,6 @@ select_on_drag_timeout (gpointer data)
        priv_data->select_on_drag_timeout = 0;
        gtk_tree_path_free(priv_data->previous_dest_path);
        priv_data->previous_dest_path = NULL;
-
-       GDK_THREADS_LEAVE ();
        return FALSE;
 }
 
diff --git a/lib/rb-util.c b/lib/rb-util.c
index 40cd070..b4a1dcb 100644
--- a/lib/rb-util.c
+++ b/lib/rb-util.c
@@ -1298,9 +1298,7 @@ do_delayed_apply (GSettings *settings)
        data = g_object_get_data (G_OBJECT (settings), DELAYED_SYNC_DATA_ITEM);
        sync_func = g_object_get_data (G_OBJECT (settings), DELAYED_SYNC_FUNC_ITEM);
        if (sync_func != NULL) {
-               GDK_THREADS_ENTER ();
                sync_func (settings, data);
-               GDK_THREADS_LEAVE ();
        }
 
        g_object_set_data (G_OBJECT (settings), DELAYED_SYNC_ITEM, GUINT_TO_POINTER (0));
diff --git a/plugins/daap/rb-daap-plugin.c b/plugins/daap/rb-daap-plugin.c
index daae257..77dd333 100644
--- a/plugins/daap/rb-daap-plugin.c
+++ b/plugins/daap/rb-daap-plugin.c
@@ -306,8 +306,6 @@ mdns_service_added (DMAPMdnsBrowser *browser,
                   service->port,
                   service->password_protected);
 
-       GDK_THREADS_ENTER ();
-
        source = find_source_by_service_name (plugin, service->service_name);
 
        if (source == NULL) {
@@ -334,8 +332,6 @@ mdns_service_added (DMAPMdnsBrowser *browser,
                              "password-protected", service->password_protected,
                              NULL);
        }
-
-       GDK_THREADS_LEAVE ();
 }
 
 static void
@@ -344,17 +340,12 @@ mdns_service_removed (DMAPMdnsBrowser *browser,
                      RBDaapPlugin      *plugin)
 {
        RBSource *source;
-
-       GDK_THREADS_ENTER ();
-
        source = find_source_by_service_name (plugin, service_name);
 
        rb_debug ("DAAP source '%s' went away", service_name);
        if (source != NULL) {
                g_hash_table_remove (plugin->source_lookup, service_name);
        }
-
-       GDK_THREADS_LEAVE ();
 }
 
 static void
diff --git a/plugins/daap/rb-daap-source.c b/plugins/daap/rb-daap-source.c
index d4a173b..ac9d390 100644
--- a/plugins/daap/rb-daap-source.c
+++ b/plugins/daap/rb-daap-source.c
@@ -800,9 +800,7 @@ rb_daap_source_disconnect (RBDAAPSource *daap_source)
        rb_debug ("Waiting for DAAP connection to finish");
        while (daap_source->priv->connection != NULL) {
                rb_debug ("Waiting for DAAP connection to finish...");
-               GDK_THREADS_ENTER ();
                gtk_main_iteration ();
-               GDK_THREADS_LEAVE ();
        }
 
        daap_source->priv->disconnecting = FALSE;
diff --git a/plugins/daap/rb-dacp-pairing-page.c b/plugins/daap/rb-dacp-pairing-page.c
index 9de6320..6928909 100644
--- a/plugins/daap/rb-dacp-pairing-page.c
+++ b/plugins/daap/rb-dacp-pairing-page.c
@@ -606,8 +606,6 @@ dacp_remote_added (DACPShare    *share,
 
        g_object_get (plugin, "object", &shell, NULL);
 
-       GDK_THREADS_ENTER ();
-
        page = find_dacp_page (shell, service_name);
        if (page == NULL) {
                RBDisplayPageGroup *page_group;
@@ -628,8 +626,6 @@ dacp_remote_added (DACPShare    *share,
                rb_dacp_pairing_page_remote_found (page);
        }
 
-       GDK_THREADS_LEAVE ();
-
        g_object_unref (shell);
 }
 
@@ -645,15 +641,11 @@ dacp_remote_removed (DACPShare       *share,
 
        g_object_get (plugin, "object", &shell, NULL);
 
-       GDK_THREADS_ENTER ();
-
        page = find_dacp_page (shell, service_name);
        if (page != NULL) {
                rb_dacp_pairing_page_remote_lost (page);
        }
 
-       GDK_THREADS_LEAVE ();
-
        g_object_unref (shell);
 }
 
diff --git a/plugins/generic-player/rb-generic-player-source.c 
b/plugins/generic-player/rb-generic-player-source.c
index fb6e6ce..d8ecf9c 100644
--- a/plugins/generic-player/rb-generic-player-source.c
+++ b/plugins/generic-player/rb-generic-player-source.c
@@ -598,8 +598,6 @@ import_complete_cb (RhythmDBImportJob *job, int total, RBGenericPlayerSource *so
        RBGenericPlayerSourcePrivate *priv = GET_PRIVATE (source);
        RBShell *shell;
 
-       GDK_THREADS_ENTER ();
-
        if (priv->ejecting) {
                rb_device_source_default_eject (RB_DEVICE_SOURCE (source));
        } else {
@@ -617,8 +615,6 @@ import_complete_cb (RhythmDBImportJob *job, int total, RBGenericPlayerSource *so
 
        g_object_unref (priv->import_job);
        priv->import_job = NULL;
-
-       GDK_THREADS_LEAVE ();
 }
 
 static void
diff --git a/plugins/grilo/rb-grilo-source.c b/plugins/grilo/rb-grilo-source.c
index b475303..62f7766 100644
--- a/plugins/grilo/rb-grilo-source.c
+++ b/plugins/grilo/rb-grilo-source.c
@@ -818,7 +818,6 @@ grilo_media_browse_cb (GrlSource *grilo_source, guint operation_id, GrlMedia *me
                return;
        }
 
-       GDK_THREADS_ENTER ();
        if (media != NULL) {
                source->priv->media_browse_got_results = TRUE;
                source->priv->media_browse_position++;
@@ -872,7 +871,6 @@ grilo_media_browse_cb (GrlSource *grilo_source, guint operation_id, GrlMedia *me
                        delete_marker_row (source, &source->priv->media_browse_container_iter);
                }
        }
-       GDK_THREADS_LEAVE ();
 }
 
 static void
diff --git a/plugins/ipod/rb-ipod-source.c b/plugins/ipod/rb-ipod-source.c
index bce4439..5c17585 100644
--- a/plugins/ipod/rb-ipod-source.c
+++ b/plugins/ipod/rb-ipod-source.c
@@ -1237,8 +1237,6 @@ load_ipod_db_idle_cb (RBiPodSource *source)
        GList *it;
        RBiPodSourcePrivate *priv = IPOD_SOURCE_GET_PRIVATE (source);
 
-       GDK_THREADS_ENTER ();
-
        db = get_db_for_source (source);
 
        g_assert (db != NULL);
@@ -1261,7 +1259,6 @@ load_ipod_db_idle_cb (RBiPodSource *source)
 
        rb_transfer_target_transfer (RB_TRANSFER_TARGET (source), NULL, FALSE);
 
-       GDK_THREADS_LEAVE ();
        priv->load_idle_id = 0;
        return FALSE;
 }
diff --git a/plugins/iradio/rb-iradio-source.c b/plugins/iradio/rb-iradio-source.c
index 4a9f997..5a35ecd 100644
--- a/plugins/iradio/rb-iradio-source.c
+++ b/plugins/iradio/rb-iradio-source.c
@@ -1012,11 +1012,9 @@ info_available_cb (RBPlayer *backend,
                return;
        }
 
-       GDK_THREADS_ENTER ();
-
        entry = rb_shell_player_get_playing_entry (source->priv->player);
        if (check_entry_type (source, entry) == FALSE)
-               goto out_unlock;
+               return;
 
        /* validate the value */
        switch (field) {
@@ -1029,7 +1027,7 @@ info_available_cb (RBPlayer *backend,
                if (!g_utf8_validate (str, -1, NULL)) {
                        g_warning ("Invalid UTF-8 from internet radio: %s", str);
                        g_free (str);
-                       goto out_unlock;
+                       return;
                }
                break;
        default:
@@ -1117,8 +1115,6 @@ info_available_cb (RBPlayer *backend,
        }
 
        g_free (str);
- out_unlock:
-       GDK_THREADS_LEAVE ();
 }
 
 static void
diff --git a/plugins/rb/Loader.py b/plugins/rb/Loader.py
index 1d6bc7d..8e5cc21 100644
--- a/plugins/rb/Loader.py
+++ b/plugins/rb/Loader.py
@@ -24,18 +24,15 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
 
-from gi.repository import GObject, GLib, Gdk, Gio
+from gi.repository import GObject, GLib, Gio
 import sys
 
-def callback_with_gdk_lock(callback, data, args):
-       Gdk.threads_enter()
+def call_callback(callback, data, args):
        try:
                v = callback(data, *args)
-               Gdk.threads_leave()
                return v
        except Exception as e:
                sys.excepthook(*sys.exc_info())
-               Gdk.threads_leave()
 
 
 class Loader(object):
@@ -46,12 +43,12 @@ class Loader(object):
                try:
                        (ok, contents, etag) = file.load_contents_finish(result)
                        if ok:
-                               callback_with_gdk_lock(self.callback, contents, self.args)
+                               call_callback(self.callback, contents, self.args)
                        else:
-                               callback_with_gdk_lock(self.callback, None, self.args)
+                               call_callback(self.callback, None, self.args)
                except Exception as e:
                        sys.excepthook(*sys.exc_info())
-                       callback_with_gdk_lock(self.callback, None, self.args)
+                       call_callback(self.callback, None, self.args)
 
        def get_url (self, url, callback, *args):
                self.url = url
@@ -77,10 +74,10 @@ class UpdateCheck(object):
                try:
                        rfi = file.query_info_finish(result)
                        remote_mod = rfi.get_attribute_uint64(Gio.FILE_ATTRIBUTE_TIME_MODIFIED)
-                       callback_with_gdk_lock(self.callback, remote_mod != self.local_mod, self.args)
+                       call_callback(self.callback, remote_mod != self.local_mod, self.args)
                except Exception as e:
                        sys.excepthook(*sys.exc_info())
-                       callback_with_gdk_lock(self.callback, False, self.args)
+                       call_callback(self.callback, False, self.args)
 
        def check_for_update (self, local, remote, callback, *args):
                self.local = local
diff --git a/podcast/rb-podcast-manager.c b/podcast/rb-podcast-manager.c
index 2a5088a..ef2f415 100644
--- a/podcast/rb-podcast-manager.c
+++ b/podcast/rb-podcast-manager.c
@@ -649,8 +649,6 @@ rb_podcast_manager_update_feeds_cb (gpointer data)
 
        g_assert (rb_is_main_thread ());
 
-       GDK_THREADS_ENTER ();
-
        pd->priv->source_sync = 0;
 
        g_file_set_attribute_uint64 (pd->priv->timestamp_file,
@@ -661,10 +659,7 @@ rb_podcast_manager_update_feeds_cb (gpointer data)
                                     NULL);
 
        rb_podcast_manager_update_feeds (pd);
-
        rb_podcast_manager_start_update_timer (pd);
-
-       GDK_THREADS_LEAVE ();
        return FALSE;
 }
 
@@ -712,20 +707,16 @@ rb_podcast_manager_next_file (RBPodcastManager * pd)
 
        rb_debug ("looking for something to download");
 
-       GDK_THREADS_ENTER ();
-
        pd->priv->next_file_id = 0;
 
        if (pd->priv->active_download != NULL) {
                rb_debug ("already downloading something");
-               GDK_THREADS_LEAVE ();
                return FALSE;
        }
 
        d = g_list_first (pd->priv->download_list);
        if (d == NULL) {
                rb_debug ("download queue is empty");
-               GDK_THREADS_LEAVE ();
                return FALSE;
        }
 
@@ -754,8 +745,6 @@ rb_podcast_manager_next_file (RBPodcastManager * pd)
                           data->cancel,
                           (GAsyncReadyCallback) read_file_cb,
                           data);
-
-       GDK_THREADS_LEAVE ();
        return FALSE;
 }
 
@@ -974,10 +963,8 @@ download_podcast (GFileInfo *src_info, RBPodcastManagerInfo *data)
 
        g_free (sane_local_file_uri);
 
-       GDK_THREADS_ENTER ();
        g_signal_emit (data->pd, rb_podcast_manager_signals[START_DOWNLOAD],
                       0, data->entry);
-       GDK_THREADS_LEAVE ();
 
        data->cancel = g_cancellable_new ();
        data->thread = g_thread_new ("podcast-download",
@@ -1079,9 +1066,7 @@ rb_podcast_manager_free_parse_result (RBPodcastManagerParseResult *result)
 static gboolean
 rb_podcast_manager_parse_complete_cb (RBPodcastManagerParseResult *result)
 {
-       GDK_THREADS_ENTER ();
        if (result->pd->priv->shutdown) {
-               GDK_THREADS_LEAVE ();
                return FALSE;
        }
 
@@ -1093,8 +1078,6 @@ rb_podcast_manager_parse_complete_cb (RBPodcastManagerParseResult *result)
        } else {
                rb_podcast_manager_add_parsed_feed (result->pd, result->channel);
        }
-
-       GDK_THREADS_LEAVE ();
        return FALSE;
 }
 
@@ -1119,8 +1102,6 @@ static gboolean
 confirm_bad_mime_type (RBPodcastThreadInfo *info)
 {
        GtkWidget *dialog;
-
-       GDK_THREADS_ENTER ();
        dialog = gtk_message_dialog_new (NULL, 0,
                                         GTK_MESSAGE_QUESTION,
                                         GTK_BUTTONS_YES_NO,
@@ -1130,7 +1111,6 @@ confirm_bad_mime_type (RBPodcastThreadInfo *info)
                                         info->url);
        gtk_widget_show_all (dialog);
        g_signal_connect (dialog, "response", G_CALLBACK (confirm_bad_mime_type_response_cb), info);
-       GDK_THREADS_LEAVE ();
        return FALSE;
 }
 
@@ -1488,8 +1468,6 @@ download_progress (RBPodcastManagerInfo *data, guint64 downloaded, guint64 total
                          rhythmdb_entry_get_string (data->entry, RHYTHMDB_PROP_LOCATION),
                          downloaded, total);
 
-               GDK_THREADS_ENTER ();
-
                g_value_init (&val, G_TYPE_ULONG);
                g_value_set_ulong (&val, local_progress);
                rhythmdb_entry_set (data->pd->priv->db, data->entry, RHYTHMDB_PROP_STATUS, &val);
@@ -1497,8 +1475,6 @@ download_progress (RBPodcastManagerInfo *data, guint64 downloaded, guint64 total
 
                rhythmdb_commit (data->pd->priv->db);
 
-               GDK_THREADS_LEAVE ();
-
                data->progress = local_progress;
        }
 
@@ -1678,10 +1654,8 @@ end_job  (RBPodcastManagerInfo *data)
 
        data->pd->priv->download_list = g_list_remove (data->pd->priv->download_list, data);
 
-       GDK_THREADS_ENTER ();
        g_signal_emit (data->pd, rb_podcast_manager_signals[FINISH_DOWNLOAD],
                       0, data->entry);
-       GDK_THREADS_LEAVE ();
 
        g_assert (pd->priv->active_download == data);
        pd->priv->active_download = NULL;
diff --git a/rhythmdb/rhythmdb-property-model.c b/rhythmdb/rhythmdb-property-model.c
index 7446e38..648e818 100644
--- a/rhythmdb/rhythmdb-property-model.c
+++ b/rhythmdb/rhythmdb-property-model.c
@@ -1423,8 +1423,6 @@ rhythmdb_property_model_perform_sync (RhythmDBPropertyModel *model)
        GtkTreeIter iter;
        GtkTreePath *path;
 
-       GDK_THREADS_ENTER ();
-
        iter.stamp = model->priv->stamp;
        iter.user_data = model->priv->all;
        path = rhythmdb_property_model_get_path (GTK_TREE_MODEL (model), &iter);
@@ -1432,7 +1430,6 @@ rhythmdb_property_model_perform_sync (RhythmDBPropertyModel *model)
        gtk_tree_path_free (path);
 
        model->priv->syncing_id = 0;
-       GDK_THREADS_LEAVE ();
        return FALSE;
 }
 
diff --git a/rhythmdb/rhythmdb-query-model.c b/rhythmdb/rhythmdb-query-model.c
index 1e5f56e..0716bce 100644
--- a/rhythmdb/rhythmdb-query-model.c
+++ b/rhythmdb/rhythmdb-query-model.c
@@ -1160,9 +1160,7 @@ rhythmdb_query_model_entry_deleted_cb (RhythmDB *db,
 static gboolean
 idle_process_update_idle (struct RhythmDBQueryModelUpdate *update)
 {
-       GDK_THREADS_ENTER ();
        idle_process_update (update);
-       GDK_THREADS_LEAVE ();
        return FALSE;
 }
 
@@ -3394,11 +3392,9 @@ rhythmdb_query_model_limit_type_get_type (void)
 static gboolean
 rhythmdb_query_model_reapply_query_cb (RhythmDBQueryModel *model)
 {
-       GDK_THREADS_ENTER ();
        rhythmdb_query_model_reapply_query (model, FALSE);
        rhythmdb_do_full_query_async_parsed (model->priv->db,
                                             RHYTHMDB_QUERY_RESULTS (model),
                                             model->priv->original_query);
-       GDK_THREADS_LEAVE ();
        return TRUE;
 }
diff --git a/rhythmdb/rhythmdb.c b/rhythmdb/rhythmdb.c
index b67ddc1..c9cce40 100644
--- a/rhythmdb/rhythmdb.c
+++ b/rhythmdb/rhythmdb.c
@@ -1325,8 +1325,6 @@ rhythmdb_emit_entry_signals_idle (RhythmDB *db)
 
        g_mutex_unlock (&db->priv->change_mutex);
 
-       GDK_THREADS_ENTER ();
-
        /* emit changed entries */
        if (changed_entries != NULL) {
                g_hash_table_iter_init (&iter, changed_entries);
@@ -1358,8 +1356,6 @@ rhythmdb_emit_entry_signals_idle (RhythmDB *db)
                rhythmdb_entry_unref (entry);
        }
 
-       GDK_THREADS_LEAVE ();
-
        if (changed_entries != NULL) {
                g_hash_table_destroy (changed_entries);
        }
@@ -3058,13 +3054,10 @@ rhythmdb_sync_library_idle (RhythmDB *db)
 static gboolean
 rhythmdb_load_error_cb (GError *error)
 {
-       GDK_THREADS_ENTER ();
        rb_error_dialog (NULL,
                         _("Could not load the music database:"),
                         "%s", error->message);
        g_error_free (error);
-
-       GDK_THREADS_LEAVE ();
        return FALSE;
 }
 
diff --git a/shell/main.c b/shell/main.c
index 4770736..7a58f3c 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -88,7 +88,6 @@ main (int argc, char **argv)
        g_irepository_prepend_search_path (SHARE_UNINSTALLED_BUILDDIR "/../bindings/gi");
 #endif
 
-       /* TODO: kill this function */
        rb_threads_init ();
 
        app = rb_application_new ();
diff --git a/shell/rb-play-order.c b/shell/rb-play-order.c
index 85d1a32..a50303b 100644
--- a/shell/rb-play-order.c
+++ b/shell/rb-play-order.c
@@ -635,8 +635,6 @@ sync_playing_entry_cb (RBPlayOrder *porder)
 {
        RBShellPlayer *player;
 
-       GDK_THREADS_ENTER ();
-       
        player = rb_play_order_get_player (porder);
 
        if (porder->priv->playing_entry) {
@@ -655,8 +653,6 @@ sync_playing_entry_cb (RBPlayOrder *porder)
                }
        }
        porder->priv->sync_playing_entry_id = 0;
-
-       GDK_THREADS_LEAVE ();
        return FALSE;
 }
 
diff --git a/shell/rb-removable-media-manager.c b/shell/rb-removable-media-manager.c
index 06b5c2b..db08a8d 100644
--- a/shell/rb-removable-media-manager.c
+++ b/shell/rb-removable-media-manager.c
@@ -487,9 +487,7 @@ volume_added_cb (GVolumeMonitor *monitor,
                 GVolume *volume,
                 RBRemovableMediaManager *mgr)
 {
-       GDK_THREADS_ENTER ();
        rb_removable_media_manager_add_volume (mgr, volume);
-       GDK_THREADS_LEAVE ();
 }
 
 static void
@@ -497,9 +495,7 @@ volume_removed_cb (GVolumeMonitor *monitor,
                   GVolume *volume,
                   RBRemovableMediaManager *mgr)
 {
-       GDK_THREADS_ENTER ();
        rb_removable_media_manager_remove_volume (mgr, volume);
-       GDK_THREADS_LEAVE ();
 }
 
 static void
@@ -507,9 +503,7 @@ mount_added_cb (GVolumeMonitor *monitor,
                GMount *mount,
                RBRemovableMediaManager *mgr)
 {
-       GDK_THREADS_ENTER ();
        rb_removable_media_manager_add_mount (mgr, mount);
-       GDK_THREADS_LEAVE ();
 }
 
 static void
@@ -528,8 +522,6 @@ uevent_cb (GUdevClient *client, const char *action, GUdevDevice *device, RBRemov
        RBRemovableMediaManagerPrivate *priv = GET_PRIVATE (mgr);
        guint64 devnum;
 
-       GDK_THREADS_ENTER ();
-
        devnum = (guint64) g_udev_device_get_device_number (device);
        rb_debug ("%s event for %s (%"G_GINT64_MODIFIER"x)", action,
                   g_udev_device_get_sysfs_path (device), devnum);
@@ -559,8 +551,6 @@ uevent_cb (GUdevClient *client, const char *action, GUdevDevice *device, RBRemov
                        rb_display_page_delete_thyself (RB_DISPLAY_PAGE (source));
                }
        }
-
-       GDK_THREADS_LEAVE ();
 }
 #endif
 
diff --git a/shell/rb-shell-clipboard.c b/shell/rb-shell-clipboard.c
index f0dbed6..4252ca2 100644
--- a/shell/rb-shell-clipboard.c
+++ b/shell/rb-shell-clipboard.c
@@ -470,11 +470,8 @@ rb_shell_clipboard_new (RhythmDB *db)
 static gboolean
 rb_shell_clipboard_sync_idle (RBShellClipboard *clipboard)
 {
-       GDK_THREADS_ENTER ();
        rb_shell_clipboard_sync (clipboard);
        clipboard->priv->idle_sync_id = 0;
-       GDK_THREADS_LEAVE ();
-
        return FALSE;
 }
 
@@ -661,7 +658,6 @@ rb_shell_clipboard_entry_deleted_cb (RhythmDB *db,
 {
        GList *l;
 
-       GDK_THREADS_ENTER ();
        l = g_list_find (clipboard->priv->entries, entry);
        if (l != NULL) {
                clipboard->priv->entries = g_list_delete_link (clipboard->priv->entries, l);
@@ -670,7 +666,6 @@ rb_shell_clipboard_entry_deleted_cb (RhythmDB *db,
                        clipboard->priv->idle_sync_id = g_idle_add ((GSourceFunc) 
rb_shell_clipboard_sync_idle,
                                                                    clipboard);
        }
-       GDK_THREADS_LEAVE ();
 }
 
 static void
diff --git a/shell/rb-shell-player.c b/shell/rb-shell-player.c
index 49170ca..4b3c918 100644
--- a/shell/rb-shell-player.c
+++ b/shell/rb-shell-player.c
@@ -340,10 +340,8 @@ rb_shell_player_open_playlist_url (RBShellPlayer *player,
                rb_player_play (player->priv->mmplayer, play_type, player->priv->track_transition_time, 
&error);
 
        if (error) {
-               GDK_THREADS_ENTER ();
                rb_shell_player_error_idle (player, TRUE, error);
                g_error_free (error);
-               GDK_THREADS_LEAVE ();
        }
 }
 
@@ -502,8 +500,6 @@ rb_shell_player_handle_eos (RBPlayer *player,
                }
        }
 
-       GDK_THREADS_ENTER ();
-
        location = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION);
        if (entry != shell_player->priv->playing_entry) {
                rb_debug ("got unexpected eos for %s", location);
@@ -512,8 +508,6 @@ rb_shell_player_handle_eos (RBPlayer *player,
                /* don't allow playback to be stopped on early EOS notifications */
                rb_shell_player_handle_eos_unlocked (shell_player, entry, (early == FALSE));
        }
-
-       GDK_THREADS_LEAVE ();
 }
 
 
@@ -681,10 +675,8 @@ open_location_thread (OpenLocationThreadData *data)
                        GError *error = g_error_new (RB_SHELL_PLAYER_ERROR,
                                                     RB_SHELL_PLAYER_ERROR_END_OF_PLAYLIST,
                                                     _("Playlist was empty"));
-                       GDK_THREADS_ENTER ();
                        rb_shell_player_error_idle (data->player, TRUE, error);
                        g_error_free (error);
-                       GDK_THREADS_LEAVE ();
                } else {
                        char *location;
 
@@ -2505,8 +2497,6 @@ playing_stream_cb (RBPlayer *mmplayer,
 
        g_return_if_fail (entry != NULL);
 
-       GDK_THREADS_ENTER ();
-
        entry_changed = (player->priv->playing_entry != entry);
 
        /* update playing entry */
@@ -2532,8 +2522,6 @@ playing_stream_cb (RBPlayer *mmplayer,
        rb_shell_player_sync_with_source (player);
        rb_shell_player_sync_buttons (player);
        g_object_notify (G_OBJECT (player), "playing");
-
-       GDK_THREADS_LEAVE ();
 }
 
 static void
@@ -2552,16 +2540,12 @@ error_cb (RBPlayer *mmplayer,
                return;
        }
 
-       GDK_THREADS_ENTER ();
-
        if (entry != player->priv->playing_entry) {
                rb_debug ("got error for unexpected entry %p (expected %p)", entry, 
player->priv->playing_entry);
        } else {
                rb_shell_player_error (player, TRUE, err);
                rb_debug ("exiting error hander");
        }
-
-       GDK_THREADS_LEAVE ();
 }
 
 static void
@@ -2577,11 +2561,8 @@ tick_cb (RBPlayer *mmplayer,
        const char *uri;
        long elapsed_sec;
 
-       GDK_THREADS_ENTER ();
-
        if (player->priv->playing_entry != entry) {
                rb_debug ("got tick for unexpected entry %p (expected %p)", entry, 
player->priv->playing_entry);
-               GDK_THREADS_LEAVE ();
                return;
        }
 
@@ -2641,8 +2622,6 @@ tick_cb (RBPlayer *mmplayer,
                          remaining_check);
                rb_shell_player_handle_eos_unlocked (player, entry, FALSE);
        }
-
-       GDK_THREADS_LEAVE ();
 }
 
 typedef struct {
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index 07934f9..add6c65 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -989,10 +989,7 @@ construct_plugins (RBShell *shell)
 static gboolean
 _scan_idle (RBShell *shell)
 {
-
-       GDK_THREADS_ENTER ();
        rb_removable_media_manager_scan (shell->priv->removable_media_manager);
-       GDK_THREADS_LEAVE ();
 
        if (shell->priv->no_registration == FALSE) {
                gboolean loaded, scanned;
@@ -1592,11 +1589,8 @@ rb_shell_sync_state (RBShell *shell)
 static gboolean
 idle_save_playlist_manager (RBShell *shell)
 {
-       GDK_THREADS_ENTER ();
        rb_playlist_manager_save_playlists (shell->priv->playlist_manager,
                                            FALSE);
-       GDK_THREADS_LEAVE ();
-
        return TRUE;
 }
 
@@ -2461,10 +2455,8 @@ rb_shell_toggle_visibility (RBShell *shell)
 static gboolean
 quit_timeout (gpointer dummy)
 {
-       GDK_THREADS_ENTER ();
        rb_debug ("quit damn you");
        gtk_main_quit ();
-       GDK_THREADS_LEAVE ();
        return FALSE;
 }
 
@@ -2524,8 +2516,6 @@ rb_shell_quit (RBShell *shell,
 static gboolean
 idle_handle_load_complete (RBShell *shell)
 {
-       GDK_THREADS_ENTER ();
-
        rb_debug ("load complete");
 
        rb_playlist_manager_load_playlists (shell->priv->playlist_manager);
@@ -2548,9 +2538,6 @@ idle_handle_load_complete (RBShell *shell)
        }
 
        rhythmdb_start_action_thread (shell->priv->db);
-
-       GDK_THREADS_LEAVE ();
-
        return FALSE;
 }
 
diff --git a/shell/rb-statusbar.c b/shell/rb-statusbar.c
index 155ef4f..3e9e998 100644
--- a/shell/rb-statusbar.c
+++ b/shell/rb-statusbar.c
@@ -267,13 +267,8 @@ rb_statusbar_set_page (RBStatusbar *statusbar, RBDisplayPage *page)
 static gboolean
 poll_status (RBStatusbar *status)
 {
-        GDK_THREADS_ENTER ();
-
         status->priv->status_poll_id = 0;
         rb_statusbar_sync_status (status);
-
-        GDK_THREADS_LEAVE ();
-
         return FALSE;
 }
 
diff --git a/sources/rb-source.c b/sources/rb-source.c
index 3752cca..5cae1fa 100644
--- a/sources/rb-source.c
+++ b/sources/rb-source.c
@@ -419,13 +419,10 @@ update_visibility_idle (RBSource *source)
 {
        gint count;
 
-       GDK_THREADS_ENTER ();
-
        count = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (source->priv->query_model), NULL);
        g_object_set (source, "visibility", (count > 0), NULL);
 
        source->priv->update_visibility_id = 0;
-       GDK_THREADS_LEAVE ();
        return FALSE;
 }
 
diff --git a/sources/rb-streaming-source.c b/sources/rb-streaming-source.c
index 6ce25de..ab1bbd0 100644
--- a/sources/rb-streaming-source.c
+++ b/sources/rb-streaming-source.c
@@ -230,10 +230,8 @@ buffering_cb (GObject *backend, gpointer whatever, guint progress, RBStreamingSo
        else if (progress == 100)
                progress = 0;
 
-       GDK_THREADS_ENTER ();
        source->priv->buffering = progress;
        rb_source_notify_playback_status_changed (RB_SOURCE (source));
-       GDK_THREADS_LEAVE ();
 }
 
 static gboolean
diff --git a/tests/bench-rhythmdb-load.c b/tests/bench-rhythmdb-load.c
index 2438b40..c65eae6 100644
--- a/tests/bench-rhythmdb-load.c
+++ b/tests/bench-rhythmdb-load.c
@@ -106,8 +106,6 @@ main (int argc, char **argv)
        rb_refstring_system_init ();
        rb_file_helpers_init (TRUE);
 
-       GDK_THREADS_ENTER ();
-
        db = rhythmdb_tree_new ("test");
        g_object_set (G_OBJECT (db), "name", name, NULL);
        g_free (name);
@@ -132,12 +130,10 @@ main (int argc, char **argv)
        rhythmdb_shutdown (db);
        g_object_unref (G_OBJECT (db));
        db = NULL;
-
        
        rb_file_helpers_shutdown ();
         rb_refstring_system_shutdown ();
 
-
        rb_profile_end ("load test");
        return 0;
 }
diff --git a/tests/test-audioscrobbler.c b/tests/test-audioscrobbler.c
index 2eb5233..32c7514 100644
--- a/tests/test-audioscrobbler.c
+++ b/tests/test-audioscrobbler.c
@@ -98,8 +98,6 @@ main (int argc, char **argv)
        g_type_init ();
        rb_debug_init (TRUE);
 
-       GDK_THREADS_ENTER ();
-
        /* setup tests */
        s = rb_audioscrobbler_suite ();
        sr = srunner_create (s);
diff --git a/tests/test-rb-lib.c b/tests/test-rb-lib.c
index dea1ea4..73cb43a 100644
--- a/tests/test-rb-lib.c
+++ b/tests/test-rb-lib.c
@@ -107,8 +107,6 @@ main (int argc, char **argv)
        g_type_init ();
        rb_debug_init (TRUE);
 
-       GDK_THREADS_ENTER ();
-
        /* setup tests */
        s = rb_file_helpers_suite ();
        sr = srunner_create (s);
diff --git a/tests/test-rhythmdb-query.c b/tests/test-rhythmdb-query.c
index e279fcf..c703092 100644
--- a/tests/test-rhythmdb-query.c
+++ b/tests/test-rhythmdb-query.c
@@ -149,12 +149,9 @@ main (int argc, char **argv)
        query_func qfunc;
 
        gtk_init (&argc, &argv);
-       gdk_threads_init ();
        rb_thread_helpers_init ();
        rb_debug_init (TRUE);
 
-       GDK_THREADS_ENTER ();
-
        qfunc = rhythmdb_do_full_query;
 
 begin: 
@@ -550,7 +547,6 @@ begin:
         */
        rhythmdb_shutdown (db);
        g_object_unref (G_OBJECT (db));
-       GDK_THREADS_LEAVE ();
        
        exit (0);
 }
diff --git a/tests/test-rhythmdb-tree-serialization.c b/tests/test-rhythmdb-tree-serialization.c
index babf7fb..a121d72 100644
--- a/tests/test-rhythmdb-tree-serialization.c
+++ b/tests/test-rhythmdb-tree-serialization.c
@@ -111,12 +111,9 @@ main (int argc, char **argv)
        xmlDocPtr doc;
 
        gtk_init (&argc, &argv);
-       gdk_threads_init ();
        rb_thread_helpers_init ();
        rb_debug_init (TRUE);
 
-       GDK_THREADS_ENTER ();
-
        db = rhythmdb_tree_new ("test.xml");
 
        /*
@@ -153,7 +150,6 @@ main (int argc, char **argv)
         */
        rhythmdb_shutdown (db);
        g_object_unref (G_OBJECT (db));
-       GDK_THREADS_LEAVE ();
        
        exit (0);
 }
diff --git a/tests/test-rhythmdb-view.c b/tests/test-rhythmdb-view.c
index ee203e9..01ccd7d 100644
--- a/tests/test-rhythmdb-view.c
+++ b/tests/test-rhythmdb-view.c
@@ -104,14 +104,11 @@ main (int argc, char **argv)
        RhythmDBEntry *entry;
 
        gtk_init (&argc, &argv);
-       gdk_threads_init ();
        rb_thread_helpers_init ();
        rb_file_helpers_init (TRUE);
        rb_stock_icons_init ();
        rb_debug_init (TRUE);
 
-       GDK_THREADS_ENTER ();
-
        db = rhythmdb_tree_new ("test");
 
        rhythmdb_write_lock (db);
@@ -149,7 +146,6 @@ main (int argc, char **argv)
        
        rhythmdb_shutdown (db);
        g_object_unref (G_OBJECT (db));
-       GDK_THREADS_LEAVE ();
        
        exit (0);
 }
diff --git a/tests/test-utils.c b/tests/test-utils.c
index ac4afd0..ff96a2c 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -47,7 +47,6 @@ init_once (gboolean test)
                return;
 
        gtk_init (&argc_, &argv_);
-       GDK_THREADS_ENTER ();
 }
 
 void
diff --git a/widgets/rb-entry-view.c b/widgets/rb-entry-view.c
index 7c00a63..e0c85c6 100644
--- a/widgets/rb-entry-view.c
+++ b/widgets/rb-entry-view.c
@@ -2070,7 +2070,6 @@ rb_entry_view_emit_selection_changed (RBEntryView *view)
        gboolean available;
        gint sel_count;
 
-       GDK_THREADS_ENTER ();
        sel_count = gtk_tree_selection_count_selected_rows (view->priv->selection);
        available = (sel_count > 0);
 
@@ -2087,8 +2086,6 @@ rb_entry_view_emit_selection_changed (RBEntryView *view)
 
        view->priv->selection_changed_id = 0;
        g_signal_emit (G_OBJECT (view), rb_entry_view_signals[SELECTION_CHANGED], 0);
-
-       GDK_THREADS_LEAVE ();
        return FALSE;
 }
 
diff --git a/widgets/rb-header.c b/widgets/rb-header.c
index 85f91b1..ff22777 100644
--- a/widgets/rb-header.c
+++ b/widgets/rb-header.c
@@ -991,14 +991,9 @@ slider_press_callback (GtkWidget *widget,
 static gboolean
 slider_moved_timeout (RBHeader *header)
 {
-       GDK_THREADS_ENTER ();
-
        apply_slider_position (header);
        header->priv->slider_moved_timeout = 0;
        header->priv->slider_drag_moved = FALSE;
-
-       GDK_THREADS_LEAVE ();
-
        return FALSE;
 }
 
diff --git a/widgets/rb-search-entry.c b/widgets/rb-search-entry.c
index 719188a..6a7d4cd 100644
--- a/widgets/rb-search-entry.c
+++ b/widgets/rb-search-entry.c
@@ -449,7 +449,6 @@ static gboolean
 rb_search_entry_timeout_cb (RBSearchEntry *entry)
 {
        const char *text;
-       gdk_threads_enter ();
 
        text = gtk_entry_get_text (GTK_ENTRY (entry->priv->entry));
 
@@ -458,8 +457,6 @@ rb_search_entry_timeout_cb (RBSearchEntry *entry)
        }
        entry->priv->timeout = 0;
 
-       gdk_threads_leave ();
-
        return FALSE;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]