diff options
author | Stefano Karapetsas <[email protected]> | 2012-12-23 11:14:36 -0800 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-12-23 11:14:36 -0800 |
commit | 3ec2cb1ade8ed91ed472091adcc592485dc49f4d (patch) | |
tree | 122f234160898266040a89a6767871856bd607c9 /src | |
parent | 8379b1dc107c9e0daf31ef1b654c9ab44d9bac23 (diff) | |
parent | c598aa7e65d9e370c63f883acbbb6504044c2531 (diff) | |
download | caja-3ec2cb1ade8ed91ed472091adcc592485dc49f4d.tar.bz2 caja-3ec2cb1ade8ed91ed472091adcc592485dc49f4d.tar.xz |
Merge pull request #65 from jasmineaura/develop
Most of remaining deprecations, some cleanups, and a leak fix
Diffstat (limited to 'src')
-rw-r--r-- | src/caja-application.c | 5 | ||||
-rw-r--r-- | src/caja-file-management-properties.c | 24 | ||||
-rw-r--r-- | src/caja-navigation-window-slot.c | 4 | ||||
-rw-r--r-- | src/caja-navigation-window.c | 14 | ||||
-rw-r--r-- | src/caja-pathbar.c | 12 | ||||
-rw-r--r-- | src/caja-places-sidebar.c | 20 | ||||
-rw-r--r-- | src/caja-property-browser.c | 1 | ||||
-rw-r--r-- | src/caja-query-editor.c | 3 | ||||
-rw-r--r-- | src/caja-window-manage-views.c | 22 | ||||
-rw-r--r-- | src/caja-window.c | 3 | ||||
-rw-r--r-- | src/file-manager/fm-desktop-icon-view.c | 4 | ||||
-rw-r--r-- | src/file-manager/fm-directory-view.c | 14 | ||||
-rw-r--r-- | src/file-manager/fm-icon-view.c | 2 | ||||
-rw-r--r-- | src/file-manager/fm-list-view.c | 8 | ||||
-rw-r--r-- | src/file-manager/fm-properties-window.c | 4 | ||||
-rw-r--r-- | src/file-manager/fm-tree-model.c | 9 | ||||
-rw-r--r-- | src/file-manager/fm-tree-view.c | 4 | ||||
-rw-r--r-- | src/glibcompat.h | 18 |
18 files changed, 35 insertions, 136 deletions
diff --git a/src/caja-application.c b/src/caja-application.c index f09e2720..f70fbae7 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -464,12 +464,10 @@ menu_provider_items_updated_handler (CajaMenuProvider *provider, GtkWidget* pare static void menu_provider_init_callback (void) { - GList *items; GList *providers; GList *l; providers = caja_module_get_extensions_for_type (CAJA_TYPE_MENU_PROVIDER); - items = NULL; for (l = providers; l != NULL; l = l->next) { @@ -784,7 +782,6 @@ open_window (CajaApplication *application, { GFile *location; CajaWindow *window; - gboolean existing; if (uri == NULL) { location = g_file_new_for_path (g_get_home_dir ()); @@ -792,8 +789,6 @@ open_window (CajaApplication *application, location = g_file_new_for_uri (uri); } - existing = FALSE; - if (browser_window || g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ALWAYS_USE_BROWSER)) { window = caja_application_create_navigation_window (application, diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c index ef532d72..3db0d05b 100644 --- a/src/caja-file-management-properties.c +++ b/src/caja-file-management-properties.c @@ -726,35 +726,15 @@ bind_builder_bool (GtkBuilder *builder, "active", G_SETTINGS_BIND_DEFAULT); } -static gboolean -inverted_get_mapping (GValue *value, - GVariant *variant, - gpointer user_data) -{ - g_value_set_boolean (value, !g_variant_get_boolean (variant)); - return TRUE; -} - -static GVariant * -inverted_set_mapping (const GValue *value, - const GVariantType *expected_type, - gpointer user_data) -{ - return g_variant_new_boolean (!g_value_get_boolean (value)); -} - static void bind_builder_bool_inverted (GtkBuilder *builder, GSettings *settings, const char *widget_name, const char *prefs) { - g_settings_bind_with_mapping (settings, prefs, + g_settings_bind (settings, prefs, gtk_builder_get_object (builder, widget_name), - "active", G_SETTINGS_BIND_DEFAULT, - inverted_get_mapping, - inverted_set_mapping, - NULL, NULL); + "active", G_SETTINGS_BIND_INVERT_BOOLEAN); } static gboolean diff --git a/src/caja-navigation-window-slot.c b/src/caja-navigation-window-slot.c index 36d92808..6c4cfbc6 100644 --- a/src/caja-navigation-window-slot.c +++ b/src/caja-navigation-window-slot.c @@ -133,11 +133,9 @@ caja_navigation_window_slot_update_query_editor (CajaWindowSlot *slot) CajaDirectory *directory; CajaSearchDirectory *search_directory; CajaQuery *query; - CajaNavigationWindow *navigation_window; GtkWidget *query_editor; g_assert (slot->pane->window != NULL); - navigation_window = CAJA_NAVIGATION_WINDOW (slot->pane->window); query_editor = NULL; @@ -192,11 +190,9 @@ static void caja_navigation_window_slot_active (CajaWindowSlot *slot) { CajaNavigationWindow *window; - CajaNavigationWindowSlot *navigation_slot; CajaNavigationWindowPane *pane; int page_num; - navigation_slot = CAJA_NAVIGATION_WINDOW_SLOT (slot); pane = CAJA_NAVIGATION_WINDOW_PANE (slot->pane); window = CAJA_NAVIGATION_WINDOW (slot->pane->window); diff --git a/src/caja-navigation-window.c b/src/caja-navigation-window.c index e5622af7..4b03a865 100644 --- a/src/caja-navigation-window.c +++ b/src/caja-navigation-window.c @@ -509,16 +509,6 @@ caja_navigation_window_tear_down_sidebar (CajaNavigationWindow *window) window->sidebar = NULL; } -static void -caja_navigation_window_unrealize (GtkWidget *widget) -{ - CajaNavigationWindow *window; - - window = CAJA_NAVIGATION_WINDOW (widget); - - GTK_WIDGET_CLASS (parent_class)->unrealize (widget); -} - static gboolean caja_navigation_window_state_event (GtkWidget *widget, GdkEventWindowState *event) @@ -759,14 +749,11 @@ static void real_sync_title (CajaWindow *window, CajaWindowSlot *slot) { - CajaNavigationWindow *navigation_window; CajaNavigationWindowPane *pane; CajaNotebook *notebook; char *full_title; char *window_title; - navigation_window = CAJA_NAVIGATION_WINDOW (window); - EEL_CALL_PARENT (CAJA_WINDOW_CLASS, sync_title, (window, slot)); @@ -1265,7 +1252,6 @@ caja_navigation_window_class_init (CajaNavigationWindowClass *class) GTK_OBJECT_CLASS (class)->destroy = caja_navigation_window_destroy; #endif GTK_WIDGET_CLASS (class)->show = caja_navigation_window_show; - GTK_WIDGET_CLASS (class)->unrealize = caja_navigation_window_unrealize; GTK_WIDGET_CLASS (class)->window_state_event = caja_navigation_window_state_event; GTK_WIDGET_CLASS (class)->key_press_event = caja_navigation_window_key_press_event; GTK_WIDGET_CLASS (class)->button_press_event = caja_navigation_window_button_press_event; diff --git a/src/caja-pathbar.c b/src/caja-pathbar.c index 30879096..9de3ea03 100644 --- a/src/caja-pathbar.c +++ b/src/caja-pathbar.c @@ -1403,7 +1403,6 @@ button_clicked_cb (GtkWidget *button, ButtonData *button_data; CajaPathBar *path_bar; GList *button_list; - gboolean child_is_hidden; button_data = BUTTON_DATA (data); if (button_data->ignore_changes) @@ -1418,17 +1417,6 @@ button_clicked_cb (GtkWidget *button, gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); - if (button_list->prev) - { - ButtonData *child_data; - - child_data = BUTTON_DATA (button_list->prev->data); - child_is_hidden = child_data->file_is_hidden; - } - else - { - child_is_hidden = FALSE; - } g_signal_emit (path_bar, path_bar_signals [PATH_CLICKED], 0, button_data->path); } diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c index fa588663..88e7d1c1 100644 --- a/src/caja-places-sidebar.c +++ b/src/caja-places-sidebar.c @@ -53,7 +53,7 @@ #include "caja-places-sidebar.h" #include "caja-window.h" -#include "glibcompat.h" /* for g_list_free_full */ +#include "glibcompat.h" /* for g_list_free_full and g_clear_object */ #define EJECT_BUTTON_XPAD 6 #define ICON_CELL_XPAD 6 @@ -3332,20 +3332,10 @@ caja_places_sidebar_dispose (GObject *object) sidebar->eject_highlight_path = NULL; } - if (sidebar->store != NULL) { - g_object_unref (sidebar->store); - sidebar->store = NULL; - } - - if (sidebar->volume_monitor != NULL) { - g_object_unref (sidebar->volume_monitor); - sidebar->volume_monitor = NULL; - } - - if (sidebar->bookmarks != NULL) { - g_object_unref (sidebar->bookmarks); - sidebar->bookmarks = NULL; - } + g_clear_object (&sidebar->store); + g_clear_object (&sidebar->volume_monitor); + g_clear_object (&sidebar->bookmarks); + g_clear_object (&sidebar->filter_model); eel_remove_weak_pointer (&(sidebar->go_to_after_mount_slot)); diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c index e18e6b91..7d9b33d2 100644 --- a/src/caja-property-browser.c +++ b/src/caja-property-browser.c @@ -1109,7 +1109,6 @@ caja_emblem_dialog_new (CajaPropertyBrowser *property_browser) gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2); - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), table, TRUE, TRUE, 0); gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_OK); diff --git a/src/caja-query-editor.c b/src/caja-query-editor.c index 647a4fb0..34488d8e 100644 --- a/src/caja-query-editor.c +++ b/src/caja-query-editor.c @@ -782,13 +782,10 @@ remove_group_types_from_list (char **group_types, GList *mime_types) GList *l, *next; char **group_type; char *mime_type; - gboolean found; group_type = group_types; while (*group_type != NULL) { - found = FALSE; - for (l = mime_types; l != NULL; l = next) { mime_type = l->data; diff --git a/src/caja-window-manage-views.c b/src/caja-window-manage-views.c index 117412c8..7cdf8e70 100644 --- a/src/caja-window-manage-views.c +++ b/src/caja-window-manage-views.c @@ -126,13 +126,10 @@ caja_window_report_selection_changed (CajaWindowInfo *window) static void set_displayed_location (CajaWindowSlot *slot, GFile *location) { - CajaWindow *window; GFile *bookmark_location; gboolean recreate; char *name; - window = slot->pane->window; - if (slot->current_location_bookmark == NULL || location == NULL) { recreate = TRUE; @@ -529,14 +526,13 @@ caja_window_slot_open_location_full (CajaWindowSlot *slot, char *old_uri, *new_uri; int new_slot_position; GList *l; - gboolean target_spatial, target_navigation, target_same; + gboolean target_navigation, target_same; gboolean is_desktop; window = slot->pane->window; target_window = NULL; target_slot = NULL; - target_spatial = target_navigation = target_same = FALSE; old_uri = caja_window_slot_get_location_uri (slot); if (old_uri == NULL) @@ -573,11 +569,6 @@ caja_window_slot_open_location_full (CajaWindowSlot *slot, } else { target_same = TRUE; } - } - else if (CAJA_IS_SPATIAL_WINDOW (window)) - { - /* don't always use browser: if source is spatial, target is spatial */ - target_spatial = TRUE; } else if (flags & CAJA_WINDOW_OPEN_FLAG_NEW_WINDOW) { /* if it's specified to open a new window, and we're not using spatial, * the target is a navigation. @@ -585,9 +576,6 @@ caja_window_slot_open_location_full (CajaWindowSlot *slot, target_navigation = TRUE; } break; - case CAJA_WINDOW_OPEN_IN_SPATIAL : - target_spatial = TRUE; - break; case CAJA_WINDOW_OPEN_IN_NAVIGATION : target_navigation = TRUE; break; @@ -1121,14 +1109,12 @@ mount_not_mounted_callback (GObject *source_object, gpointer user_data) { MountNotMountedData *data; - CajaWindow *window; CajaWindowSlot *slot; GError *error; GCancellable *cancellable; data = user_data; slot = data->slot; - window = slot->pane->window; cancellable = data->cancellable; g_free (data); @@ -1733,15 +1719,12 @@ found_mount_cb (GObject *source_object, { FindMountData *data = user_data; GMount *mount; - CajaWindowSlot *slot; if (g_cancellable_is_cancelled (data->cancellable)) { goto out; } - slot = data->slot; - mount = g_file_find_enclosing_mount_finish (G_FILE (source_object), res, NULL); @@ -2080,7 +2063,6 @@ display_view_selection_failure (CajaWindow *window, CajaFile *file, char *error_message; char *detail_message; char *scheme_string; - GtkDialog *dialog; /* Some sort of failure occurred. How 'bout we tell the user? */ full_uri_for_display = g_file_get_parse_name (location); @@ -2179,7 +2161,7 @@ display_view_selection_failure (CajaWindow *window, CajaFile *file, detail_message = g_strdup_printf (_("Error: %s\nPlease select another viewer and try again."), error->message); } - dialog = eel_show_error_dialog (error_message, detail_message, NULL); + eel_show_error_dialog (error_message, detail_message, NULL); g_free (uri_for_display); g_free (error_message); diff --git a/src/caja-window.c b/src/caja-window.c index 489e7651..782e2607 100644 --- a/src/caja-window.c +++ b/src/caja-window.c @@ -1395,13 +1395,10 @@ refresh_stored_viewers (CajaWindow *window) static void load_view_as_menu (CajaWindow *window) { - CajaWindowSlot *slot; GList *node; int index; guint merge_id; - slot = window->details->active_pane->active_slot; - if (window->details->short_list_merge_id != 0) { gtk_ui_manager_remove_ui (window->details->ui_manager, diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index 3885ca13..06fdc930 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -575,8 +575,8 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (icon_container)); vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (icon_container)); - eel_gtk_adjustment_set_value (hadj, 0); - eel_gtk_adjustment_set_value (vadj, 0); + gtk_adjustment_set_value (hadj, 0); + gtk_adjustment_set_value (vadj, 0); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (desktop_icon_view), GTK_SHADOW_NONE); diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index e0dfce34..8b1afaaf 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -1189,10 +1189,8 @@ select_pattern (FMDirectoryView *view) GtkWidget *example; GtkWidget *table; GtkWidget *entry; - GList *ret; char *example_pattern; - ret = NULL; dialog = gtk_dialog_new_with_buttons (_("Select Items Matching"), fm_directory_view_get_containing_window (view), GTK_DIALOG_DESTROY_WITH_PARENT, @@ -1318,7 +1316,6 @@ action_save_search_as_callback (GtkAction *action, { FMDirectoryView *directory_view; CajaSearchDirectory *search; - CajaQuery *query; GtkWidget *dialog, *table, *label, *entry, *chooser, *save_button; const char *entry_text; char *filename, *filename_utf8, *dirname, *path, *uri; @@ -1330,8 +1327,6 @@ action_save_search_as_callback (GtkAction *action, CAJA_IS_SEARCH_DIRECTORY (directory_view->details->model)) { search = CAJA_SEARCH_DIRECTORY (directory_view->details->model); - query = caja_search_directory_get_query (search); - dialog = gtk_dialog_new_with_buttons (_("Save Search as"), fm_directory_view_get_containing_window (directory_view), 0, @@ -6834,6 +6829,7 @@ connect_to_server_response_callback (GtkDialog *dialog, int response_id, gpointer data) { +#ifdef GIO_CONVERSION_DONE GtkEntry *entry; char *uri; const char *name; @@ -6846,9 +6842,7 @@ connect_to_server_response_callback (GtkDialog *dialog, uri = g_object_get_data (G_OBJECT (dialog), "link-uri"); icon = g_object_get_data (G_OBJECT (dialog), "link-icon"); name = gtk_entry_get_text (entry); -#ifdef GIO_CONVERSION_DONE mate_vfs_connect_to_server (uri, (char *)name, icon); -#endif gtk_widget_destroy (GTK_WIDGET (dialog)); break; case GTK_RESPONSE_NONE: @@ -6859,6 +6853,9 @@ connect_to_server_response_callback (GtkDialog *dialog, default : g_assert_not_reached (); } +#endif + /* FIXME: the above code should make a server connection permanent */ + gtk_widget_destroy (GTK_WIDGET (dialog)); } static void @@ -9551,9 +9548,6 @@ metadata_for_files_in_directory_ready_callback (CajaDirectory *directory, static void finish_undoredo_callback (gpointer data) { - FMDirectoryView *view; - - view = FM_DIRECTORY_VIEW (data); } char ** diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index 414aae37..c624610a 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -1470,12 +1470,10 @@ fm_icon_view_set_zoom_level (FMIconView *view, static void fm_icon_view_bump_zoom_level (FMDirectoryView *view, int zoom_increment) { - FMIconView *icon_view; CajaZoomLevel new_level; g_return_if_fail (FM_IS_ICON_VIEW (view)); - icon_view = FM_ICON_VIEW (view); new_level = fm_icon_view_get_zoom_level (view) + zoom_increment; if (new_level >= CAJA_ZOOM_LEVEL_SMALLEST && diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index 1ed8cd91..72e3f55c 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -531,7 +531,6 @@ motion_notify_callback (GtkWidget *widget, gpointer callback_data) { FMListView *view; - GdkDragContext *context; view = FM_LIST_VIEW (callback_data); @@ -581,7 +580,7 @@ motion_notify_callback (GtkWidget *widget, event->x, event->y)) { - context = gtk_drag_begin + gtk_drag_begin (widget, source_target_list, GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_ASK, @@ -663,7 +662,6 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba GtkTreeView *tree_view; GtkTreePath *path; gboolean call_parent; - gboolean allow_drag; GtkTreeSelection *selection; GtkWidgetClass *tree_view_class; gint64 current_time; @@ -715,7 +713,6 @@ button_press_callback (GtkWidget *widget, GdkEventButton *event, gpointer callba view->details->ignore_button_release = FALSE; call_parent = TRUE; - allow_drag = FALSE; if (gtk_tree_view_get_path_at_pos (tree_view, event->x, event->y, &path, NULL, NULL, NULL)) { @@ -1220,11 +1217,8 @@ sort_criterion_changes_due_to_user (GtkTreeView *tree_view) GList *columns, *p; GtkTreeViewColumn *column; GSignalInvocationHint *ihint; - unsigned int sort_signal_id; gboolean ret; - sort_signal_id = g_signal_lookup ("clicked", gtk_tree_view_column_get_type ()); - ret = FALSE; columns = gtk_tree_view_get_columns (tree_view); diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c index 29666607..a62fbec5 100644 --- a/src/file-manager/fm-properties-window.c +++ b/src/file-manager/fm-properties-window.c @@ -739,13 +739,11 @@ static void rename_callback (CajaFile *file, GFile *res_loc, GError *error, gpointer callback_data) { FMPropertiesWindow *window; - char *new_name; window = FM_PROPERTIES_WINDOW (callback_data); /* Complain to user if rename failed. */ if (error != NULL) { - new_name = window->details->pending_name; fm_report_error_renaming_file (file, window->details->pending_name, error, @@ -5226,7 +5224,7 @@ create_properties_window (StartupData *startup_data) CAJA_FILE_ATTRIBUTE_INFO | CAJA_FILE_ATTRIBUTE_LINK_INFO; - caja_file_monitor_add (CAJA_FILE (l->data), + caja_file_monitor_add (file, &window->details->original_files, attributes); } diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c index 6babc2d3..604c660e 100644 --- a/src/file-manager/fm-tree-model.c +++ b/src/file-manager/fm-tree-model.c @@ -753,8 +753,6 @@ report_dummy_row_contents_changed (FMTreeModel *model, TreeNode *parent) static void stop_monitoring_directory (FMTreeModel *model, TreeNode *node) { - CajaDirectory *directory; - if (node->done_loading_id == 0) { g_assert (node->files_added_id == 0); @@ -762,8 +760,6 @@ stop_monitoring_directory (FMTreeModel *model, TreeNode *node) return; } - directory = node->directory; - g_signal_handler_disconnect (node->directory, node->done_loading_id); g_signal_handler_disconnect (node->directory, node->files_added_id); g_signal_handler_disconnect (node->directory, node->files_changed_id); @@ -1347,12 +1343,10 @@ static void fm_tree_model_get_value (GtkTreeModel *model, GtkTreeIter *iter, int column, GValue *value) { TreeNode *node, *parent; - FMTreeModel *fm_model; g_return_if_fail (FM_IS_TREE_MODEL (model)); g_return_if_fail (iter_is_valid (FM_TREE_MODEL (model), iter)); - fm_model = FM_TREE_MODEL (model); node = iter->user_data; switch (column) @@ -1482,15 +1476,12 @@ fm_tree_model_iter_has_child (GtkTreeModel *model, GtkTreeIter *iter) static int fm_tree_model_iter_n_children (GtkTreeModel *model, GtkTreeIter *iter) { - FMTreeModel *tree_model; TreeNode *parent, *node; int n; g_return_val_if_fail (FM_IS_TREE_MODEL (model), FALSE); g_return_val_if_fail (iter == NULL || iter_is_valid (FM_TREE_MODEL (model), iter), FALSE); - tree_model = FM_TREE_MODEL (model); - if (iter == NULL) { return 1; diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c index 32053db3..5c0e96fc 100644 --- a/src/file-manager/fm-tree-view.c +++ b/src/file-manager/fm-tree-view.c @@ -617,10 +617,6 @@ static char * get_root_uri_callback (CajaTreeViewDragDest *dest, gpointer user_data) { - FMTreeView *view; - - view = FM_TREE_VIEW (user_data); - /* Don't allow drops on background */ return NULL; } diff --git a/src/glibcompat.h b/src/glibcompat.h index a83da239..4c71b2b5 100644 --- a/src/glibcompat.h +++ b/src/glibcompat.h @@ -38,4 +38,22 @@ g_list_free_full (GList *list, GDestroyNotify free_func) } #endif +#if !GLIB_CHECK_VERSION(2,28,0) +static inline void +g_clear_object_inline(volatile GObject **object_ptr) +{ + gpointer * const ptr = (gpointer)object_ptr; + gpointer old; + + do { + old = g_atomic_pointer_get(ptr); + } while G_UNLIKELY(!g_atomic_pointer_compare_and_exchange(ptr, old, NULL)); + + if (old) + g_object_unref(old); +} +#undef g_clear_object +#define g_clear_object(obj) g_clear_object_inline((volatile GObject **)(obj)) +#endif + #endif /* GLIB_COMPAT_H */ |