summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@gnu.org>2002-01-08 09:41:19 +0000
committerAnders Carlsson <andersca@src.gnome.org>2002-01-08 09:41:19 +0000
commitab5fb6c7ba93a2f3d07dd6b0257b94fb77e1d77b (patch)
tree0552f577b4f591a38e7b961cbf7345f5fc82f6f4 /src
parent81054a094cc71762420e7d3d913441f3969ed62e (diff)
downloadnautilus-ab5fb6c7ba93a2f3d07dd6b0257b94fb77e1d77b.tar.gz
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...
Diffstat (limited to 'src')
-rw-r--r--src/nautilus-application.c16
-rw-r--r--src/nautilus-information-panel.c72
-rw-r--r--src/nautilus-location-bar.c22
-rw-r--r--src/nautilus-main.c10
-rw-r--r--src/nautilus-navigation-window-menus.c10
-rw-r--r--src/nautilus-profiler.c75
-rw-r--r--src/nautilus-sidebar.c72
-rw-r--r--src/nautilus-simple-search-bar.c24
-rw-r--r--src/nautilus-switchable-navigation-bar.c76
-rw-r--r--src/nautilus-switchable-search-bar.c8
-rw-r--r--src/nautilus-theme-selector.c2
-rw-r--r--src/nautilus-window-menus.c10
-rw-r--r--src/nautilus-zoom-control.c25
13 files changed, 259 insertions, 163 deletions
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 3812064e0..dfa36a9d4 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -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;
}
diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c
index bcf2c4b01..e87724c1e 100644
--- a/src/nautilus-information-panel.c
+++ b/src/nautilus-information-panel.c
@@ -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 */
diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c
index 731e6b940..8b9c9a542 100644
--- a/src/nautilus-location-bar.c
+++ b/src/nautilus-location-bar.c
@@ -584,6 +584,18 @@ real_activate (NautilusNavigationBar *navigation_bar)
}
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)
{
NautilusLocationBar *bar;
@@ -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;
diff --git a/src/nautilus-main.c b/src/nautilus-main.c
index af537ddc1..085271df3 100644
--- a/src/nautilus-main.c
+++ b/src/nautilus-main.c
@@ -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 ();
}
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index b5e7fa8f8..42c1a9d20 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -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;
diff --git a/src/nautilus-profiler.c b/src/nautilus-profiler.c
index 9a53caa80..753ed9d3c 100644
--- a/src/nautilus-profiler.c
+++ b/src/nautilus-profiler.c
@@ -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);
}
diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c
index bcf2c4b01..e87724c1e 100644
--- a/src/nautilus-sidebar.c
+++ b/src/nautilus-sidebar.c
@@ -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 */
diff --git a/src/nautilus-simple-search-bar.c b/src/nautilus-simple-search-bar.c
index 14acf9529..62ef9f018 100644
--- a/src/nautilus-simple-search-bar.c
+++ b/src/nautilus-simple-search-bar.c
@@ -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);
+
g_free (bar->details);
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
+ EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
GtkWidget *
diff --git a/src/nautilus-switchable-navigation-bar.c b/src/nautilus-switchable-navigation-bar.c
index d7be42513..53d24102f 100644
--- a/src/nautilus-switchable-navigation-bar.c
+++ b/src/nautilus-switchable-navigation-bar.c
@@ -46,6 +46,9 @@ struct NautilusSwitchableNavigationBarDetails {
NautilusLocationBar *location_bar;
NautilusSwitchableSearchBar *search_bar;
+
+ NautilusWindow *window;
+ GtkWidget *hbox;
};
enum {
@@ -60,7 +63,7 @@ static void nautilus_switchable_navigation_bar_set_location (NautilusNaviga
const char *location);
static void nautilus_switchable_navigation_bar_class_init (NautilusSwitchableNavigationBarClass *class);
static void nautilus_switchable_navigation_bar_init (NautilusSwitchableNavigationBar *bar);
-static void nautilus_switchable_navigation_bar_destroy (GtkObject *object);
+static void nautilus_switchable_navigation_bar_finalize (GObject *object);
EEL_CLASS_BOILERPLATE (NautilusSwitchableNavigationBar,
nautilus_switchable_navigation_bar,
@@ -70,15 +73,15 @@ static void
nautilus_switchable_navigation_bar_class_init (NautilusSwitchableNavigationBarClass *klass)
{
- GtkObjectClass *object_class;
+ GObjectClass *gobject_class;
NautilusNavigationBarClass *navigation_bar_class;
- object_class = GTK_OBJECT_CLASS (klass);
+ gobject_class = G_OBJECT_CLASS (klass);
navigation_bar_class = NAUTILUS_NAVIGATION_BAR_CLASS (klass);
signals[MODE_CHANGED] = g_signal_new
("mode_changed",
- G_TYPE_FROM_CLASS (object_class),
+ G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (NautilusSwitchableNavigationBarClass,
mode_changed),
@@ -86,7 +89,7 @@ nautilus_switchable_navigation_bar_class_init (NautilusSwitchableNavigationBarCl
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_INT);
- object_class->destroy = nautilus_switchable_navigation_bar_destroy;
+ gobject_class->finalize = nautilus_switchable_navigation_bar_finalize;
navigation_bar_class->get_location = nautilus_switchable_navigation_bar_get_location;
navigation_bar_class->set_location = nautilus_switchable_navigation_bar_set_location;
@@ -96,52 +99,61 @@ static void
nautilus_switchable_navigation_bar_init (NautilusSwitchableNavigationBar *bar)
{
-
-
bar->details = g_new0 (NautilusSwitchableNavigationBarDetails, 1);
-
}
static void
-nautilus_switchable_navigation_bar_destroy (GtkObject *object)
+nautilus_switchable_navigation_bar_finalize (GObject *object)
{
g_free (NAUTILUS_SWITCHABLE_NAVIGATION_BAR (object)->details);
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
+
+ EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
+static void
+create_search_bar_if_non_existant (NautilusSwitchableNavigationBar *bar)
+{
+ if (bar->details->search_bar != NULL) {
+ return;
+ }
+
+ bar->details->search_bar = NAUTILUS_SWITCHABLE_SEARCH_BAR (nautilus_switchable_search_bar_new (bar->details->window));
+
+ gtk_signal_connect_object (GTK_OBJECT (bar->details->search_bar),
+ "location_changed",
+ G_CALLBACK (nautilus_navigation_bar_location_changed),
+ GTK_OBJECT (bar));
+
+ gtk_box_pack_start (GTK_BOX (bar->details->hbox), GTK_WIDGET (bar->details->search_bar), TRUE, TRUE, 0);
+}
+
+
GtkWidget *
nautilus_switchable_navigation_bar_new (NautilusWindow *window)
{
GtkWidget *bar;
- GtkWidget *hbox;
NautilusSwitchableNavigationBar *switchable_navigation_bar;
bar = gtk_widget_new (NAUTILUS_TYPE_SWITCHABLE_NAVIGATION_BAR, NULL);
- hbox = gtk_hbox_new (FALSE, 0);
-
switchable_navigation_bar = NAUTILUS_SWITCHABLE_NAVIGATION_BAR (bar);
+
+ switchable_navigation_bar->details->hbox = gtk_hbox_new (FALSE, 0);
+ switchable_navigation_bar->details->window = window;
switchable_navigation_bar->details->location_bar = NAUTILUS_LOCATION_BAR (nautilus_location_bar_new (window));
- switchable_navigation_bar->details->search_bar = NAUTILUS_SWITCHABLE_SEARCH_BAR (nautilus_switchable_search_bar_new (window));
gtk_signal_connect_object (GTK_OBJECT (switchable_navigation_bar->details->location_bar),
"location_changed",
G_CALLBACK (nautilus_navigation_bar_location_changed),
GTK_OBJECT (bar));
- gtk_signal_connect_object (GTK_OBJECT (switchable_navigation_bar->details->search_bar),
- "location_changed",
- G_CALLBACK (nautilus_navigation_bar_location_changed),
- GTK_OBJECT (bar));
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (switchable_navigation_bar->details->location_bar), TRUE, TRUE,
- 0);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (switchable_navigation_bar->details->search_bar), TRUE, TRUE,
- 0);
+ gtk_box_pack_start (GTK_BOX (switchable_navigation_bar->details->hbox),
+ GTK_WIDGET (switchable_navigation_bar->details->location_bar), TRUE, TRUE, 0);
gtk_widget_show (GTK_WIDGET (switchable_navigation_bar->details->location_bar));
- gtk_widget_show (GTK_WIDGET (hbox));
- gtk_container_add (GTK_CONTAINER (bar), hbox);
+ gtk_widget_show (GTK_WIDGET (switchable_navigation_bar->details->hbox));
+ gtk_container_add (GTK_CONTAINER (bar), switchable_navigation_bar->details->hbox);
return bar;
}
@@ -193,6 +205,10 @@ nautilus_switchable_navigation_bar_set_mode (NautilusSwitchableNavigationBar
widget_to_hide = GTK_WIDGET (bar->details->search_bar);
break;
case NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH:
+
+ /* If the search bar hasn't been created, create it */
+ create_search_bar_if_non_existant (bar);
+
widget_to_show = GTK_WIDGET (bar->details->search_bar);
widget_to_hide = GTK_WIDGET (bar->details->location_bar);
break;
@@ -201,7 +217,10 @@ nautilus_switchable_navigation_bar_set_mode (NautilusSwitchableNavigationBar
}
gtk_widget_show (widget_to_show);
- gtk_widget_hide (widget_to_hide);
+
+ if (widget_to_hide != NULL) {
+ gtk_widget_hide (widget_to_hide);
+ }
nautilus_switchable_navigation_bar_activate (bar);
@@ -252,8 +271,11 @@ nautilus_switchable_navigation_bar_set_location (NautilusNavigationBar *navigati
*/
nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (bar->details->location_bar),
location);
- nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (bar->details->search_bar),
- location);
+
+ if (bar->details->search_bar != NULL) {
+ nautilus_navigation_bar_set_location (NAUTILUS_NAVIGATION_BAR (bar->details->search_bar),
+ location);
+ }
/* Toggle the search button on and off appropriately */
if (nautilus_is_search_uri (location)) {
diff --git a/src/nautilus-switchable-search-bar.c b/src/nautilus-switchable-search-bar.c
index ec2baf4ef..01b9afb94 100644
--- a/src/nautilus-switchable-search-bar.c
+++ b/src/nautilus-switchable-search-bar.c
@@ -46,7 +46,7 @@ static void nautilus_switchable_search_bar_set_location (Na
static char * nautilus_switchable_search_bar_get_location (NautilusNavigationBar *bar);
static void nautilus_switchable_search_bar_class_init (NautilusSwitchableSearchBarClass *class);
static void nautilus_switchable_search_bar_init (NautilusSwitchableSearchBar *bar);
-static void nautilus_switchable_search_bar_destroy (GtkObject *object);
+static void nautilus_switchable_search_bar_finalize (GObject *object);
static NautilusSearchBarMode other_search_mode (NautilusSearchBarMode mode);
static NautilusSearchBarMode nautilus_search_uri_to_search_bar_mode (const char *uri);
@@ -64,7 +64,7 @@ nautilus_switchable_search_bar_class_init (NautilusSwitchableSearchBarClass *kla
NAUTILUS_NAVIGATION_BAR_CLASS (klass)->get_location = nautilus_switchable_search_bar_get_location;
NAUTILUS_NAVIGATION_BAR_CLASS (klass)->set_location = nautilus_switchable_search_bar_set_location;
- GTK_OBJECT_CLASS (klass)->destroy = nautilus_switchable_search_bar_destroy;
+ G_OBJECT_CLASS (klass)->finalize = nautilus_switchable_search_bar_finalize;
}
static void
@@ -95,7 +95,7 @@ nautilus_switchable_search_bar_init (NautilusSwitchableSearchBar *bar)
static void
-nautilus_switchable_search_bar_destroy (GtkObject *object)
+nautilus_switchable_search_bar_finalize (GObject *object)
{
NautilusSwitchableSearchBar *bar;
@@ -105,7 +105,7 @@ nautilus_switchable_search_bar_destroy (GtkObject *object)
search_bar_preference_changed_callback,
bar);
- EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
+ EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
GtkWidget *
diff --git a/src/nautilus-theme-selector.c b/src/nautilus-theme-selector.c
index 7f554903c..6b74ce962 100644
--- a/src/nautilus-theme-selector.c
+++ b/src/nautilus-theme-selector.c
@@ -514,7 +514,7 @@ theme_selector_changed_callback (EelImageChooser *image_chooser,
selected_row_position = eel_image_chooser_get_selected_row (image_chooser);
g_signal_emit (callback_data,
- theme_selector_signals[THEME_CHANGED], 0);
+ theme_selector_signals[THEME_CHANGED], 0);
}
/* GtkObjectClass methods */
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index b5e7fa8f8..42c1a9d20 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -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;
diff --git a/src/nautilus-zoom-control.c b/src/nautilus-zoom-control.c
index 0d903030b..c4894c7b2 100644
--- a/src/nautilus-zoom-control.c
+++ b/src/nautilus-zoom-control.c
@@ -101,6 +101,18 @@ void draw_number (GtkWidget *widge
EEL_CLASS_BOILERPLATE (NautilusZoomControl, nautilus_zoom_control, GTK_TYPE_EVENT_BOX)
+static void
+nautilus_zoom_control_finalize (GObject *object)
+{
+ eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME,
+ nautilus_zoom_control_theme_changed,
+ object);
+
+ g_free (NAUTILUS_ZOOM_CONTROL (object)->details);
+
+ EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
+}
+
static void
nautilus_zoom_control_destroy (GtkObject *object)
{
@@ -110,12 +122,6 @@ nautilus_zoom_control_destroy (GtkObject *object)
/* deallocate pixbufs */
nautilus_zoom_control_unload_images (NAUTILUS_ZOOM_CONTROL (object));
- eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME,
- nautilus_zoom_control_theme_changed,
- object);
-
- g_free (NAUTILUS_ZOOM_CONTROL (object)->details);
-
EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
}
@@ -383,18 +389,22 @@ nautilus_zoom_control_unload_images (NautilusZoomControl *zoom_control)
{
if (zoom_control->details->zoom_body_image) {
g_object_unref (zoom_control->details->zoom_body_image);
+ zoom_control->details->zoom_body_image = NULL;
}
if (zoom_control->details->zoom_decrement_image) {
g_object_unref (zoom_control->details->zoom_decrement_image);
+ zoom_control->details->zoom_decrement_image = NULL;
}
if (zoom_control->details->zoom_increment_image) {
g_object_unref (zoom_control->details->zoom_increment_image);
+ zoom_control->details->zoom_increment_image = NULL;
}
if (zoom_control->details->number_strip != NULL) {
g_object_unref (zoom_control->details->number_strip);
+ zoom_control->details->number_strip = NULL;
}
if (zoom_control->details->label_font != NULL) {
@@ -715,9 +725,12 @@ nautilus_zoom_control_can_zoom_out (NautilusZoomControl *zoom_control)
static void
nautilus_zoom_control_class_init (NautilusZoomControlClass *zoom_control_class)
{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (zoom_control_class);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (zoom_control_class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (zoom_control_class);
+ gobject_class->finalize = nautilus_zoom_control_finalize;
+
object_class->destroy = nautilus_zoom_control_destroy;
widget_class->expose_event = nautilus_zoom_control_expose;