Commit 4303c5b2 authored by Cosimo Cecchi's avatar Cosimo Cecchi

all: use g_object_add/remove_weak_pointer()

Instead of the eel helpers.
parent 2aca9d40
......@@ -923,7 +923,9 @@ init_common (gsize job_size,
if (parent_window) {
common->parent_window = parent_window;
eel_add_weak_pointer (&common->parent_window);
g_object_add_weak_pointer (G_OBJECT (common->parent_window),
(gpointer *) &common->parent_window);
}
common->progress = nautilus_progress_info_new ();
common->cancellable = nautilus_progress_info_get_cancellable (common->progress);
......@@ -949,7 +951,12 @@ finalize_common (CommonJob *common)
common->inhibit_cookie = -1;
g_timer_destroy (common->time);
eel_remove_weak_pointer (&common->parent_window);
if (common->parent_window) {
g_object_remove_weak_pointer (G_OBJECT (common->parent_window),
(gpointer *) &common->parent_window);
}
if (common->skip_files) {
g_hash_table_destroy (common->skip_files);
}
......@@ -2058,7 +2065,11 @@ unmount_mount_callback (GObject *source_object,
g_error_free (error);
}
eel_remove_weak_pointer (&data->parent_window);
if (data->parent_window) {
g_object_remove_weak_pointer (G_OBJECT (data->parent_window),
(gpointer *) &data->parent_window);
}
g_object_unref (data->mount);
g_free (data);
}
......@@ -2253,7 +2264,8 @@ nautilus_file_operations_unmount_mount_full (GtkWindow *par
data->callback_data = callback_data;
if (parent_window) {
data->parent_window = parent_window;
eel_add_weak_pointer (&data->parent_window);
g_object_add_weak_pointer (G_OBJECT (data->parent_window),
(gpointer *) &data->parent_window);
}
data->eject = eject;
......@@ -2280,7 +2292,12 @@ nautilus_file_operations_unmount_mount_full (GtkWindow *par
if (callback) {
callback (callback_data);
}
eel_remove_weak_pointer (&data->parent_window);
if (data->parent_window) {
g_object_remove_weak_pointer (G_OBJECT (data->parent_window),
(gpointer *) &data->parent_window);
}
g_object_unref (data->mount);
g_free (data);
return;
......
......@@ -943,9 +943,10 @@ unload_file_timeout (gpointer data)
}
gtk_tree_path_free (path);
}
}
eel_remove_weak_pointer (&unload_data->view);
g_object_remove_weak_pointer (G_OBJECT (unload_data->view),
(gpointer *) &unload_data->view);
}
if (unload_data->directory) {
nautilus_directory_unref (unload_data->directory);
......@@ -990,7 +991,8 @@ row_collapsed_callback (GtkTreeView *treeview, GtkTreeIter *iter, GtkTreePath *p
unload_data->file = file;
unload_data->directory = directory;
eel_add_weak_pointer (&unload_data->view);
g_object_add_weak_pointer (G_OBJECT (unload_data->view),
(gpointer *) &unload_data->view);
g_timeout_add_seconds (COLLAPSE_TO_UNLOAD_DELAY,
unload_file_timeout,
......@@ -2601,7 +2603,8 @@ action_visible_columns_callback (GtkAction *action,
gtk_window_present (GTK_WINDOW (list_view->details->column_editor));
} else {
list_view->details->column_editor = create_column_editor (list_view);
eel_add_weak_pointer (&list_view->details->column_editor);
g_object_add_weak_pointer (G_OBJECT (list_view->details->column_editor),
(gpointer *) &list_view->details->column_editor);
gtk_widget_show (list_view->details->column_editor);
}
......
......@@ -1812,8 +1812,10 @@ volume_mounted_cb (GVolume *volume,
g_object_unref (G_OBJECT (mount));
}
eel_remove_weak_pointer (&(sidebar->go_to_after_mount_slot));
if (sidebar->go_to_after_mount_slot) {
g_object_remove_weak_pointer (G_OBJECT (sidebar->go_to_after_mount_slot),
(gpointer *) &sidebar->go_to_after_mount_slot);
}
}
static void
......@@ -1893,7 +1895,8 @@ open_selected_bookmark (NautilusPlacesSidebar *sidebar,
slot = nautilus_window_get_active_slot (sidebar->window);
sidebar->go_to_after_mount_slot = slot;
eel_add_weak_pointer (&(sidebar->go_to_after_mount_slot));
g_object_add_weak_pointer (G_OBJECT (sidebar->go_to_after_mount_slot),
(gpointer *) &sidebar->go_to_after_mount_slot);
sidebar->go_to_after_mount_flags = flags;
......@@ -3442,7 +3445,11 @@ nautilus_places_sidebar_dispose (GObject *object)
g_clear_object (&sidebar->store);
g_clear_object (&sidebar->bookmarks);
eel_remove_weak_pointer (&(sidebar->go_to_after_mount_slot));
if (sidebar->go_to_after_mount_slot) {
g_object_remove_weak_pointer (G_OBJECT (sidebar->go_to_after_mount_slot),
(gpointer *) &sidebar->go_to_after_mount_slot);
sidebar->go_to_after_mount_slot = NULL;
}
g_signal_handlers_disconnect_by_func (nautilus_preferences,
desktop_setting_changed_callback,
......
......@@ -146,7 +146,10 @@ nautilus_query_editor_dispose (GObject *object)
editor);
nautilus_search_bar_return_entry (editor->details->bar);
eel_remove_weak_pointer (&editor->details->bar);
g_object_remove_weak_pointer (G_OBJECT (editor->details->bar),
(gpointer *) &editor->details->bar);
editor->details->bar = NULL;
}
G_OBJECT_CLASS (nautilus_query_editor_parent_class)->dispose (object);
......@@ -1278,7 +1281,8 @@ nautilus_query_editor_new_with_bar (gboolean start_hidden,
nautilus_query_editor_set_visible (editor, !start_hidden);
editor->details->bar = bar;
eel_add_weak_pointer (&editor->details->bar);
g_object_add_weak_pointer (G_OBJECT (editor->details->bar),
(gpointer *) &editor->details->bar);
editor->details->slot = slot;
......
......@@ -1868,7 +1868,12 @@ new_folder_done (GFile *new_folder,
fail:
g_hash_table_destroy (data->added_locations);
eel_remove_weak_pointer (&data->directory_view);
if (data->directory_view != NULL) {
g_object_remove_weak_pointer (G_OBJECT (data->directory_view),
(gpointer *) &data->directory_view);
}
g_free (data);
}
......@@ -1882,7 +1887,8 @@ new_folder_data_new (NautilusView *directory_view)
data->directory_view = directory_view;
data->added_locations = g_hash_table_new_full (g_file_hash, (GEqualFunc)g_file_equal,
g_object_unref, NULL);
eel_add_weak_pointer (&data->directory_view);
g_object_add_weak_pointer (G_OBJECT (data->directory_view),
(gpointer *) &data->directory_view);
return data;
}
......@@ -3089,7 +3095,11 @@ copy_move_done_data_free (CopyMoveDoneData *data)
{
g_assert (data != NULL);
eel_remove_weak_pointer (&data->directory_view);
if (data->directory_view != NULL) {
g_object_remove_weak_pointer (G_OBJECT (data->directory_view),
(gpointer *) &data->directory_view);
}
nautilus_file_list_free (data->added_files);
g_free (data);
}
......@@ -3117,7 +3127,8 @@ pre_copy_move (NautilusView *directory_view)
copy_move_done_data = g_new0 (CopyMoveDoneData, 1);
copy_move_done_data->directory_view = directory_view;
eel_add_weak_pointer (&copy_move_done_data->directory_view);
g_object_add_weak_pointer (G_OBJECT (copy_move_done_data->directory_view),
(gpointer *) &copy_move_done_data->directory_view);
/* We need to run after the default handler adds the folder we want to
* operate on. The ADD_FILE signal is registered as G_SIGNAL_RUN_LAST, so we
......
......@@ -115,6 +115,9 @@ real_update_query_editor (NautilusWindowSlot *slot)
nautilus_window_slot_add_extra_location_widget (slot, query_editor);
gtk_widget_show (query_editor);
nautilus_query_editor_grab_focus (NAUTILUS_QUERY_EDITOR (query_editor));
g_object_add_weak_pointer (G_OBJECT (slot->query_editor),
(gpointer *) &slot->query_editor);
}
nautilus_directory_unref (directory);
......@@ -588,8 +591,6 @@ nautilus_window_slot_update_query_editor (NautilusWindowSlot *slot)
}
real_update_query_editor (slot);
eel_add_weak_pointer (&slot->query_editor);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment