Commit ab5fb6c7 authored by Anders Carlsson's avatar Anders Carlsson Committed by Anders Carlsson

Remove preferences calback in ::finalize.

2002-01-08  Anders Carlsson  <andersca@gnu.org>

	* src/nautilus-zoom-control.c (nautilus_zoom_control_finalize): Remove
	preferences calback in ::finalize.
	(nautilus_zoom_control_unload_images): Set image pointers to NULL after
	unloading images.

	* src/nautilus-window-menus.c: Remove some userlevel #defines.

	* src/nautilus-switchable-search-bar.c
	(nautilus_switchable_search_bar_finalize): Remove the preferences callback
	in ::finalize instead of ::destroy.

	* src/nautilus-switchable-navigation-bar.c: Create the search bar lazily.
	Creating the search bar came up high on the profile when creating new windows,
	and doing it lazily helps, especially when we don't have medusa support yet.
	(nautilus_switchable_navigation_bar_finalize): Free details in ::finalize.

	* src/nautilus-simple-search-bar.c (nautilus_simple_search_bar_finalize):
	Free details in ::finalize.
	(nautilus_simple_search_bar_destroy): Disable the undo stuff. Perhaps we could
	call connect to "destroy" in nautilus_undo_set_up_nautilus_entry_for_undo
	and call nautilus_undo_tear_down_nautilus_entry_for_undo there instead.

	* src/nautilus-sidebar.c (nautilus_sidebar_init): Ref and sink the title tab.
	(nautilus_sidebar_finalize): Move things from ::finalize to ::destroy.

	* src/nautilus-preferences-dialog.c
	(preferences_dialog_populate_themes_group): The image chooser isn't
	broken anymore so we can enable it now.

	* src/nautilus-main.c (main): Call gtk_main instead of bonobo_main
	since bonobo_main is for non-gui apps and won't be affected by
	gtk_main_quit.

	* src/nautilus-location-bar.c: Destroy things in ::finalize
	instead of in ::destroy.

	* src/nautilus-profiler.c: Port to GtkTextView.

	* src/nautilus-application.c (nautilus_application_new):
	Call bonobo_generic_factory_construct_noreg so that we set
	the IID.
	(nautilus_application_destroy): Unref the undo manager
	in ::destroy instead.

	* libnautilus-private/nautilus-icon-container.c:
	Use g_list_sort_with_data when sorting icons so we can get rid
	of the hack_icon_container hack.

	* libnautilus-private/nautilus-entry.c: Free details struct
	in ::finalize instead of in ::destroy

	* libnautilus-private/nautilus-icon-dnd.c
	(confirm_switch_to_manual_layout): Compare with GTK_RESPONSE_YES.

	* libnautilus-private/nautilus-file-operations.c
	(confirm_empty_trash): Compare with GTK_RESPONSE_YES.

So now you know what I've been doing during christmas...
parent 81054a09
2002-01-08 Anders Carlsson <andersca@gnu.org>
* src/nautilus-zoom-control.c (nautilus_zoom_control_finalize): Remove
preferences calback in ::finalize.
(nautilus_zoom_control_unload_images): Set image pointers to NULL after
unloading images.
* src/nautilus-window-menus.c: Remove some userlevel #defines.
* src/nautilus-switchable-search-bar.c
(nautilus_switchable_search_bar_finalize): Remove the preferences callback
in ::finalize instead of ::destroy.
* src/nautilus-switchable-navigation-bar.c: Create the search bar lazily.
Creating the search bar came up high on the profile when creating new windows,
and doing it lazily helps, especially when we don't have medusa support yet.
(nautilus_switchable_navigation_bar_finalize): Free details in ::finalize.
* src/nautilus-simple-search-bar.c (nautilus_simple_search_bar_finalize):
Free details in ::finalize.
(nautilus_simple_search_bar_destroy): Disable the undo stuff. Perhaps we could
call connect to "destroy" in nautilus_undo_set_up_nautilus_entry_for_undo
and call nautilus_undo_tear_down_nautilus_entry_for_undo there instead.
* src/nautilus-sidebar.c (nautilus_sidebar_init): Ref and sink the title tab.
(nautilus_sidebar_finalize): Move things from ::finalize to ::destroy.
* src/nautilus-preferences-dialog.c
(preferences_dialog_populate_themes_group): The image chooser isn't
broken anymore so we can enable it now.
* src/nautilus-main.c (main): Call gtk_main instead of bonobo_main
since bonobo_main is for non-gui apps and won't be affected by
gtk_main_quit.
* src/nautilus-location-bar.c: Destroy things in ::finalize
instead of in ::destroy.
* src/nautilus-profiler.c: Port to GtkTextView.
* src/nautilus-application.c (nautilus_application_new):
Call bonobo_generic_factory_construct_noreg so that we set
the IID.
(nautilus_application_destroy): Unref the undo manager
in ::destroy instead.
* libnautilus-private/nautilus-icon-container.c:
Use g_list_sort_with_data when sorting icons so we can get rid
of the hack_icon_container hack.
* libnautilus-private/nautilus-entry.c: Free details struct
in ::finalize instead of in ::destroy
* libnautilus-private/nautilus-icon-dnd.c
(confirm_switch_to_manual_layout): Compare with GTK_RESPONSE_YES.
* libnautilus-private/nautilus-file-operations.c
(confirm_empty_trash): Compare with GTK_RESPONSE_YES.
2002-01-07 Darin Adler <darin@bentspoon.com>
* libnautilus-private/nautilus-desktop-file-loader.c:
......
......@@ -107,8 +107,8 @@ nautilus_entry_new_with_max_length (guint16 max)
return widget;
}
static void
nautilus_entry_destroy (GtkObject *object)
static void
nautilus_entry_finalize (GObject *object)
{
NautilusEntry *entry;
......@@ -120,7 +120,7 @@ nautilus_entry_destroy (GtkObject *object)
g_free (entry->details);
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
static void
......@@ -439,11 +439,14 @@ nautilus_entry_class_init (NautilusEntryClass *class)
{
GtkWidgetClass *widget_class;
GtkObjectClass *object_class;
GObjectClass *gobject_class;
#if GNOME2_CONVERSION_COMPLETE
GtkEditableClass *editable_class;
#endif
widget_class = GTK_WIDGET_CLASS (class);
gobject_class = G_OBJECT_CLASS (class);
object_class = GTK_OBJECT_CLASS (class);
#if GNOME2_CONVERSION_COMPLETE
editable_class = GTK_EDITABLE_CLASS (class);
......@@ -455,7 +458,7 @@ nautilus_entry_class_init (NautilusEntryClass *class)
widget_class->motion_notify_event = nautilus_entry_motion_notify;
widget_class->selection_clear_event = nautilus_entry_selection_clear;
object_class->destroy = nautilus_entry_destroy;
gobject_class->finalize = nautilus_entry_finalize;
#if GNOME2_CONVERSION_COMPLETE
editable_class->insert_text = nautilus_entry_insert_text;
......
......@@ -2297,7 +2297,7 @@ confirm_empty_trash (GtkWidget *parent_view)
gtk_object_destroy (GTK_OBJECT (dialog));
return response == GTK_RESPONSE_OK;
return response == GTK_RESPONSE_YES;
}
void
......
......@@ -693,10 +693,8 @@ nautilus_icon_container_update_scroll_region (NautilusIconContainer *container)
eel_gtk_adjustment_clamp_value (vadj);
}
static NautilusIconContainer *sort_hack_container;
static int
compare_icons (gconstpointer a, gconstpointer b)
compare_icons (gconstpointer a, gconstpointer b, gpointer icon_container)
{
const NautilusIcon *icon_a, *icon_b;
int result;
......@@ -705,7 +703,7 @@ compare_icons (gconstpointer a, gconstpointer b)
icon_b = b;
result = 0;
g_signal_emit (sort_hack_container,
g_signal_emit (icon_container,
signals[COMPARE_ICONS], 0,
icon_a->data,
icon_b->data,
......@@ -717,12 +715,11 @@ static void
sort_icons (NautilusIconContainer *container,
GList **icons)
{
sort_hack_container = container;
*icons = g_list_sort (*icons, compare_icons);
*icons = g_list_sort_with_data (*icons, compare_icons, container);
}
static int
compare_icons_by_name (gconstpointer a, gconstpointer b)
compare_icons_by_name (gconstpointer a, gconstpointer b, gpointer icon_container)
{
const NautilusIcon *icon_a, *icon_b;
int result;
......@@ -731,7 +728,7 @@ compare_icons_by_name (gconstpointer a, gconstpointer b)
icon_b = b;
result = 0;
g_signal_emit (sort_hack_container,
g_signal_emit (icon_container,
signals[COMPARE_ICONS_BY_NAME], 0,
icon_a->data,
icon_b->data,
......@@ -743,8 +740,7 @@ static void
sort_icons_by_name (NautilusIconContainer *container,
GList **icons)
{
sort_hack_container = container;
*icons = g_list_sort (*icons, compare_icons_by_name);
*icons = g_list_sort_with_data (*icons, compare_icons_by_name, container);
}
......
......@@ -796,7 +796,7 @@ confirm_switch_to_manual_layout (NautilusIconContainer *container)
response = gtk_dialog_run (dialog);
gtk_object_destroy (GTK_OBJECT (dialog));
return response == GTK_RESPONSE_OK;
return response == GTK_RESPONSE_YES;
}
static void
......
......@@ -161,11 +161,19 @@ nautilus_application_init (NautilusApplication *application)
NautilusApplication *
nautilus_application_new (void)
{
return NAUTILUS_APPLICATION (g_object_new (nautilus_application_get_type (), NULL));
NautilusApplication *application;
application = g_object_new (NAUTILUS_TYPE_APPLICATION, NULL);
bonobo_generic_factory_construct_noreg (BONOBO_GENERIC_FACTORY (application),
FACTORY_IID,
NULL);
return application;
}
static void
nautilus_application_finalize (GObject *object)
nautilus_application_destroy (BonoboObject *object)
{
NautilusApplication *application;
......@@ -175,7 +183,7 @@ nautilus_application_finalize (GObject *object)
bonobo_object_unref (BONOBO_OBJECT (application->undo_manager));
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
EEL_CALL_PARENT (BONOBO_OBJECT_CLASS, destroy, (object));
}
static gboolean
......@@ -1042,7 +1050,7 @@ is_kdesktop_present (void)
static void
nautilus_application_class_init (NautilusApplicationClass *klass)
{
G_OBJECT_CLASS (klass)->finalize = nautilus_application_finalize;
BONOBO_OBJECT_CLASS (klass)->destroy = nautilus_application_destroy;
BONOBO_GENERIC_FACTORY_CLASS (klass)->epv.createObject = create_object;
}
......@@ -105,6 +105,7 @@ static gboolean nautilus_sidebar_leave_event (GtkWidget *widget
static gboolean nautilus_sidebar_motion_event (GtkWidget *widget,
GdkEventMotion *event);
static void nautilus_sidebar_destroy (GtkObject *object);
static void nautilus_sidebar_finalize (GObject *object);
static void nautilus_sidebar_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
int x,
......@@ -175,14 +176,18 @@ static void
nautilus_sidebar_class_init (GtkObjectClass *object_klass)
{
GtkWidgetClass *widget_class;
GObjectClass *gobject_class;
NautilusSidebarClass *klass;
widget_class = GTK_WIDGET_CLASS (object_klass);
klass = NAUTILUS_SIDEBAR_CLASS (object_klass);
gobject_class = G_OBJECT_CLASS (object_klass);
gobject_class->finalize = nautilus_sidebar_finalize;
object_klass->destroy = nautilus_sidebar_destroy;
widget_class->drag_data_received = nautilus_sidebar_drag_data_received;
widget_class->motion_notify_event = nautilus_sidebar_motion_event;
widget_class->leave_notify_event = nautilus_sidebar_leave_event;
......@@ -265,6 +270,9 @@ nautilus_sidebar_init (GtkObject *object)
/* also, allocate the title tab */
sidebar->details->title_tab = NAUTILUS_SIDEBAR_TABS (nautilus_sidebar_tabs_new ());
g_object_ref (sidebar->details->title_tab);
gtk_object_sink (GTK_OBJECT (sidebar->details->title_tab));
nautilus_sidebar_tabs_set_title_mode (sidebar->details->title_tab, TRUE);
gtk_widget_show (GTK_WIDGET (sidebar->details->sidebar_tabs));
......@@ -304,35 +312,47 @@ nautilus_sidebar_destroy (GtkObject *object)
sidebar = NAUTILUS_SIDEBAR (object);
if (sidebar->details) {
if (sidebar->details->notebook != NULL) {
g_object_unref (sidebar->details->notebook);
sidebar->details->notebook = NULL;
}
if (sidebar->details->title_tab != NULL) {
g_object_unref (sidebar->details->title_tab);
sidebar->details->title_tab = NULL;
}
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
}
if (sidebar->details->file != NULL) {
gtk_signal_disconnect (GTK_OBJECT (sidebar->details->file),
sidebar->details->file_changed_connection);
nautilus_file_monitor_remove (sidebar->details->file, sidebar);
nautilus_file_unref (sidebar->details->file);
}
gtk_object_sink (GTK_OBJECT (sidebar->details->title_tab));
g_free (sidebar->details->uri);
g_free (sidebar->details->default_background_color);
g_free (sidebar->details->default_background_image);
g_free (sidebar->details);
sidebar->details = NULL;
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME,
nautilus_sidebar_theme_changed,
sidebar);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_CONFIRM_TRASH,
nautilus_sidebar_confirm_trash_changed,
sidebar);
static void
nautilus_sidebar_finalize (GObject *object)
{
NautilusSidebar *sidebar;
sidebar = NAUTILUS_SIDEBAR (object);
if (sidebar->details->file != NULL) {
gtk_signal_disconnect (GTK_OBJECT (sidebar->details->file),
sidebar->details->file_changed_connection);
nautilus_file_monitor_remove (sidebar->details->file, sidebar);
nautilus_file_unref (sidebar->details->file);
}
g_free (sidebar->details->uri);
g_free (sidebar->details->default_background_color);
g_free (sidebar->details->default_background_image);
g_free (sidebar->details);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME,
nautilus_sidebar_theme_changed,
sidebar);
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_CONFIRM_TRASH,
nautilus_sidebar_confirm_trash_changed,
sidebar);
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
/* callback to handle resetting the background */
......
......@@ -583,6 +583,18 @@ real_activate (NautilusNavigationBar *navigation_bar)
nautilus_entry_select_all (bar->details->entry);
}
static void
finalize (GObject *object)
{
NautilusLocationBar *bar;
bar = NAUTILUS_LOCATION_BAR (object);
g_free (bar->details);
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
static void
destroy (GtkObject *object)
{
......@@ -593,17 +605,19 @@ destroy (GtkObject *object)
/* cancel the pending idle call, if any */
if (bar->details->idle_id != 0) {
gtk_idle_remove (bar->details->idle_id);
bar->details->idle_id = 0;
}
if (bar->details->file_info_list) {
gnome_vfs_file_info_list_free (bar->details->file_info_list);
bar->details->file_info_list = NULL;
}
g_free (bar->details->current_directory);
bar->details->current_directory = NULL;
g_free (bar->details->last_location);
g_free (bar->details);
bar->details->last_location = NULL;
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
}
......@@ -611,8 +625,12 @@ destroy (GtkObject *object)
static void
nautilus_location_bar_class_init (NautilusLocationBarClass *class)
{
GObjectClass *gobject_class;
GtkObjectClass *object_class;
NautilusNavigationBarClass *navigation_bar_class;
gobject_class = G_OBJECT_CLASS (class);
gobject_class->finalize = finalize;
object_class = GTK_OBJECT_CLASS (class);
object_class->destroy = destroy;
......
......@@ -37,6 +37,7 @@
#include <X11/Xlib.h>
#include <bonobo-activation/bonobo-activation.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-ui-main.h>
#include <dlfcn.h>
#include <eel/eel-debug.h>
#include <eel/eel-glib-extensions.h>
......@@ -196,11 +197,6 @@ main (int argc, char *argv[])
popt_context = g_value_get_pointer (&context_as_value);
#if GNOME2_CONVERSION_COMPLETE
gnomelib_register_popt_table (bonobo_activation_popt_options,
bonobo_activation_get_popt_table_name ());
#endif
eel_setenv ("DISPLAY", DisplayString (GDK_DISPLAY ()), TRUE);
/* Check for argument consistency. */
......@@ -274,7 +270,7 @@ main (int argc, char *argv[])
geometry,
args);
if (is_event_loop_needed ()) {
bonobo_main ();
gtk_main ();
}
bonobo_object_unref (BONOBO_OBJECT (application));
}
......@@ -302,5 +298,5 @@ main (int argc, char *argv[])
execvp (argv[0], argv_copy);
}
return bonobo_debug_shutdown ();
return bonobo_ui_debug_shutdown ();
}
......@@ -92,11 +92,6 @@
#define COMMAND_PATH_CLOSE_WINDOW "/commands/Close"
#define SWITCH_TO_BEGINNER_VERB "Switch to Beginner Level"
#define SWITCH_TO_INTERMEDIATE_VERB "Switch to Intermediate Level"
#define SWITCH_TO_ADVANCED_VERB "Switch to Advanced Level"
#define USER_MANUAL_URI "help:nautilus-user-manual"
#define QUICK_REFERENCE_URI "help:nautilus-quick-reference"
#define RELEASE_NOTES_URI "help:nautilus-release-notes"
......@@ -119,11 +114,6 @@ static void schedule_refresh_bookmarks_menu (Naut
static void edit_bookmarks (NautilusWindow *window);
static void add_bookmark_for_current_location (NautilusWindow *window);
#define NAUTILUS_MENU_PATH_NOVICE_ITEM "/menu/Preferences/User Levels Placeholder/Switch to Beginner Level"
#define NAUTILUS_MENU_PATH_INTERMEDIATE_ITEM "/menu/Preferences/User Levels Placeholder/Switch to Intermediate Level"
#define NAUTILUS_MENU_PATH_EXPERT_ITEM "/menu/Preferences/User Levels Placeholder/Switch to Advanced Level"
#define NAUTILUS_MENU_PATH_USER_LEVEL_CUSTOMIZE "/menu/Preferences/User Level Customization"
/* Struct that stores all the info necessary to activate a bookmark. */
typedef struct {
NautilusBookmark *bookmark;
......
......@@ -34,12 +34,15 @@
#include <glib.h>
#include <gtk/gtkbutton.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtksignal.h>
#include <gtk/gtktext.h>
#include <gtk/gtktextbuffer.h>
#include <gtk/gtktextview.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkvscrollbar.h>
#include <gtk/gtkwindow.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
......@@ -108,27 +111,38 @@ typedef struct
{
GtkWidget *main_box;
GtkWidget *text;
GtkWidget *ver_scroll_bar;
GtkTextBuffer *text_buffer;
} ScrolledText;
static ScrolledText *
scrolled_text_new (void)
{
ScrolledText *scrolled_text;
GtkWidget *scrolled_window;
scrolled_text = g_new (ScrolledText, 1);
scrolled_text->main_box = gtk_hbox_new (FALSE, 0);
scrolled_text->text_buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_create_tag (scrolled_text->text_buffer, "fixed_font",
"family", "monospace",
"wrap_mode", GTK_WRAP_NONE,
NULL);
scrolled_text->text = gtk_text_new (NULL, NULL);
scrolled_text->text = gtk_text_view_new_with_buffer (scrolled_text->text_buffer);
scrolled_text->ver_scroll_bar = gtk_vscrollbar_new (GTK_TEXT (scrolled_text->text)->vadj);
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scrolled_window),
scrolled_text->text);
gtk_box_pack_start (GTK_BOX (scrolled_text->main_box), scrolled_text->text, TRUE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (scrolled_text->main_box), scrolled_text->ver_scroll_bar, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (scrolled_text->main_box), scrolled_window, TRUE, TRUE, 0);
gtk_widget_show (scrolled_text->ver_scroll_bar);
gtk_widget_show (scrolled_text->text);
gtk_widget_show_all (scrolled_window);
return scrolled_text;
}
......@@ -180,7 +194,7 @@ dump_dialog_new (const char *title)
dump_dialog = g_new (DumpDialog, 1);
dump_dialog->window = gtk_window_new (GTK_WINDOW_DIALOG);
dump_dialog->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
eel_gtk_window_set_up_close_accelerator
(GTK_WINDOW (dump_dialog->window));
g_signal_connect (dump_dialog->window,
......@@ -192,10 +206,8 @@ dump_dialog_new (const char *title)
main_box = gtk_vbox_new (FALSE, 0);
dump_dialog->scrolled_text = scrolled_text_new ();
gtk_text_set_editable (GTK_TEXT (dump_dialog->scrolled_text->text), FALSE);
gtk_text_set_word_wrap (GTK_TEXT (dump_dialog->scrolled_text->text), FALSE);
gtk_text_set_line_wrap (GTK_TEXT (dump_dialog->scrolled_text->text), FALSE);
gtk_text_view_set_editable (GTK_TEXT_VIEW (dump_dialog->scrolled_text->text), FALSE);
print_button = gtk_button_new_with_label (_("Print"));
save_button = gtk_button_new_with_label (_("Save"));
......@@ -232,37 +244,28 @@ static void
dump_dialog_show (const char *dump_data, const char *title)
{
static DumpDialog *dump_dialog = NULL;
GdkFont *font;
GtkTextBuffer *buffer;
GtkTextIter start_iter, end_iter;
g_return_if_fail (dump_data != NULL);
if (dump_dialog == NULL) {
dump_dialog = dump_dialog_new (_("Profile Dump"));
}
gtk_text_forward_delete (GTK_TEXT (dump_dialog->scrolled_text->text),
gtk_text_get_length (GTK_TEXT (dump_dialog->scrolled_text->text)));
buffer = dump_dialog->scrolled_text->text_buffer;
font = eel_gdk_font_get_fixed ();
gtk_text_freeze (GTK_TEXT (dump_dialog->scrolled_text->text));
/* delete existing text in buffer */
gtk_text_set_point (GTK_TEXT (dump_dialog->scrolled_text->text), 0);
gtk_text_forward_delete (GTK_TEXT (dump_dialog->scrolled_text->text),
gtk_text_get_length(GTK_TEXT (dump_dialog->scrolled_text->text)));
gtk_text_insert (GTK_TEXT (dump_dialog->scrolled_text->text),
font,
NULL,
NULL,
dump_data,
strlen (dump_data));
gtk_text_thaw (GTK_TEXT (dump_dialog->scrolled_text->text));
gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
gtk_text_buffer_delete (buffer, &start_iter, &end_iter);
gdk_font_unref (font);
gtk_text_buffer_get_start_iter (buffer, &start_iter);
gtk_text_buffer_insert_with_tags_by_name (buffer, &start_iter,
dump_data, -1,
"fixed_font",
NULL);
if (title != NULL) {
gtk_window_set_title (GTK_WINDOW (dump_dialog->window), title);
}
......
......@@ -105,6 +105,7 @@ static gboolean nautilus_sidebar_leave_event (GtkWidget *widget
static gboolean nautilus_sidebar_motion_event (GtkWidget *widget,
GdkEventMotion *event);
static void nautilus_sidebar_destroy (GtkObject *object);
static void nautilus_sidebar_finalize (GObject *object);
static void nautilus_sidebar_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
int x,
......@@ -175,14 +176,18 @@ static void
nautilus_sidebar_class_init (GtkObjectClass *object_klass)
{
GtkWidgetClass *widget_class;
GObjectClass *gobject_class;
NautilusSidebarClass *klass;
widget_class = GTK_WIDGET_CLASS (object_klass);
klass = NAUTILUS_SIDEBAR_CLASS (object_klass);
gobject_class = G_OBJECT_CLASS (object_klass);
gobject_class->finalize = nautilus_sidebar_finalize;
object_klass->destroy = nautilus_sidebar_destroy;
widget_class->drag_data_received = nautilus_sidebar_drag_data_received;
widget_class->motion_notify_event = nautilus_sidebar_motion_event;
widget_class->leave_notify_event = nautilus_sidebar_leave_event;
......@@ -265,6 +270,9 @@ nautilus_sidebar_init (GtkObject *object)
/* also, allocate the title tab */
sidebar->details->title_tab = NAUTILUS_SIDEBAR_TABS (nautilus_sidebar_tabs_new ());
g_object_ref (sidebar->details->title_tab);
gtk_object_sink (GTK_OBJECT (sidebar->details->title_tab));
nautilus_sidebar_tabs_set_title_mode (sidebar->details->title_tab, TRUE);
gtk_widget_show (GTK_WIDGET (sidebar->details->sidebar_tabs));
......@@ -304,35 +312,47 @@ nautilus_sidebar_destroy (GtkObject *object)
sidebar = NAUTILUS_SIDEBAR (object);
if (sidebar->details) {
if (sidebar->details->notebook != NULL) {
g_object_unref (sidebar->details->notebook);
sidebar->details->notebook = NULL;
}
if (sidebar->details->title_tab != NULL) {
g_object_unref (sidebar->details->title_tab);
sidebar->details->title_tab = NULL;
}
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
}
if (sidebar->details->file != NULL) {
gtk_signal_disconnect (GTK_OBJECT (sidebar->details->file),
sidebar->details->file_changed_connection);
nautilus_file_monitor_remove (sidebar->details->file, sidebar);
nautilus_file_unref (sidebar->details->file);
}
gtk_object_sink (GTK_OBJECT (sidebar->details->title_tab));
g_free (sidebar->details->uri);
g_free (sidebar->details->default_background_color);
g_free (sidebar->details->default_background_image);
g_free (sidebar->details);
sidebar->details = NULL;
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME,
nautilus_sidebar_theme_changed,
sidebar);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_CONFIRM_TRASH,
nautilus_sidebar_confirm_trash_changed,
sidebar);
static void
nautilus_sidebar_finalize (GObject *object)
{
NautilusSidebar *sidebar;
sidebar = NAUTILUS_SIDEBAR (object);
if (sidebar->details->file != NULL) {
gtk_signal_disconnect (GTK_OBJECT (sidebar->details->file),
sidebar->details->file_changed_connection);
nautilus_file_monitor_remove (sidebar->details->file, sidebar);
nautilus_file_unref (sidebar->details->file);
}
g_free (sidebar->details->uri);
g_free (sidebar->details->default_background_color);
g_free (sidebar->details->default_background_image);
g_free (sidebar->details);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME,
nautilus_sidebar_theme_changed,
sidebar);
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_CONFIRM_TRASH,
nautilus_sidebar_confirm_trash_changed,
sidebar);
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
/* callback to handle resetting the background */
......
......@@ -56,8 +56,10 @@ static char * nautilus_simple_search_criteria_to_search_uri (const char
static void nautilus_simple_search_bar_class_init (NautilusSimpleSearchBarClass *class);
static void nautilus_simple_search_bar_init (NautilusSimpleSearchBar *bar);
static void nautilus_simple_search_bar_finalize (GObject *object);
#ifdef GNOME2_CONVERSION_COMPLETE
static void nautilus_simple_search_bar_destroy (GtkObject *object);
#endif
EEL_CLASS_BOILERPLATE (NautilusSimpleSearchBar,
nautilus_simple_search_bar,
NAUTILUS_TYPE_SEARCH_BAR)
......@@ -65,8 +67,10 @@ EEL_CLASS_BOILERPLATE (NautilusSimpleSearchBar,
static void
nautilus_simple_search_bar_class_init (NautilusSimpleSearchBarClass *klass)
{
G_OBJECT_CLASS (klass)->finalize = nautilus_simple_search_bar_finalize;
#ifdef GNOME2_CONVERSION_COMPLETE
GTK_OBJECT_CLASS (klass)->destroy = nautilus_simple_search_bar_destroy;
#endif
NAUTILUS_NAVIGATION_BAR_CLASS (klass)->activate = real_activate;
NAUTILUS_NAVIGATION_BAR_CLASS (klass)->get_location = nautilus_simple_search_bar_get_location;
NAUTILUS_NAVIGATION_BAR_CLASS (klass)->set_location = nautilus_simple_search_bar_set_location;
......@@ -98,19 +102,31 @@ nautilus_simple_search_bar_init (NautilusSimpleSearchBar *bar)
bar->details = g_new0 (NautilusSimpleSearchBarDetails, 1);
}
#ifdef GNOME2_CONVERSION_COMPLETE
static void
nautilus_simple_search_bar_destroy (GtkObject *object)
{
NautilusSimpleSearchBar *bar;
bar = NAUTILUS_SIMPLE_SEARCH_BAR (object);
nautilus_undo_editable_set_undo_key (GTK_EDITABLE (bar->details->entry), FALSE);
nautilus_undo_tear_down_nautilus_entry_for_undo (bar->details->entry);
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
}
#endif
static void
nautilus_simple_search_bar_finalize (GObject *object)
{
NautilusSimpleSearchBar *bar;
bar = NAUTILUS_SIMPLE_SEARCH_BAR (object);