diff options
author | Darin Adler <darin@src.gnome.org> | 2000-05-25 21:32:33 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2000-05-25 21:32:33 +0000 |
commit | 78899d390741f5bd46b38c947a6e1e1c77baca86 (patch) | |
tree | fcd5420b4cd4ae205f1075c57e38474be4bc6c78 | |
parent | 967aace7a9c5e07366a3349d38defa8627fc6a6b (diff) | |
download | nautilus-78899d390741f5bd46b38c947a6e1e1c77baca86.tar.gz |
Updated to reflect completed tasks.
* RENAMING: Updated to reflect completed tasks.
* components/notes/ntl-notes.c: (make_notes_view):
* components/websearch/ntl-web-search.c: (make_obj):
Changed to use simplified clipboard API.
* components/services/trilobite/libtrilobite/.cvsignore:
Ignore generated files.
* libnautilus-extensions/gtkscrollframe.c:
* libnautilus-extensions/gtkscrollframe.h:
Renamed GtkScrollFrame to NautilusScrollFrame so we won't conflict
if a GtkScrollFrame actually gets added to gtk some day. The file
still needs renaming (mentioned in RENAMING).
* libnautilus/nautilus-clipboard.h:
* libnautilus/nautilus-clipboard.c: (cut_callback),
(copy_callback), (paste_callback), (clear_callback),
(add_menu_item), (add_menu_items_callback),
(remove_menu_items_callback), (nautilus_clipboard_set_up_editable):
Simplified clipboard implementation. Does the same thing the old
code did without needing a class and with a simpler API.
* nautilus-widgets/nautilus-preferences-item.c:
* src/file-manager/fm-icon-text-window.c:
* src/nautilus-zoom-control.c:
* src/ntl-window.c:
Renamed _cb to _callback. Some other (minor) cleanup.
* src/file-manager/Makefile.am:
* src/file-manager/desktop-canvas.c: [removed]
* src/file-manager/desktop-canvas.h: [removed]
* src/file-manager/desktop-menu.c: [removed]
* src/file-manager/desktop-menu.h: [removed]
* src/file-manager/gnome-desktop.c: [removed]
Now that I'm doing the desktop work, I know we don't need these.
I'll be deleting the desktop source files that Havoc added as I
harvest the useful code from them.
* src/file-manager/fm-directory-view.c:
(bonobo_control_activate_callback): Add comments.
* src/nautilus-zoom-control.h: Fixed problem where the zoom
control didn't know if it was an event box or a pixmap.
* src/ntl-index-panel.c: (nautilus_index_panel_add_meta_view):
Fixed bug that was trashing the sidebar panel names. I put
the g_free call in the wrong place.
* src/ntl-uri-map.c: (sidebar_panel_preference_is_on):
Fixed bug where the sidebar preference wasn't saved. I found
another place with another copy of the preference path. This
sort of thing really needs to go in a header file, I think.
39 files changed, 1995 insertions, 3267 deletions
@@ -1,3 +1,59 @@ +2000-05-25 Darin Adler <darin@eazel.com> + + * RENAMING: Updated to reflect completed tasks. + + * components/notes/ntl-notes.c: (make_notes_view): + * components/websearch/ntl-web-search.c: (make_obj): + Changed to use simplified clipboard API. + + * components/services/trilobite/libtrilobite/.cvsignore: + Ignore generated files. + + * libnautilus-extensions/gtkscrollframe.c: + * libnautilus-extensions/gtkscrollframe.h: + Renamed GtkScrollFrame to NautilusScrollFrame so we won't conflict + if a GtkScrollFrame actually gets added to gtk some day. The file + still needs renaming (mentioned in RENAMING). + + * libnautilus/nautilus-clipboard.h: + * libnautilus/nautilus-clipboard.c: (cut_callback), + (copy_callback), (paste_callback), (clear_callback), + (add_menu_item), (add_menu_items_callback), + (remove_menu_items_callback), (nautilus_clipboard_set_up_editable): + Simplified clipboard implementation. Does the same thing the old + code did without needing a class and with a simpler API. + + * nautilus-widgets/nautilus-preferences-item.c: + * src/file-manager/fm-icon-text-window.c: + * src/nautilus-zoom-control.c: + * src/ntl-window.c: + Renamed _cb to _callback. Some other (minor) cleanup. + + * src/file-manager/Makefile.am: + * src/file-manager/desktop-canvas.c: [removed] + * src/file-manager/desktop-canvas.h: [removed] + * src/file-manager/desktop-menu.c: [removed] + * src/file-manager/desktop-menu.h: [removed] + * src/file-manager/gnome-desktop.c: [removed] + Now that I'm doing the desktop work, I know we don't need these. + I'll be deleting the desktop source files that Havoc added as I + harvest the useful code from them. + + * src/file-manager/fm-directory-view.c: + (bonobo_control_activate_callback): Add comments. + + * src/nautilus-zoom-control.h: Fixed problem where the zoom + control didn't know if it was an event box or a pixmap. + + * src/ntl-index-panel.c: (nautilus_index_panel_add_meta_view): + Fixed bug that was trashing the sidebar panel names. I put + the g_free call in the wrong place. + + * src/ntl-uri-map.c: (sidebar_panel_preference_is_on): + Fixed bug where the sidebar preference wasn't saved. I found + another place with another copy of the preference path. This + sort of thing really needs to go in a header file, I think. + 2000-05-25 J Shane Culpepper <pepper@eazel.com> * nautilus-installer/Makefile: @@ -7,10 +7,8 @@ file names ---------- components/history/ntl-history-view.c -> components/history/nautilus-history-view.c components/notes/ntl-notes.c -> components/notes/nautilus-notes.c -libnautilus/nautilus-content-view-frame.c -> libnautilus/nautilus-content-view.c -libnautilus/nautilus-content-view-frame.h -> libnautilus/nautilus-content-view.h -libnautilus/nautilus-meta-view-frame.c -> libnautilus/nautilus-meta-view.c -libnautilus/nautilus-meta-view-frame.h -> libnautilus/nautilus-meta-view.h +libnautilus-extensions/gtkscrollframe.c -> libnautilus-extensions/nautilus-scroll-frame.c +libnautilus-extensions/gtkscrollframe.h -> libnautilus-extensions/nautilus-scroll-frame.h libnautilus/nautilus-view-frame.c -> libnautilus/nautilus-view.c libnautilus/nautilus-view-frame.h -> libnautilus/nautilus-view.h src/nautilus-index-tabs.c -> src/nautilus-sidebar-tabs.c @@ -20,8 +18,6 @@ src/nautilus-index-title.h -> src/nautilus-sidebar-title.h src/nautilus-zoomable-frame-svr.c -> src/nautilus-zoomable-frame-corba.c src/ntl-app.c -> src/nautilus-application.c src/ntl-app.h -> src/nautilus-application.h -src/ntl-content-view.c -> src/nautilus-content-view-frame.c -src/ntl-content-view.h -> src/nautilus-content-view-frame.h src/ntl-index-panel.c -> src/nautilus-sidebar.c src/ntl-index-panel.h -> src/nautilus-sidebar.h src/ntl-main.c -> src/nautilus-main.c @@ -62,4 +58,3 @@ StatusRequestInfo -> Status (or StatusRequest) -------------- function names -------------- -*_cb -> *_callback diff --git a/components/notes/nautilus-notes.c b/components/notes/nautilus-notes.c index 021acafeb..22356a39c 100644 --- a/components/notes/nautilus-notes.c +++ b/components/notes/nautilus-notes.c @@ -143,7 +143,6 @@ make_notes_view (BonoboGenericFactory *Factory, const char *goad_id, gpointer cl GtkWidget *vbox; Notes *notes; NautilusBackground *background; - NautilusClipboardInfo *info; g_return_val_if_fail (strcmp (goad_id, "OAFIID:ntl_notes_view:7f04c3cb-df79-4b9a-a577-38b19ccd4185") == 0, NULL); notes = g_new0 (Notes, 1); @@ -158,7 +157,7 @@ make_notes_view (BonoboGenericFactory *Factory, const char *goad_id, gpointer cl notes->note_text_field = gtk_text_new (NULL, NULL); gtk_text_set_editable (GTK_TEXT (notes->note_text_field), TRUE); gtk_box_pack_start (GTK_BOX (vbox), notes->note_text_field, TRUE, TRUE, 0); - background = nautilus_get_widget_background (GTK_WIDGET (notes->note_text_field)); + background = nautilus_get_widget_background (notes->note_text_field); nautilus_background_set_color (background, NOTES_DEFAULT_BACKGROUND_COLOR); gtk_widget_show_all (vbox); @@ -174,19 +173,11 @@ make_notes_view (BonoboGenericFactory *Factory, const char *goad_id, gpointer cl notes_notify_location_change, notes); /* handle selections */ - info = nautilus_clipboard_info_new (); - nautilus_clipboard_info_set_view (info, notes->view); - nautilus_clipboard_info_set_clipboard_owner (info, GTK_WIDGET (notes->note_text_field)); - nautilus_clipboard_info_set_component_name (info, _("Notes")); - gtk_signal_connect (GTK_OBJECT (notes->note_text_field), "focus_in_event", - GTK_SIGNAL_FUNC (nautilus_component_merge_bonobo_items_cb), info); - gtk_signal_connect (GTK_OBJECT (notes->note_text_field), "focus_out_event", - GTK_SIGNAL_FUNC (nautilus_component_unmerge_bonobo_items_cb), info); - - gtk_signal_connect (GTK_OBJECT (notes->view), "destroy", nautilus_clipboard_info_destroy, info); - /* set description */ - - return BONOBO_OBJECT (notes->view); + nautilus_clipboard_set_up_editable + (GTK_EDITABLE (notes->note_text_field), + nautilus_view_get_bonobo_control (notes->view)); + + return BONOBO_OBJECT (notes->view); } int @@ -222,8 +213,9 @@ main(int argc, char *argv[]) g_thread_init (NULL); gnome_vfs_init (); - factory = bonobo_generic_factory_new_multi ("OAFIID:ntl_notes_view_factory:4b39e388-3ca2-4d68-9f3d-c137ee62d5b0", - make_notes_view, NULL); + factory = bonobo_generic_factory_new_multi + ("OAFIID:ntl_notes_view_factory:4b39e388-3ca2-4d68-9f3d-c137ee62d5b0", + make_notes_view, NULL); do { bonobo_main(); diff --git a/components/notes/ntl-notes.c b/components/notes/ntl-notes.c index 021acafeb..22356a39c 100644 --- a/components/notes/ntl-notes.c +++ b/components/notes/ntl-notes.c @@ -143,7 +143,6 @@ make_notes_view (BonoboGenericFactory *Factory, const char *goad_id, gpointer cl GtkWidget *vbox; Notes *notes; NautilusBackground *background; - NautilusClipboardInfo *info; g_return_val_if_fail (strcmp (goad_id, "OAFIID:ntl_notes_view:7f04c3cb-df79-4b9a-a577-38b19ccd4185") == 0, NULL); notes = g_new0 (Notes, 1); @@ -158,7 +157,7 @@ make_notes_view (BonoboGenericFactory *Factory, const char *goad_id, gpointer cl notes->note_text_field = gtk_text_new (NULL, NULL); gtk_text_set_editable (GTK_TEXT (notes->note_text_field), TRUE); gtk_box_pack_start (GTK_BOX (vbox), notes->note_text_field, TRUE, TRUE, 0); - background = nautilus_get_widget_background (GTK_WIDGET (notes->note_text_field)); + background = nautilus_get_widget_background (notes->note_text_field); nautilus_background_set_color (background, NOTES_DEFAULT_BACKGROUND_COLOR); gtk_widget_show_all (vbox); @@ -174,19 +173,11 @@ make_notes_view (BonoboGenericFactory *Factory, const char *goad_id, gpointer cl notes_notify_location_change, notes); /* handle selections */ - info = nautilus_clipboard_info_new (); - nautilus_clipboard_info_set_view (info, notes->view); - nautilus_clipboard_info_set_clipboard_owner (info, GTK_WIDGET (notes->note_text_field)); - nautilus_clipboard_info_set_component_name (info, _("Notes")); - gtk_signal_connect (GTK_OBJECT (notes->note_text_field), "focus_in_event", - GTK_SIGNAL_FUNC (nautilus_component_merge_bonobo_items_cb), info); - gtk_signal_connect (GTK_OBJECT (notes->note_text_field), "focus_out_event", - GTK_SIGNAL_FUNC (nautilus_component_unmerge_bonobo_items_cb), info); - - gtk_signal_connect (GTK_OBJECT (notes->view), "destroy", nautilus_clipboard_info_destroy, info); - /* set description */ - - return BONOBO_OBJECT (notes->view); + nautilus_clipboard_set_up_editable + (GTK_EDITABLE (notes->note_text_field), + nautilus_view_get_bonobo_control (notes->view)); + + return BONOBO_OBJECT (notes->view); } int @@ -222,8 +213,9 @@ main(int argc, char *argv[]) g_thread_init (NULL); gnome_vfs_init (); - factory = bonobo_generic_factory_new_multi ("OAFIID:ntl_notes_view_factory:4b39e388-3ca2-4d68-9f3d-c137ee62d5b0", - make_notes_view, NULL); + factory = bonobo_generic_factory_new_multi + ("OAFIID:ntl_notes_view_factory:4b39e388-3ca2-4d68-9f3d-c137ee62d5b0", + make_notes_view, NULL); do { bonobo_main(); diff --git a/components/services/trilobite/libtrilobite/.cvsignore b/components/services/trilobite/libtrilobite/.cvsignore index 6e5ca7ed4..888a4ff26 100644 --- a/components/services/trilobite/libtrilobite/.cvsignore +++ b/components/services/trilobite/libtrilobite/.cvsignore @@ -1,6 +1,10 @@ -Makefile -Makefile.in +*.la +*.lo .deps .libs -*.lo -*.la +Makefile +Makefile.in +trilobite-service-common.c +trilobite-service-skels.c +trilobite-service-stubs.c +trilobite-service.h diff --git a/components/websearch/ntl-web-search.c b/components/websearch/ntl-web-search.c index 13fadc367..042e766a7 100644 --- a/components/websearch/ntl-web-search.c +++ b/components/websearch/ntl-web-search.c @@ -167,7 +167,6 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure) { GtkWidget *vbox; WebSearchView *hview; - NautilusClipboardInfo *info; g_return_val_if_fail(!strcmp(goad_id, "OAFIID:ntl_websearch_view:8216e1e4-6b01-4a28-82d9-5df30ed7d044"), NULL); @@ -225,15 +224,8 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure) gtk_signal_connect(GTK_OBJECT(hview->view), "notify_location_change", web_search_notify_location_change, hview); /* handle selections */ - info = nautilus_clipboard_info_new (); - nautilus_clipboard_info_set_view (info, hview->view); - nautilus_clipboard_info_set_clipboard_owner (info, GTK_WIDGET (hview->ent_params)); - nautilus_clipboard_info_set_component_name (info, _("WebSearch")); - gtk_signal_connect (GTK_OBJECT (hview->ent_params), "focus_in_event", - GTK_SIGNAL_FUNC (nautilus_component_merge_bonobo_items_cb), info); - gtk_signal_connect (GTK_OBJECT (hview->ent_params), "focus_out_event", - GTK_SIGNAL_FUNC (nautilus_component_unmerge_bonobo_items_cb), info); - gtk_signal_connect (GTK_OBJECT (hview->ent_params), "destroy", nautilus_clipboard_info_destroy, info); + nautilus_clipboard_set_up_editable (GTK_EDITABLE (hview->ent_params), + nautilus_view_get_bonobo_control (hview->view)); return BONOBO_OBJECT (hview->view); } diff --git a/libnautilus-extensions/gtkscrollframe.c b/libnautilus-extensions/gtkscrollframe.c index 938c388c2..d8fed9059 100644 --- a/libnautilus-extensions/gtkscrollframe.c +++ b/libnautilus-extensions/gtkscrollframe.c @@ -80,8 +80,8 @@ enum { ARG_SCROLLBAR_SPACING }; -/* Private part of the GtkScrollFrame structure */ -typedef struct { +/* Private part of the NautilusScrollFrame structure */ +struct NautilusScrollFrameDetails { /* Horizontal and vertical scrollbars */ GtkWidget *hsb; GtkWidget *vsb; @@ -108,52 +108,52 @@ typedef struct { /* Shadow type for frame */ guint shadow_type : 3; -} ScrollFramePrivate; - - -static void gtk_scroll_frame_class_init (GtkScrollFrameClass *class); -static void gtk_scroll_frame_init (GtkScrollFrame *sf); -static void gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void gtk_scroll_frame_destroy (GtkObject *object); -static void gtk_scroll_frame_finalize (GtkObject *object); - -static void gtk_scroll_frame_map (GtkWidget *widget); -static void gtk_scroll_frame_unmap (GtkWidget *widget); -static void gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area); -static void gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition); -static void gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static gint gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event); - -static void gtk_scroll_frame_add (GtkContainer *container, GtkWidget *widget); -static void gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *widget); -static void gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals, +}; + + +static void nautilus_scroll_frame_class_init (NautilusScrollFrameClass *class); +static void nautilus_scroll_frame_init (NautilusScrollFrame *sf); +static void nautilus_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void nautilus_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void nautilus_scroll_frame_destroy (GtkObject *object); +static void nautilus_scroll_frame_finalize (GtkObject *object); + +static void nautilus_scroll_frame_map (GtkWidget *widget); +static void nautilus_scroll_frame_unmap (GtkWidget *widget); +static void nautilus_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area); +static void nautilus_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition); +static void nautilus_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static gint nautilus_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event); + +static void nautilus_scroll_frame_add (GtkContainer *container, GtkWidget *widget); +static void nautilus_scroll_frame_remove (GtkContainer *container, GtkWidget *widget); +static void nautilus_scroll_frame_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); static GtkBinClass *parent_class; /** - * gtk_scroll_frame_get_type: + * nautilus_scroll_frame_get_type: * @void: * - * Registers the &GtkScrollFrame class if necessary, and returns the type ID + * Registers the &NautilusScrollFrame class if necessary, and returns the type ID * associated to it. * - * Return value: The type ID of the &GtkScrollFrame class. + * Return value: The type ID of the &NautilusScrollFrame class. **/ GtkType -gtk_scroll_frame_get_type (void) +nautilus_scroll_frame_get_type (void) { static GtkType scroll_frame_type = 0; if (!scroll_frame_type) { static const GtkTypeInfo scroll_frame_info = { - "GtkScrollFrame", - sizeof (GtkScrollFrame), - sizeof (GtkScrollFrameClass), - (GtkClassInitFunc) gtk_scroll_frame_class_init, - (GtkObjectInitFunc) gtk_scroll_frame_init, + "NautilusScrollFrame", + sizeof (NautilusScrollFrame), + sizeof (NautilusScrollFrameClass), + (GtkClassInitFunc) nautilus_scroll_frame_class_init, + (GtkObjectInitFunc) nautilus_scroll_frame_init, NULL, /* reserved_1 */ NULL, /* reserved_2 */ (GtkClassInitFunc) NULL @@ -167,7 +167,7 @@ gtk_scroll_frame_get_type (void) /* Class initialization function for the scroll frame widget */ static void -gtk_scroll_frame_class_init (GtkScrollFrameClass *class) +nautilus_scroll_frame_class_init (NautilusScrollFrameClass *class) { GtkObjectClass *object_class; GtkWidgetClass *widget_class; @@ -179,109 +179,109 @@ gtk_scroll_frame_class_init (GtkScrollFrameClass *class) parent_class = gtk_type_class (GTK_TYPE_BIN); - gtk_object_add_arg_type ("GtkScrollFrame::hadjustment", + gtk_object_add_arg_type ("NautilusScrollFrame::hadjustment", GTK_TYPE_ADJUSTMENT, GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT, ARG_HADJUSTMENT); - gtk_object_add_arg_type ("GtkScrollFrame::vadjustment", + gtk_object_add_arg_type ("NautilusScrollFrame::vadjustment", GTK_TYPE_ADJUSTMENT, GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT, ARG_VADJUSTMENT); - gtk_object_add_arg_type ("GtkScrollFrame::hscrollbar_policy", + gtk_object_add_arg_type ("NautilusScrollFrame::hscrollbar_policy", GTK_TYPE_POLICY_TYPE, GTK_ARG_READWRITE, ARG_HSCROLLBAR_POLICY); - gtk_object_add_arg_type ("GtkScrollFrame::vscrollbar_policy", + gtk_object_add_arg_type ("NautilusScrollFrame::vscrollbar_policy", GTK_TYPE_POLICY_TYPE, GTK_ARG_READWRITE, ARG_VSCROLLBAR_POLICY); - gtk_object_add_arg_type ("GtkScrollFrame::frame_placement", + gtk_object_add_arg_type ("NautilusScrollFrame::frame_placement", GTK_TYPE_CORNER_TYPE, GTK_ARG_READWRITE, ARG_FRAME_PLACEMENT); - gtk_object_add_arg_type ("GtkScrollFrame::shadow_type", + gtk_object_add_arg_type ("NautilusScrollFrame::shadow_type", GTK_TYPE_SHADOW_TYPE, GTK_ARG_READWRITE, ARG_SHADOW_TYPE); - gtk_object_add_arg_type ("GtkScrollFrame::scrollbar_spacing", + gtk_object_add_arg_type ("NautilusScrollFrame::scrollbar_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_SCROLLBAR_SPACING); - object_class->set_arg = gtk_scroll_frame_set_arg; - object_class->get_arg = gtk_scroll_frame_get_arg; - object_class->destroy = gtk_scroll_frame_destroy; - object_class->finalize = gtk_scroll_frame_finalize; - - widget_class->map = gtk_scroll_frame_map; - widget_class->unmap = gtk_scroll_frame_unmap; - widget_class->draw = gtk_scroll_frame_draw; - widget_class->size_request = gtk_scroll_frame_size_request; - widget_class->size_allocate = gtk_scroll_frame_size_allocate; - widget_class->expose_event = gtk_scroll_frame_expose; - - container_class->add = gtk_scroll_frame_add; - container_class->remove = gtk_scroll_frame_remove; - container_class->forall = gtk_scroll_frame_forall; + object_class->set_arg = nautilus_scroll_frame_set_arg; + object_class->get_arg = nautilus_scroll_frame_get_arg; + object_class->destroy = nautilus_scroll_frame_destroy; + object_class->finalize = nautilus_scroll_frame_finalize; + + widget_class->map = nautilus_scroll_frame_map; + widget_class->unmap = nautilus_scroll_frame_unmap; + widget_class->draw = nautilus_scroll_frame_draw; + widget_class->size_request = nautilus_scroll_frame_size_request; + widget_class->size_allocate = nautilus_scroll_frame_size_allocate; + widget_class->expose_event = nautilus_scroll_frame_expose; + + container_class->add = nautilus_scroll_frame_add; + container_class->remove = nautilus_scroll_frame_remove; + container_class->forall = nautilus_scroll_frame_forall; } /* Object initialization function for the scroll frame widget */ static void -gtk_scroll_frame_init (GtkScrollFrame *sf) +nautilus_scroll_frame_init (NautilusScrollFrame *sf) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - priv = g_new0 (ScrollFramePrivate, 1); - sf->priv = priv; + details = g_new0 (NautilusScrollFrameDetails, 1); + sf->details = details; GTK_WIDGET_SET_FLAGS (sf, GTK_NO_WINDOW); gtk_container_set_resize_mode (GTK_CONTAINER (sf), GTK_RESIZE_QUEUE); - priv->sb_spacing = 3; - priv->hsb_policy = GTK_POLICY_ALWAYS; - priv->vsb_policy = GTK_POLICY_ALWAYS; - priv->frame_placement = GTK_CORNER_TOP_LEFT; - priv->shadow_type = GTK_SHADOW_NONE; + details->sb_spacing = 3; + details->hsb_policy = GTK_POLICY_ALWAYS; + details->vsb_policy = GTK_POLICY_ALWAYS; + details->frame_placement = GTK_CORNER_TOP_LEFT; + details->shadow_type = GTK_SHADOW_NONE; } /* Set_arg handler for the scroll frame widget */ static void -gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) +nautilus_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; switch (arg_id) { case ARG_HADJUSTMENT: - gtk_scroll_frame_set_hadjustment (sf, GTK_VALUE_POINTER (*arg)); + nautilus_scroll_frame_set_hadjustment (sf, GTK_VALUE_POINTER (*arg)); break; case ARG_VADJUSTMENT: - gtk_scroll_frame_set_vadjustment (sf, GTK_VALUE_POINTER (*arg)); + nautilus_scroll_frame_set_vadjustment (sf, GTK_VALUE_POINTER (*arg)); break; case ARG_HSCROLLBAR_POLICY: - gtk_scroll_frame_set_policy (sf, GTK_VALUE_ENUM (*arg), priv->vsb_policy); + nautilus_scroll_frame_set_policy (sf, GTK_VALUE_ENUM (*arg), details->vsb_policy); break; case ARG_VSCROLLBAR_POLICY: - gtk_scroll_frame_set_policy (sf, priv->hsb_policy, GTK_VALUE_ENUM (*arg)); + nautilus_scroll_frame_set_policy (sf, details->hsb_policy, GTK_VALUE_ENUM (*arg)); break; case ARG_FRAME_PLACEMENT: - gtk_scroll_frame_set_placement (sf, GTK_VALUE_ENUM (*arg)); + nautilus_scroll_frame_set_placement (sf, GTK_VALUE_ENUM (*arg)); break; case ARG_SHADOW_TYPE: - gtk_scroll_frame_set_shadow_type (sf, GTK_VALUE_ENUM (*arg)); + nautilus_scroll_frame_set_shadow_type (sf, GTK_VALUE_ENUM (*arg)); break; case ARG_SCROLLBAR_SPACING: - gtk_scroll_frame_set_scrollbar_spacing (sf, GTK_VALUE_UINT (*arg)); + nautilus_scroll_frame_set_scrollbar_spacing (sf, GTK_VALUE_UINT (*arg)); break; default: @@ -291,41 +291,41 @@ gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) /* Get_arg handler for the scroll frame widget */ static void -gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +nautilus_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; switch (arg_id) { case ARG_HADJUSTMENT: - GTK_VALUE_POINTER (*arg) = gtk_scroll_frame_get_hadjustment (sf); + GTK_VALUE_POINTER (*arg) = nautilus_scroll_frame_get_hadjustment (sf); break; case ARG_VADJUSTMENT: - GTK_VALUE_POINTER (*arg) = gtk_scroll_frame_get_vadjustment (sf); + GTK_VALUE_POINTER (*arg) = nautilus_scroll_frame_get_vadjustment (sf); break; case ARG_HSCROLLBAR_POLICY: - GTK_VALUE_ENUM (*arg) = priv->hsb_policy; + GTK_VALUE_ENUM (*arg) = details->hsb_policy; break; case ARG_VSCROLLBAR_POLICY: - GTK_VALUE_ENUM (*arg) = priv->vsb_policy; + GTK_VALUE_ENUM (*arg) = details->vsb_policy; break; case ARG_FRAME_PLACEMENT: - GTK_VALUE_ENUM (*arg) = priv->frame_placement; + GTK_VALUE_ENUM (*arg) = details->frame_placement; break; case ARG_SHADOW_TYPE: - GTK_VALUE_ENUM (*arg) = priv->shadow_type; + GTK_VALUE_ENUM (*arg) = details->shadow_type; break; case ARG_SCROLLBAR_SPACING: - GTK_VALUE_UINT (*arg) = priv->sb_spacing; + GTK_VALUE_UINT (*arg) = details->sb_spacing; break; default: @@ -336,21 +336,20 @@ gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) /* Destroy handler for the scroll frame widget */ static void -gtk_scroll_frame_destroy (GtkObject *object) +nautilus_scroll_frame_destroy (GtkObject *object) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (object != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (object)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (object)); - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; - gtk_widget_unparent (priv->hsb); - gtk_widget_unparent (priv->vsb); - gtk_widget_destroy (priv->hsb); - gtk_widget_destroy (priv->vsb); + gtk_widget_unparent (details->hsb); + gtk_widget_unparent (details->vsb); + gtk_widget_destroy (details->hsb); + gtk_widget_destroy (details->vsb); if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -358,18 +357,18 @@ gtk_scroll_frame_destroy (GtkObject *object) /* Finalize handler for the scroll frame widget */ static void -gtk_scroll_frame_finalize (GtkObject *object) +nautilus_scroll_frame_finalize (GtkObject *object) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; - gtk_widget_unref (priv->hsb); - gtk_widget_unref (priv->vsb); + gtk_widget_unref (details->hsb); + gtk_widget_unref (details->vsb); - g_free (priv); + g_free (details); if (GTK_OBJECT_CLASS (parent_class)->finalize) (* GTK_OBJECT_CLASS (parent_class)->finalize) (object); @@ -377,86 +376,83 @@ gtk_scroll_frame_finalize (GtkObject *object) /* Map handler for the scroll frame widget */ static void -gtk_scroll_frame_map (GtkWidget *widget) +nautilus_scroll_frame_map (GtkWidget *widget) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; /* chain parent class handler to map self and child */ if (GTK_WIDGET_CLASS (parent_class)->map) (* GTK_WIDGET_CLASS (parent_class)->map) (widget); - if (GTK_WIDGET_VISIBLE (priv->hsb) && !GTK_WIDGET_MAPPED (priv->hsb)) - gtk_widget_map (priv->hsb); + if (GTK_WIDGET_VISIBLE (details->hsb) && !GTK_WIDGET_MAPPED (details->hsb)) + gtk_widget_map (details->hsb); - if (GTK_WIDGET_VISIBLE (priv->vsb) && !GTK_WIDGET_MAPPED (priv->vsb)) - gtk_widget_map (priv->vsb); + if (GTK_WIDGET_VISIBLE (details->vsb) && !GTK_WIDGET_MAPPED (details->vsb)) + gtk_widget_map (details->vsb); } /* Unmap handler for the scroll frame widget */ static void -gtk_scroll_frame_unmap (GtkWidget *widget) +nautilus_scroll_frame_unmap (GtkWidget *widget) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; /* chain parent class handler to unmap self and child */ if (GTK_WIDGET_CLASS (parent_class)->unmap) (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget); - if (GTK_WIDGET_MAPPED (priv->hsb)) - gtk_widget_unmap (priv->hsb); + if (GTK_WIDGET_MAPPED (details->hsb)) + gtk_widget_unmap (details->hsb); - if (GTK_WIDGET_MAPPED (priv->vsb)) - gtk_widget_unmap (priv->vsb); + if (GTK_WIDGET_MAPPED (details->vsb)) + gtk_widget_unmap (details->vsb); } /* Draws the shadow of a scroll frame widget */ static void -draw_shadow (GtkScrollFrame *sf, GdkRectangle *area) +draw_shadow (NautilusScrollFrame *sf, GdkRectangle *area) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; g_assert (area != NULL); - priv = sf->priv; + details = sf->details; gtk_paint_shadow (GTK_WIDGET (sf)->style, GTK_WIDGET (sf)->window, - GTK_STATE_NORMAL, priv->shadow_type, + GTK_STATE_NORMAL, details->shadow_type, area, GTK_WIDGET (sf), "scroll_frame", - priv->frame_x, priv->frame_y, - priv->frame_w, priv->frame_h); + details->frame_x, details->frame_y, + details->frame_w, details->frame_h); } /* Draw handler for the scroll frame widget */ static void -gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area) +nautilus_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; GdkRectangle child_area; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); g_return_if_fail (area != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; bin = GTK_BIN (widget); if (GTK_WIDGET_DRAWABLE (widget)) @@ -466,29 +462,28 @@ gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area) && gtk_widget_intersect (bin->child, area, &child_area)) gtk_widget_draw (bin->child, &child_area); - if (GTK_WIDGET_VISIBLE (priv->hsb) - && gtk_widget_intersect (priv->hsb, area, &child_area)) - gtk_widget_draw (priv->hsb, &child_area); + if (GTK_WIDGET_VISIBLE (details->hsb) + && gtk_widget_intersect (details->hsb, area, &child_area)) + gtk_widget_draw (details->hsb, &child_area); - if (GTK_WIDGET_VISIBLE (priv->vsb) - && gtk_widget_intersect (priv->vsb, area, &child_area)) - gtk_widget_draw (priv->vsb, &child_area); + if (GTK_WIDGET_VISIBLE (details->vsb) + && gtk_widget_intersect (details->vsb, area, &child_area)) + gtk_widget_draw (details->vsb, &child_area); } /* Forall handler for the scroll frame widget */ static void -gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals, +nautilus_scroll_frame_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (container != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (container)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (container)); g_return_if_fail (callback != NULL); - sf = GTK_SCROLL_FRAME (container); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (container); + details = sf->details; if (GTK_CONTAINER_CLASS (parent_class)->forall) (* GTK_CONTAINER_CLASS (parent_class)->forall) ( @@ -496,20 +491,20 @@ gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals, callback, callback_data); if (include_internals) { - if (priv->vsb) - (* callback) (priv->vsb, callback_data); + if (details->vsb) + (* callback) (details->vsb, callback_data); - if (priv->hsb) - (* callback) (priv->hsb, callback_data); + if (details->hsb) + (* callback) (details->hsb, callback_data); } } /* Size_request handler for the scroll frame widget */ static void -gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) +nautilus_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; gint extra_width; gint extra_height; @@ -517,12 +512,11 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) GtkRequisition vsb_requisition; GtkRequisition child_requisition; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); g_return_if_fail (requisition != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; bin = GTK_BIN (widget); extra_width = 0; @@ -531,13 +525,13 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) requisition->width = GTK_CONTAINER (widget)->border_width * 2; requisition->height = GTK_CONTAINER (widget)->border_width * 2; - if (priv->shadow_type != GTK_SHADOW_NONE) { + if (details->shadow_type != GTK_SHADOW_NONE) { requisition->width += 2 * widget->style->klass->xthickness; requisition->height += 2 * widget->style->klass->ythickness; } - gtk_widget_size_request (priv->hsb, &hsb_requisition); - gtk_widget_size_request (priv->vsb, &vsb_requisition); + gtk_widget_size_request (details->hsb, &hsb_requisition); + gtk_widget_size_request (details->vsb, &vsb_requisition); if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { static guint quark_aux_info; @@ -547,7 +541,7 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) gtk_widget_size_request (bin->child, &child_requisition); - if (priv->hsb_policy == GTK_POLICY_NEVER) + if (details->hsb_policy == GTK_POLICY_NEVER) requisition->width += child_requisition.width; else { GtkWidgetAuxInfo *aux_info; @@ -561,7 +555,7 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) requisition->width += vsb_requisition.width; } - if (priv->vsb_policy == GTK_POLICY_NEVER) + if (details->vsb_policy == GTK_POLICY_NEVER) requisition->height += child_requisition.height; else { GtkWidgetAuxInfo *aux_info; @@ -576,16 +570,16 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) } } - if (priv->hsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (priv->hsb)) { + if (details->hsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (details->hsb)) { requisition->width = MAX (requisition->width, hsb_requisition.width); - if (!extra_height || GTK_WIDGET_VISIBLE (priv->hsb)) - extra_height = priv->sb_spacing + hsb_requisition.height; + if (!extra_height || GTK_WIDGET_VISIBLE (details->hsb)) + extra_height = details->sb_spacing + hsb_requisition.height; } - if (priv->vsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (priv->vsb)) { + if (details->vsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (details->vsb)) { requisition->height = MAX (requisition->height, vsb_requisition.height); - if (!extra_width || GTK_WIDGET_VISIBLE (priv->vsb)) - extra_width = priv->sb_spacing + vsb_requisition.width; + if (!extra_width || GTK_WIDGET_VISIBLE (details->vsb)) + extra_width = details->sb_spacing + vsb_requisition.width; } requisition->width += MAX (0, extra_width); @@ -596,85 +590,83 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) static void compute_relative_allocation (GtkWidget *widget, GtkAllocation *allocation) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_assert (widget != NULL); - g_assert (GTK_IS_SCROLL_FRAME (widget)); + g_assert (NAUTILUS_IS_SCROLL_FRAME (widget)); g_assert (allocation != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; allocation->x = GTK_CONTAINER (widget)->border_width; allocation->y = GTK_CONTAINER (widget)->border_width; allocation->width = MAX (1, (gint) widget->allocation.width - allocation->x * 2); allocation->height = MAX (1, (gint) widget->allocation.height - allocation->y * 2); - if (priv->vsb_visible) { + if (details->vsb_visible) { GtkRequisition vsb_requisition; gint possible_new_width; - gtk_widget_get_child_requisition (priv->vsb, &vsb_requisition); + gtk_widget_get_child_requisition (details->vsb, &vsb_requisition); - if (priv->frame_placement == GTK_CORNER_TOP_RIGHT - || priv->frame_placement == GTK_CORNER_BOTTOM_RIGHT) - allocation->x += vsb_requisition.width + priv->sb_spacing; + if (details->frame_placement == GTK_CORNER_TOP_RIGHT + || details->frame_placement == GTK_CORNER_BOTTOM_RIGHT) + allocation->x += vsb_requisition.width + details->sb_spacing; possible_new_width = ((gint) allocation->width - - ((gint) vsb_requisition.width + priv->sb_spacing)); + - ((gint) vsb_requisition.width + details->sb_spacing)); allocation->width = MAX (0, possible_new_width); } - if (priv->hsb_visible) { + if (details->hsb_visible) { GtkRequisition hsb_requisition; gint possible_new_height; - gtk_widget_get_child_requisition (priv->hsb, &hsb_requisition); + gtk_widget_get_child_requisition (details->hsb, &hsb_requisition); - if (priv->frame_placement == GTK_CORNER_BOTTOM_LEFT - || priv->frame_placement == GTK_CORNER_BOTTOM_RIGHT) - allocation->y += hsb_requisition.height + priv->sb_spacing; + if (details->frame_placement == GTK_CORNER_BOTTOM_LEFT + || details->frame_placement == GTK_CORNER_BOTTOM_RIGHT) + allocation->y += hsb_requisition.height + details->sb_spacing; possible_new_height = ( ((gint)allocation->height) - - ((gint)hsb_requisition.height) + ((gint)priv->sb_spacing)); + - ((gint)hsb_requisition.height) + ((gint)details->sb_spacing)); allocation->height = MAX (0, possible_new_height); } } /* Size_allocate handler for the scroll frame widget */ static void -gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) +nautilus_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; GtkAllocation relative_allocation; GtkAllocation child_allocation; gint xthickness, ythickness; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); g_return_if_fail (allocation != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; bin = GTK_BIN (widget); widget->allocation = *allocation; - if (priv->hsb_policy == GTK_POLICY_ALWAYS) - priv->hsb_visible = TRUE; - else if (priv->hsb_policy == GTK_POLICY_NEVER) - priv->hsb_visible = FALSE; + if (details->hsb_policy == GTK_POLICY_ALWAYS) + details->hsb_visible = TRUE; + else if (details->hsb_policy == GTK_POLICY_NEVER) + details->hsb_visible = FALSE; - if (priv->vsb_policy == GTK_POLICY_ALWAYS) - priv->vsb_visible = TRUE; - else if (priv->vsb_policy == GTK_POLICY_NEVER) - priv->vsb_visible = FALSE; + if (details->vsb_policy == GTK_POLICY_ALWAYS) + details->vsb_visible = TRUE; + else if (details->vsb_policy == GTK_POLICY_NEVER) + details->vsb_visible = FALSE; - if (priv->shadow_type == GTK_SHADOW_NONE) { + if (details->shadow_type == GTK_SHADOW_NONE) { xthickness = 0; ythickness = 0; } else { @@ -692,20 +684,20 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) compute_relative_allocation (widget, &relative_allocation); - priv->frame_x = relative_allocation.x + allocation->x; - priv->frame_y = relative_allocation.y + allocation->y; - priv->frame_w = relative_allocation.width; - priv->frame_h = relative_allocation.height; + details->frame_x = relative_allocation.x + allocation->x; + details->frame_y = relative_allocation.y + allocation->y; + details->frame_w = relative_allocation.width; + details->frame_h = relative_allocation.height; - child_allocation.x = priv->frame_x + xthickness; - child_allocation.y = priv->frame_y + ythickness; - possible_new_size = priv->frame_w - 2 * xthickness; + child_allocation.x = details->frame_x + xthickness; + child_allocation.y = details->frame_y + ythickness; + possible_new_size = details->frame_w - 2 * xthickness; child_allocation.width = MAX(1, possible_new_size); - possible_new_size = priv->frame_h - 2 * ythickness; + possible_new_size = details->frame_h - 2 * ythickness; child_allocation.height = MAX(1, possible_new_size); - previous_hvis = priv->hsb_visible; - previous_vvis = priv->vsb_visible; + previous_hvis = details->hsb_visible; + previous_vvis = details->vsb_visible; gtk_widget_size_allocate (bin->child, &child_allocation); @@ -713,10 +705,10 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) * vscrollbar flip visiblity, then we need both. */ if (count - && previous_hvis != priv->hsb_visible - && previous_vvis != priv->vsb_visible) { - priv->hsb_visible = TRUE; - priv->vsb_visible = TRUE; + && previous_hvis != details->hsb_visible + && previous_vvis != details->vsb_visible) { + details->hsb_visible = TRUE; + details->vsb_visible = TRUE; /* a new resize is already queued at this point, * so we will immediatedly get reinvoked @@ -725,26 +717,26 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) } count++; - } while (previous_hvis != priv->hsb_visible - || previous_vvis != priv->vsb_visible); + } while (previous_hvis != details->hsb_visible + || previous_vvis != details->vsb_visible); } else compute_relative_allocation (widget, &relative_allocation); - if (priv->hsb_visible) { + if (details->hsb_visible) { GtkRequisition hscrollbar_requisition; - gtk_widget_get_child_requisition (priv->hsb, &hscrollbar_requisition); + gtk_widget_get_child_requisition (details->hsb, &hscrollbar_requisition); - if (!GTK_WIDGET_VISIBLE (priv->hsb)) - gtk_widget_show (priv->hsb); + if (!GTK_WIDGET_VISIBLE (details->hsb)) + gtk_widget_show (details->hsb); child_allocation.x = relative_allocation.x; - if (priv->frame_placement == GTK_CORNER_TOP_LEFT - || priv->frame_placement == GTK_CORNER_TOP_RIGHT) + if (details->frame_placement == GTK_CORNER_TOP_LEFT + || details->frame_placement == GTK_CORNER_TOP_RIGHT) child_allocation.y = (relative_allocation.y #if 0 + relative_allocation.height - + priv->sb_spacing); + + details->sb_spacing); #else + relative_allocation.height); #endif @@ -756,23 +748,23 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) child_allocation.x += allocation->x; child_allocation.y += allocation->y; - gtk_widget_size_allocate (priv->hsb, &child_allocation); - } else if (GTK_WIDGET_VISIBLE (priv->hsb)) - gtk_widget_hide (priv->hsb); + gtk_widget_size_allocate (details->hsb, &child_allocation); + } else if (GTK_WIDGET_VISIBLE (details->hsb)) + gtk_widget_hide (details->hsb); - if (priv->vsb_visible) { + if (details->vsb_visible) { GtkRequisition vscrollbar_requisition; - if (!GTK_WIDGET_VISIBLE (priv->vsb)) - gtk_widget_show (priv->vsb); + if (!GTK_WIDGET_VISIBLE (details->vsb)) + gtk_widget_show (details->vsb); - gtk_widget_get_child_requisition (priv->vsb, &vscrollbar_requisition); + gtk_widget_get_child_requisition (details->vsb, &vscrollbar_requisition); - if (priv->frame_placement == GTK_CORNER_TOP_LEFT - || priv->frame_placement == GTK_CORNER_BOTTOM_LEFT) + if (details->frame_placement == GTK_CORNER_TOP_LEFT + || details->frame_placement == GTK_CORNER_BOTTOM_LEFT) child_allocation.x = (relative_allocation.x + relative_allocation.width - + priv->sb_spacing); + + details->sb_spacing); else child_allocation.x = GTK_CONTAINER (sf)->border_width; @@ -782,22 +774,21 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) child_allocation.x += allocation->x; child_allocation.y += allocation->y; - gtk_widget_size_allocate (priv->vsb, &child_allocation); - } else if (GTK_WIDGET_VISIBLE (priv->vsb)) - gtk_widget_hide (priv->vsb); + gtk_widget_size_allocate (details->vsb, &child_allocation); + } else if (GTK_WIDGET_VISIBLE (details->vsb)) + gtk_widget_hide (details->vsb); } /* Expose handler for the scroll frame widget */ static gint -gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) +nautilus_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) { - GtkScrollFrame *sf; + NautilusScrollFrame *sf; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_SCROLL_FRAME (widget), FALSE); + g_return_val_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); - sf = GTK_SCROLL_FRAME (widget); + sf = NAUTILUS_SCROLL_FRAME (widget); if (GTK_WIDGET_DRAWABLE (widget)) draw_shadow (sf, &event->area); @@ -810,14 +801,14 @@ gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) /* Add handler for the scroll frame widget */ static void -gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child) +nautilus_scroll_frame_add (GtkContainer *container, GtkWidget *child) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; - sf = GTK_SCROLL_FRAME (container); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (container); + details = sf->details; bin = GTK_BIN (container); g_return_if_fail (bin->child == NULL); @@ -826,10 +817,10 @@ gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child) /* this is a temporary message */ if (!gtk_widget_set_scroll_adjustments (child, - gtk_range_get_adjustment (GTK_RANGE (priv->hsb)), - gtk_range_get_adjustment (GTK_RANGE (priv->vsb)))) - g_warning ("gtk_scroll_frame_add(): cannot add non scrollable widget " - "use gtk_scroll_frame_add_with_viewport() instead"); + gtk_range_get_adjustment (GTK_RANGE (details->hsb)), + gtk_range_get_adjustment (GTK_RANGE (details->vsb)))) + g_warning ("nautilus_scroll_frame_add(): cannot add non scrollable widget " + "use nautilus_scroll_frame_add_with_viewport() instead"); if (GTK_WIDGET_REALIZED (child->parent)) gtk_widget_realize (child); @@ -844,10 +835,9 @@ gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child) /* Remove method for the scroll frame widget */ static void -gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child) +nautilus_scroll_frame_remove (GtkContainer *container, GtkWidget *child) { - g_return_if_fail (container != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (container)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (container)); g_return_if_fail (child != NULL); g_return_if_fail (GTK_BIN (container)->child == child); @@ -859,7 +849,7 @@ gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child) } /** - * gtk_scroll_frame_new: + * nautilus_scroll_frame_new: * @hadj: If non-NULL, the adjustment to use for horizontal scrolling. * @vadj: If non-NULL, the adjustment to use for vertical scrolling. * @@ -868,7 +858,7 @@ gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child) * Return value: The newly-created scroll frame widget. **/ GtkWidget * -gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) +nautilus_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) { if (hadj) g_return_val_if_fail (GTK_IS_ADJUSTMENT (hadj), NULL); @@ -876,7 +866,7 @@ gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) if (vadj) g_return_val_if_fail (GTK_IS_ADJUSTMENT (vadj), NULL); - return gtk_widget_new (GTK_TYPE_SCROLL_FRAME, + return gtk_widget_new (NAUTILUS_TYPE_SCROLL_FRAME, "hadjustment", hadj, "vadjustment", vadj, NULL); @@ -886,39 +876,38 @@ gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) static void adjustment_changed (GtkAdjustment *adj, gpointer data) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (adj != NULL); g_return_if_fail (GTK_IS_ADJUSTMENT (adj)); g_return_if_fail (data != NULL); - sf = GTK_SCROLL_FRAME (data); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (data); + details = sf->details; - if (adj == gtk_range_get_adjustment (GTK_RANGE (priv->hsb))) { - if (priv->hsb_policy == GTK_POLICY_AUTOMATIC) { + if (adj == gtk_range_get_adjustment (GTK_RANGE (details->hsb))) { + if (details->hsb_policy == GTK_POLICY_AUTOMATIC) { gboolean visible; - visible = priv->hsb_visible; - priv->hsb_visible = (adj->upper - adj->lower > adj->page_size); - if (priv->hsb_visible != visible) + visible = details->hsb_visible; + details->hsb_visible = (adj->upper - adj->lower > adj->page_size); + if (details->hsb_visible != visible) gtk_widget_queue_resize (GTK_WIDGET (sf)); } - } else if (adj == gtk_range_get_adjustment (GTK_RANGE (priv->vsb))) { - if (priv->vsb_policy == GTK_POLICY_AUTOMATIC) { + } else if (adj == gtk_range_get_adjustment (GTK_RANGE (details->vsb))) { + if (details->vsb_policy == GTK_POLICY_AUTOMATIC) { gboolean visible; - visible = priv->vsb_visible; - priv->vsb_visible = (adj->upper - adj->lower > adj->page_size); - if (priv->vsb_visible != visible) + visible = details->vsb_visible; + details->vsb_visible = (adj->upper - adj->lower > adj->page_size); + if (details->vsb_visible != visible) gtk_widget_queue_resize (GTK_WIDGET (sf)); } } } /** - * gtk_scroll_frame_set_hadjustment: + * nautilus_scroll_frame_set_hadjustment: * @sf: A scroll frame widget. * @adj: An adjustment. * @@ -926,43 +915,42 @@ adjustment_changed (GtkAdjustment *adj, gpointer data) * widget. **/ void -gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) +nautilus_scroll_frame_set_hadjustment (NautilusScrollFrame *sf, GtkAdjustment *adj) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; if (adj) g_return_if_fail (GTK_IS_ADJUSTMENT (adj)); else adj = GTK_ADJUSTMENT (gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL)); - if (!priv->hsb) { + if (!details->hsb) { gtk_widget_push_composite_child (); - priv->hsb = gtk_hscrollbar_new (adj); - gtk_widget_set_composite_name (priv->hsb, "hscrollbar"); + details->hsb = gtk_hscrollbar_new (adj); + gtk_widget_set_composite_name (details->hsb, "hscrollbar"); gtk_widget_pop_composite_child (); - gtk_widget_set_parent (priv->hsb, GTK_WIDGET (sf)); - gtk_widget_ref (priv->hsb); - gtk_widget_show (priv->hsb); + gtk_widget_set_parent (details->hsb, GTK_WIDGET (sf)); + gtk_widget_ref (details->hsb); + gtk_widget_show (details->hsb); } else { GtkAdjustment *old_adj; - old_adj = gtk_range_get_adjustment (GTK_RANGE (priv->hsb)); + old_adj = gtk_range_get_adjustment (GTK_RANGE (details->hsb)); if (old_adj == adj) return; gtk_signal_disconnect_by_func (GTK_OBJECT (old_adj), GTK_SIGNAL_FUNC (adjustment_changed), sf); - gtk_range_set_adjustment (GTK_RANGE (priv->hsb), adj); + gtk_range_set_adjustment (GTK_RANGE (details->hsb), adj); } - adj = gtk_range_get_adjustment (GTK_RANGE (priv->hsb)); + adj = gtk_range_get_adjustment (GTK_RANGE (details->hsb)); gtk_signal_connect (GTK_OBJECT (adj), "changed", GTK_SIGNAL_FUNC (adjustment_changed), @@ -972,12 +960,12 @@ gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) if (GTK_BIN (sf)->child) gtk_widget_set_scroll_adjustments ( GTK_BIN (sf)->child, - gtk_range_get_adjustment (GTK_RANGE (priv->hsb)), - gtk_range_get_adjustment (GTK_RANGE (priv->vsb))); + gtk_range_get_adjustment (GTK_RANGE (details->hsb)), + gtk_range_get_adjustment (GTK_RANGE (details->vsb))); } /** - * gtk_scroll_frame_set_vadjustment: + * nautilus_scroll_frame_set_vadjustment: * @sf: A scroll frame widget. * @adj: An adjustment. * @@ -985,43 +973,42 @@ gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) * widget. **/ void -gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) +nautilus_scroll_frame_set_vadjustment (NautilusScrollFrame *sf, GtkAdjustment *adj) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; if (adj) g_return_if_fail (GTK_IS_ADJUSTMENT (adj)); else adj = GTK_ADJUSTMENT (gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL)); - if (!priv->vsb) { + if (!details->vsb) { gtk_widget_push_composite_child (); - priv->vsb = gtk_vscrollbar_new (adj); - gtk_widget_set_composite_name (priv->vsb, "vscrollbar"); + details->vsb = gtk_vscrollbar_new (adj); + gtk_widget_set_composite_name (details->vsb, "vscrollbar"); gtk_widget_pop_composite_child (); - gtk_widget_set_parent (priv->vsb, GTK_WIDGET (sf)); - gtk_widget_ref (priv->vsb); - gtk_widget_show (priv->vsb); + gtk_widget_set_parent (details->vsb, GTK_WIDGET (sf)); + gtk_widget_ref (details->vsb); + gtk_widget_show (details->vsb); } else { GtkAdjustment *old_adj; - old_adj = gtk_range_get_adjustment (GTK_RANGE (priv->vsb)); + old_adj = gtk_range_get_adjustment (GTK_RANGE (details->vsb)); if (old_adj == adj) return; gtk_signal_disconnect_by_func (GTK_OBJECT (old_adj), GTK_SIGNAL_FUNC (adjustment_changed), sf); - gtk_range_set_adjustment (GTK_RANGE (priv->vsb), adj); + gtk_range_set_adjustment (GTK_RANGE (details->vsb), adj); } - adj = gtk_range_get_adjustment (GTK_RANGE (priv->vsb)); + adj = gtk_range_get_adjustment (GTK_RANGE (details->vsb)); gtk_signal_connect (GTK_OBJECT (adj), "changed", GTK_SIGNAL_FUNC (adjustment_changed), @@ -1031,12 +1018,12 @@ gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) if (GTK_BIN (sf)->child) gtk_widget_set_scroll_adjustments ( GTK_BIN (sf)->child, - gtk_range_get_adjustment (GTK_RANGE (priv->hsb)), - gtk_range_get_adjustment (GTK_RANGE (priv->vsb))); + gtk_range_get_adjustment (GTK_RANGE (details->hsb)), + gtk_range_get_adjustment (GTK_RANGE (details->vsb))); } /** - * gtk_scroll_frame_get_hadjustment: + * nautilus_scroll_frame_get_hadjustment: * @sf: A scroll frame widget. * * Queries the horizontal adjustment of a scroll frame widget. @@ -1044,20 +1031,19 @@ gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) * Return value: The horizontal adjustment of the scroll frame, or NULL if none. **/ GtkAdjustment * -gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf) +nautilus_scroll_frame_get_hadjustment (NautilusScrollFrame *sf) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_val_if_fail (sf != NULL, NULL); - g_return_val_if_fail (GTK_IS_SCROLL_FRAME (sf), NULL); + g_return_val_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf), NULL); - priv = sf->priv; + details = sf->details; - return priv->hsb ? gtk_range_get_adjustment (GTK_RANGE (priv->hsb)) : NULL; + return details->hsb ? gtk_range_get_adjustment (GTK_RANGE (details->hsb)) : NULL; } /** - * gtk_scroll_frame_get_vadjustment: + * nautilus_scroll_frame_get_vadjustment: * @sf: A scroll frame widget. * * Queries the vertical adjustment of a scroll frame widget. @@ -1065,20 +1051,19 @@ gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf) * Return value: The vertical adjustment of the scroll frame, or NULL if none. **/ GtkAdjustment * -gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf) +nautilus_scroll_frame_get_vadjustment (NautilusScrollFrame *sf) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_val_if_fail (sf != NULL, NULL); - g_return_val_if_fail (GTK_IS_SCROLL_FRAME (sf), NULL); + g_return_val_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf), NULL); - priv = sf->priv; + details = sf->details; - return priv->vsb ? gtk_range_get_adjustment (GTK_RANGE (priv->vsb)) : NULL; + return details->vsb ? gtk_range_get_adjustment (GTK_RANGE (details->vsb)) : NULL; } /** - * gtk_scroll_frame_set_policy: + * nautilus_scroll_frame_set_policy: * @sf: A scroll frame widget. * @hsb_policy: Policy for the horizontal scrollbar. * @vsb_policy: Policy for the vertical scrollbar. @@ -1087,28 +1072,27 @@ gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf) * the scrollbars are to be shown or hidden. **/ void -gtk_scroll_frame_set_policy (GtkScrollFrame *sf, +nautilus_scroll_frame_set_policy (NautilusScrollFrame *sf, GtkPolicyType hsb_policy, GtkPolicyType vsb_policy) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; - if (priv->hsb_policy == hsb_policy && priv->vsb_policy == vsb_policy) + if (details->hsb_policy == hsb_policy && details->vsb_policy == vsb_policy) return; - priv->hsb_policy = hsb_policy; - priv->vsb_policy = vsb_policy; + details->hsb_policy = hsb_policy; + details->vsb_policy = vsb_policy; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_set_placement: + * nautilus_scroll_frame_set_placement: * @sf: A scroll frame widget. * @frame_placement: Placement for the frame. * @@ -1116,24 +1100,23 @@ gtk_scroll_frame_set_policy (GtkScrollFrame *sf, * scrollbars. **/ void -gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placement) +nautilus_scroll_frame_set_placement (NautilusScrollFrame *sf, GtkCornerType frame_placement) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; - if (priv->frame_placement == frame_placement) + if (details->frame_placement == frame_placement) return; - priv->frame_placement = frame_placement; + details->frame_placement = frame_placement; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_set_shadow_type: + * nautilus_scroll_frame_set_shadow_type: * @sf: A scroll frame widget. * @shadow_type: A shadow type. * @@ -1141,25 +1124,24 @@ gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placemen * insert a child that does not paint a frame on its own. **/ void -gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type) +nautilus_scroll_frame_set_shadow_type (NautilusScrollFrame *sf, GtkShadowType shadow_type) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); g_return_if_fail (shadow_type <= GTK_SHADOW_ETCHED_OUT); - priv = sf->priv; + details = sf->details; - if (priv->shadow_type == shadow_type) + if (details->shadow_type == shadow_type) return; - priv->shadow_type = shadow_type; + details->shadow_type = shadow_type; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_set_scrollbar_spacing: + * nautilus_scroll_frame_set_scrollbar_spacing: * @sf: A scroll frame widget. * @spacing: Desired spacing in pixels. * @@ -1167,24 +1149,23 @@ gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type) * widget. **/ void -gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing) +nautilus_scroll_frame_set_scrollbar_spacing (NautilusScrollFrame *sf, guint spacing) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; - if (priv->sb_spacing == spacing) + if (details->sb_spacing == spacing) return; - priv->sb_spacing = spacing; + details->sb_spacing = spacing; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_add_with_viewport: + * nautilus_scroll_frame_add_with_viewport: * @sf: A scroll frame widget. * @child: A widget. * @@ -1193,19 +1174,17 @@ gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing) * used only when a child does not support the scrolling interface. **/ void -gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child) +nautilus_scroll_frame_add_with_viewport (NautilusScrollFrame *sf, GtkWidget *child) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; GtkBin *bin; GtkWidget *viewport; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); - g_return_if_fail (child != NULL); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); g_return_if_fail (GTK_IS_WIDGET (child)); g_return_if_fail (child->parent == NULL); - priv = sf->priv; + details = sf->details; bin = GTK_BIN (sf); if (bin->child != NULL) { @@ -1214,8 +1193,8 @@ gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child) viewport = bin->child; } else { - viewport = gtk_viewport_new (gtk_scroll_frame_get_hadjustment (sf), - gtk_scroll_frame_get_vadjustment (sf)); + viewport = gtk_viewport_new (nautilus_scroll_frame_get_hadjustment (sf), + nautilus_scroll_frame_get_vadjustment (sf)); gtk_container_add (GTK_CONTAINER (sf), viewport); } diff --git a/libnautilus-extensions/gtkscrollframe.h b/libnautilus-extensions/gtkscrollframe.h index 749417a8b..2807b24fd 100644 --- a/libnautilus-extensions/gtkscrollframe.h +++ b/libnautilus-extensions/gtkscrollframe.h @@ -25,70 +25,62 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#ifndef __GTK_SCROLL_FRAME_H__ -#define __GTK_SCROLL_FRAME_H__ +#ifndef GTK_SCROLL_FRAME_H +#define GTK_SCROLL_FRAME_H - -#include <gdk/gdk.h> #include <gtk/gtkbin.h> - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ - -#define GTK_TYPE_SCROLL_FRAME (gtk_scroll_frame_get_type ()) -#define GTK_SCROLL_FRAME(obj) (GTK_CHECK_CAST ((obj), \ - GTK_TYPE_SCROLL_FRAME, GtkScrollFrame)) -#define GTK_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \ - GTK_TYPE_SCROLL_FRAME, GtkScrollFrameClass)) -#define GTK_IS_SCROLL_FRAME(obj) (GTK_CHECK_TYPE ((obj), \ - GTK_TYPE_SCROLL_FRAME)) -#define GTK_IS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \ - GTK_TYPE_SCROLL_FRAME)) - - -typedef struct _GtkScrollFrame GtkScrollFrame; -typedef struct _GtkScrollFrameClass GtkScrollFrameClass; - -struct _GtkScrollFrame +#define NAUTILUS_TYPE_SCROLL_FRAME (nautilus_scroll_frame_get_type ()) +#define NAUTILUS_SCROLL_FRAME(obj) (GTK_CHECK_CAST ((obj), \ + NAUTILUS_TYPE_SCROLL_FRAME, NautilusScrollFrame)) +#define NAUTILUS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \ + NAUTILUS_TYPE_SCROLL_FRAME, NautilusScrollFrameClass)) +#define NAUTILUS_IS_SCROLL_FRAME(obj) (GTK_CHECK_TYPE ((obj), \ + NAUTILUS_TYPE_SCROLL_FRAME)) +#define NAUTILUS_IS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \ + NAUTILUS_TYPE_SCROLL_FRAME)) + +typedef struct NautilusScrollFrame NautilusScrollFrame; +typedef struct NautilusScrollFrameClass NautilusScrollFrameClass; +typedef struct NautilusScrollFrameDetails NautilusScrollFrameDetails; + +struct NautilusScrollFrame { GtkBin bin; - - /* Private data */ - gpointer priv; + NautilusScrollFrameDetails *details; }; - -struct _GtkScrollFrameClass +struct NautilusScrollFrameClass { GtkBinClass parent_class; }; - -GtkType gtk_scroll_frame_get_type (void); -GtkWidget *gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj); - -void gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj); -void gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj); - -GtkAdjustment *gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf); -GtkAdjustment *gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf); - -void gtk_scroll_frame_set_policy (GtkScrollFrame *sf, - GtkPolicyType hsb_policy, - GtkPolicyType vsb_policy); - -void gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placement); -void gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type); -void gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing); - -void gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child); - +GtkType nautilus_scroll_frame_get_type (void); +GtkWidget * nautilus_scroll_frame_new (GtkAdjustment *h_adjustment, + GtkAdjustment *v_adjustment); +void nautilus_scroll_frame_set_hadjustment (NautilusScrollFrame *frame, + GtkAdjustment *adj); +void nautilus_scroll_frame_set_vadjustment (NautilusScrollFrame *frame, + GtkAdjustment *adj); +GtkAdjustment *nautilus_scroll_frame_get_hadjustment (NautilusScrollFrame *frame); +GtkAdjustment *nautilus_scroll_frame_get_vadjustment (NautilusScrollFrame *frame); +void nautilus_scroll_frame_set_policy (NautilusScrollFrame *frame, + GtkPolicyType h_scroll_policy, + GtkPolicyType v_scroll_policy); +void nautilus_scroll_frame_set_placement (NautilusScrollFrame *frame, + GtkCornerType frame_placement); +void nautilus_scroll_frame_set_shadow_type (NautilusScrollFrame *frame, + GtkShadowType shadow_type); +void nautilus_scroll_frame_set_scrollbar_spacing (NautilusScrollFrame *frame, + guint spacing); +void nautilus_scroll_frame_add_with_viewport (NautilusScrollFrame *frame, + GtkWidget *child); #ifdef __cplusplus } #endif /* __cplusplus */ - -#endif /* __GTK_SCROLL_FRAME_H__ */ +#endif /* GTK_SCROLL_FRAME_H */ diff --git a/libnautilus-extensions/nautilus-preferences-item.c b/libnautilus-extensions/nautilus-preferences-item.c index 9808891c4..25d57b14f 100644 --- a/libnautilus-extensions/nautilus-preferences-item.c +++ b/libnautilus-extensions/nautilus-preferences-item.c @@ -78,10 +78,10 @@ static void preferences_item_create_enum (NautilusPreferencesItem const NautilusPreference *prefrence); static void preferences_item_create_boolean (NautilusPreferencesItem *item, const NautilusPreference *prefrence); -static void enum_radio_group_changed_cb (GtkWidget *button_group, +static void enum_radio_group_changed_callback (GtkWidget *button_group, GtkWidget *button, gpointer user_data); -static void boolean_button_toggled_cb (GtkWidget *button_group, +static void boolean_button_toggled_callback (GtkWidget *button_group, gpointer user_data); NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesItem, nautilus_preferences_item, GTK_TYPE_VBOX) @@ -309,7 +309,7 @@ preferences_item_create_enum (NautilusPreferencesItem *item, gtk_signal_connect (GTK_OBJECT (item->details->child), "changed", - GTK_SIGNAL_FUNC (enum_radio_group_changed_cb), + GTK_SIGNAL_FUNC (enum_radio_group_changed_callback), (gpointer) item); } @@ -338,7 +338,7 @@ preferences_item_create_boolean (NautilusPreferencesItem *item, gtk_signal_connect (GTK_OBJECT (item->details->child), "toggled", - GTK_SIGNAL_FUNC (boolean_button_toggled_cb), + GTK_SIGNAL_FUNC (boolean_button_toggled_callback), (gpointer) item); } @@ -362,7 +362,7 @@ nautilus_preferences_item_new (const gchar *preference_name, } static void -enum_radio_group_changed_cb (GtkWidget *buttons, GtkWidget * button, gpointer user_data) +enum_radio_group_changed_callback (GtkWidget *buttons, GtkWidget * button, gpointer user_data) { NautilusPreferencesItem *item = (NautilusPreferencesItem *) user_data; const NautilusPreference *preference; @@ -380,7 +380,7 @@ enum_radio_group_changed_cb (GtkWidget *buttons, GtkWidget * button, gpointer us } static void -boolean_button_toggled_cb (GtkWidget *button, gpointer user_data) +boolean_button_toggled_callback (GtkWidget *button, gpointer user_data) { NautilusPreferencesItem *item = (NautilusPreferencesItem *) user_data; gboolean active_state; diff --git a/libnautilus-extensions/nautilus-scroll-frame.c b/libnautilus-extensions/nautilus-scroll-frame.c index 938c388c2..d8fed9059 100644 --- a/libnautilus-extensions/nautilus-scroll-frame.c +++ b/libnautilus-extensions/nautilus-scroll-frame.c @@ -80,8 +80,8 @@ enum { ARG_SCROLLBAR_SPACING }; -/* Private part of the GtkScrollFrame structure */ -typedef struct { +/* Private part of the NautilusScrollFrame structure */ +struct NautilusScrollFrameDetails { /* Horizontal and vertical scrollbars */ GtkWidget *hsb; GtkWidget *vsb; @@ -108,52 +108,52 @@ typedef struct { /* Shadow type for frame */ guint shadow_type : 3; -} ScrollFramePrivate; - - -static void gtk_scroll_frame_class_init (GtkScrollFrameClass *class); -static void gtk_scroll_frame_init (GtkScrollFrame *sf); -static void gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void gtk_scroll_frame_destroy (GtkObject *object); -static void gtk_scroll_frame_finalize (GtkObject *object); - -static void gtk_scroll_frame_map (GtkWidget *widget); -static void gtk_scroll_frame_unmap (GtkWidget *widget); -static void gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area); -static void gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition); -static void gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static gint gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event); - -static void gtk_scroll_frame_add (GtkContainer *container, GtkWidget *widget); -static void gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *widget); -static void gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals, +}; + + +static void nautilus_scroll_frame_class_init (NautilusScrollFrameClass *class); +static void nautilus_scroll_frame_init (NautilusScrollFrame *sf); +static void nautilus_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void nautilus_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void nautilus_scroll_frame_destroy (GtkObject *object); +static void nautilus_scroll_frame_finalize (GtkObject *object); + +static void nautilus_scroll_frame_map (GtkWidget *widget); +static void nautilus_scroll_frame_unmap (GtkWidget *widget); +static void nautilus_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area); +static void nautilus_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition); +static void nautilus_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static gint nautilus_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event); + +static void nautilus_scroll_frame_add (GtkContainer *container, GtkWidget *widget); +static void nautilus_scroll_frame_remove (GtkContainer *container, GtkWidget *widget); +static void nautilus_scroll_frame_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); static GtkBinClass *parent_class; /** - * gtk_scroll_frame_get_type: + * nautilus_scroll_frame_get_type: * @void: * - * Registers the &GtkScrollFrame class if necessary, and returns the type ID + * Registers the &NautilusScrollFrame class if necessary, and returns the type ID * associated to it. * - * Return value: The type ID of the &GtkScrollFrame class. + * Return value: The type ID of the &NautilusScrollFrame class. **/ GtkType -gtk_scroll_frame_get_type (void) +nautilus_scroll_frame_get_type (void) { static GtkType scroll_frame_type = 0; if (!scroll_frame_type) { static const GtkTypeInfo scroll_frame_info = { - "GtkScrollFrame", - sizeof (GtkScrollFrame), - sizeof (GtkScrollFrameClass), - (GtkClassInitFunc) gtk_scroll_frame_class_init, - (GtkObjectInitFunc) gtk_scroll_frame_init, + "NautilusScrollFrame", + sizeof (NautilusScrollFrame), + sizeof (NautilusScrollFrameClass), + (GtkClassInitFunc) nautilus_scroll_frame_class_init, + (GtkObjectInitFunc) nautilus_scroll_frame_init, NULL, /* reserved_1 */ NULL, /* reserved_2 */ (GtkClassInitFunc) NULL @@ -167,7 +167,7 @@ gtk_scroll_frame_get_type (void) /* Class initialization function for the scroll frame widget */ static void -gtk_scroll_frame_class_init (GtkScrollFrameClass *class) +nautilus_scroll_frame_class_init (NautilusScrollFrameClass *class) { GtkObjectClass *object_class; GtkWidgetClass *widget_class; @@ -179,109 +179,109 @@ gtk_scroll_frame_class_init (GtkScrollFrameClass *class) parent_class = gtk_type_class (GTK_TYPE_BIN); - gtk_object_add_arg_type ("GtkScrollFrame::hadjustment", + gtk_object_add_arg_type ("NautilusScrollFrame::hadjustment", GTK_TYPE_ADJUSTMENT, GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT, ARG_HADJUSTMENT); - gtk_object_add_arg_type ("GtkScrollFrame::vadjustment", + gtk_object_add_arg_type ("NautilusScrollFrame::vadjustment", GTK_TYPE_ADJUSTMENT, GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT, ARG_VADJUSTMENT); - gtk_object_add_arg_type ("GtkScrollFrame::hscrollbar_policy", + gtk_object_add_arg_type ("NautilusScrollFrame::hscrollbar_policy", GTK_TYPE_POLICY_TYPE, GTK_ARG_READWRITE, ARG_HSCROLLBAR_POLICY); - gtk_object_add_arg_type ("GtkScrollFrame::vscrollbar_policy", + gtk_object_add_arg_type ("NautilusScrollFrame::vscrollbar_policy", GTK_TYPE_POLICY_TYPE, GTK_ARG_READWRITE, ARG_VSCROLLBAR_POLICY); - gtk_object_add_arg_type ("GtkScrollFrame::frame_placement", + gtk_object_add_arg_type ("NautilusScrollFrame::frame_placement", GTK_TYPE_CORNER_TYPE, GTK_ARG_READWRITE, ARG_FRAME_PLACEMENT); - gtk_object_add_arg_type ("GtkScrollFrame::shadow_type", + gtk_object_add_arg_type ("NautilusScrollFrame::shadow_type", GTK_TYPE_SHADOW_TYPE, GTK_ARG_READWRITE, ARG_SHADOW_TYPE); - gtk_object_add_arg_type ("GtkScrollFrame::scrollbar_spacing", + gtk_object_add_arg_type ("NautilusScrollFrame::scrollbar_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_SCROLLBAR_SPACING); - object_class->set_arg = gtk_scroll_frame_set_arg; - object_class->get_arg = gtk_scroll_frame_get_arg; - object_class->destroy = gtk_scroll_frame_destroy; - object_class->finalize = gtk_scroll_frame_finalize; - - widget_class->map = gtk_scroll_frame_map; - widget_class->unmap = gtk_scroll_frame_unmap; - widget_class->draw = gtk_scroll_frame_draw; - widget_class->size_request = gtk_scroll_frame_size_request; - widget_class->size_allocate = gtk_scroll_frame_size_allocate; - widget_class->expose_event = gtk_scroll_frame_expose; - - container_class->add = gtk_scroll_frame_add; - container_class->remove = gtk_scroll_frame_remove; - container_class->forall = gtk_scroll_frame_forall; + object_class->set_arg = nautilus_scroll_frame_set_arg; + object_class->get_arg = nautilus_scroll_frame_get_arg; + object_class->destroy = nautilus_scroll_frame_destroy; + object_class->finalize = nautilus_scroll_frame_finalize; + + widget_class->map = nautilus_scroll_frame_map; + widget_class->unmap = nautilus_scroll_frame_unmap; + widget_class->draw = nautilus_scroll_frame_draw; + widget_class->size_request = nautilus_scroll_frame_size_request; + widget_class->size_allocate = nautilus_scroll_frame_size_allocate; + widget_class->expose_event = nautilus_scroll_frame_expose; + + container_class->add = nautilus_scroll_frame_add; + container_class->remove = nautilus_scroll_frame_remove; + container_class->forall = nautilus_scroll_frame_forall; } /* Object initialization function for the scroll frame widget */ static void -gtk_scroll_frame_init (GtkScrollFrame *sf) +nautilus_scroll_frame_init (NautilusScrollFrame *sf) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - priv = g_new0 (ScrollFramePrivate, 1); - sf->priv = priv; + details = g_new0 (NautilusScrollFrameDetails, 1); + sf->details = details; GTK_WIDGET_SET_FLAGS (sf, GTK_NO_WINDOW); gtk_container_set_resize_mode (GTK_CONTAINER (sf), GTK_RESIZE_QUEUE); - priv->sb_spacing = 3; - priv->hsb_policy = GTK_POLICY_ALWAYS; - priv->vsb_policy = GTK_POLICY_ALWAYS; - priv->frame_placement = GTK_CORNER_TOP_LEFT; - priv->shadow_type = GTK_SHADOW_NONE; + details->sb_spacing = 3; + details->hsb_policy = GTK_POLICY_ALWAYS; + details->vsb_policy = GTK_POLICY_ALWAYS; + details->frame_placement = GTK_CORNER_TOP_LEFT; + details->shadow_type = GTK_SHADOW_NONE; } /* Set_arg handler for the scroll frame widget */ static void -gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) +nautilus_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; switch (arg_id) { case ARG_HADJUSTMENT: - gtk_scroll_frame_set_hadjustment (sf, GTK_VALUE_POINTER (*arg)); + nautilus_scroll_frame_set_hadjustment (sf, GTK_VALUE_POINTER (*arg)); break; case ARG_VADJUSTMENT: - gtk_scroll_frame_set_vadjustment (sf, GTK_VALUE_POINTER (*arg)); + nautilus_scroll_frame_set_vadjustment (sf, GTK_VALUE_POINTER (*arg)); break; case ARG_HSCROLLBAR_POLICY: - gtk_scroll_frame_set_policy (sf, GTK_VALUE_ENUM (*arg), priv->vsb_policy); + nautilus_scroll_frame_set_policy (sf, GTK_VALUE_ENUM (*arg), details->vsb_policy); break; case ARG_VSCROLLBAR_POLICY: - gtk_scroll_frame_set_policy (sf, priv->hsb_policy, GTK_VALUE_ENUM (*arg)); + nautilus_scroll_frame_set_policy (sf, details->hsb_policy, GTK_VALUE_ENUM (*arg)); break; case ARG_FRAME_PLACEMENT: - gtk_scroll_frame_set_placement (sf, GTK_VALUE_ENUM (*arg)); + nautilus_scroll_frame_set_placement (sf, GTK_VALUE_ENUM (*arg)); break; case ARG_SHADOW_TYPE: - gtk_scroll_frame_set_shadow_type (sf, GTK_VALUE_ENUM (*arg)); + nautilus_scroll_frame_set_shadow_type (sf, GTK_VALUE_ENUM (*arg)); break; case ARG_SCROLLBAR_SPACING: - gtk_scroll_frame_set_scrollbar_spacing (sf, GTK_VALUE_UINT (*arg)); + nautilus_scroll_frame_set_scrollbar_spacing (sf, GTK_VALUE_UINT (*arg)); break; default: @@ -291,41 +291,41 @@ gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) /* Get_arg handler for the scroll frame widget */ static void -gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +nautilus_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; switch (arg_id) { case ARG_HADJUSTMENT: - GTK_VALUE_POINTER (*arg) = gtk_scroll_frame_get_hadjustment (sf); + GTK_VALUE_POINTER (*arg) = nautilus_scroll_frame_get_hadjustment (sf); break; case ARG_VADJUSTMENT: - GTK_VALUE_POINTER (*arg) = gtk_scroll_frame_get_vadjustment (sf); + GTK_VALUE_POINTER (*arg) = nautilus_scroll_frame_get_vadjustment (sf); break; case ARG_HSCROLLBAR_POLICY: - GTK_VALUE_ENUM (*arg) = priv->hsb_policy; + GTK_VALUE_ENUM (*arg) = details->hsb_policy; break; case ARG_VSCROLLBAR_POLICY: - GTK_VALUE_ENUM (*arg) = priv->vsb_policy; + GTK_VALUE_ENUM (*arg) = details->vsb_policy; break; case ARG_FRAME_PLACEMENT: - GTK_VALUE_ENUM (*arg) = priv->frame_placement; + GTK_VALUE_ENUM (*arg) = details->frame_placement; break; case ARG_SHADOW_TYPE: - GTK_VALUE_ENUM (*arg) = priv->shadow_type; + GTK_VALUE_ENUM (*arg) = details->shadow_type; break; case ARG_SCROLLBAR_SPACING: - GTK_VALUE_UINT (*arg) = priv->sb_spacing; + GTK_VALUE_UINT (*arg) = details->sb_spacing; break; default: @@ -336,21 +336,20 @@ gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) /* Destroy handler for the scroll frame widget */ static void -gtk_scroll_frame_destroy (GtkObject *object) +nautilus_scroll_frame_destroy (GtkObject *object) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (object != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (object)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (object)); - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; - gtk_widget_unparent (priv->hsb); - gtk_widget_unparent (priv->vsb); - gtk_widget_destroy (priv->hsb); - gtk_widget_destroy (priv->vsb); + gtk_widget_unparent (details->hsb); + gtk_widget_unparent (details->vsb); + gtk_widget_destroy (details->hsb); + gtk_widget_destroy (details->vsb); if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -358,18 +357,18 @@ gtk_scroll_frame_destroy (GtkObject *object) /* Finalize handler for the scroll frame widget */ static void -gtk_scroll_frame_finalize (GtkObject *object) +nautilus_scroll_frame_finalize (GtkObject *object) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; - gtk_widget_unref (priv->hsb); - gtk_widget_unref (priv->vsb); + gtk_widget_unref (details->hsb); + gtk_widget_unref (details->vsb); - g_free (priv); + g_free (details); if (GTK_OBJECT_CLASS (parent_class)->finalize) (* GTK_OBJECT_CLASS (parent_class)->finalize) (object); @@ -377,86 +376,83 @@ gtk_scroll_frame_finalize (GtkObject *object) /* Map handler for the scroll frame widget */ static void -gtk_scroll_frame_map (GtkWidget *widget) +nautilus_scroll_frame_map (GtkWidget *widget) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; /* chain parent class handler to map self and child */ if (GTK_WIDGET_CLASS (parent_class)->map) (* GTK_WIDGET_CLASS (parent_class)->map) (widget); - if (GTK_WIDGET_VISIBLE (priv->hsb) && !GTK_WIDGET_MAPPED (priv->hsb)) - gtk_widget_map (priv->hsb); + if (GTK_WIDGET_VISIBLE (details->hsb) && !GTK_WIDGET_MAPPED (details->hsb)) + gtk_widget_map (details->hsb); - if (GTK_WIDGET_VISIBLE (priv->vsb) && !GTK_WIDGET_MAPPED (priv->vsb)) - gtk_widget_map (priv->vsb); + if (GTK_WIDGET_VISIBLE (details->vsb) && !GTK_WIDGET_MAPPED (details->vsb)) + gtk_widget_map (details->vsb); } /* Unmap handler for the scroll frame widget */ static void -gtk_scroll_frame_unmap (GtkWidget *widget) +nautilus_scroll_frame_unmap (GtkWidget *widget) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; /* chain parent class handler to unmap self and child */ if (GTK_WIDGET_CLASS (parent_class)->unmap) (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget); - if (GTK_WIDGET_MAPPED (priv->hsb)) - gtk_widget_unmap (priv->hsb); + if (GTK_WIDGET_MAPPED (details->hsb)) + gtk_widget_unmap (details->hsb); - if (GTK_WIDGET_MAPPED (priv->vsb)) - gtk_widget_unmap (priv->vsb); + if (GTK_WIDGET_MAPPED (details->vsb)) + gtk_widget_unmap (details->vsb); } /* Draws the shadow of a scroll frame widget */ static void -draw_shadow (GtkScrollFrame *sf, GdkRectangle *area) +draw_shadow (NautilusScrollFrame *sf, GdkRectangle *area) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; g_assert (area != NULL); - priv = sf->priv; + details = sf->details; gtk_paint_shadow (GTK_WIDGET (sf)->style, GTK_WIDGET (sf)->window, - GTK_STATE_NORMAL, priv->shadow_type, + GTK_STATE_NORMAL, details->shadow_type, area, GTK_WIDGET (sf), "scroll_frame", - priv->frame_x, priv->frame_y, - priv->frame_w, priv->frame_h); + details->frame_x, details->frame_y, + details->frame_w, details->frame_h); } /* Draw handler for the scroll frame widget */ static void -gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area) +nautilus_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; GdkRectangle child_area; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); g_return_if_fail (area != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; bin = GTK_BIN (widget); if (GTK_WIDGET_DRAWABLE (widget)) @@ -466,29 +462,28 @@ gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area) && gtk_widget_intersect (bin->child, area, &child_area)) gtk_widget_draw (bin->child, &child_area); - if (GTK_WIDGET_VISIBLE (priv->hsb) - && gtk_widget_intersect (priv->hsb, area, &child_area)) - gtk_widget_draw (priv->hsb, &child_area); + if (GTK_WIDGET_VISIBLE (details->hsb) + && gtk_widget_intersect (details->hsb, area, &child_area)) + gtk_widget_draw (details->hsb, &child_area); - if (GTK_WIDGET_VISIBLE (priv->vsb) - && gtk_widget_intersect (priv->vsb, area, &child_area)) - gtk_widget_draw (priv->vsb, &child_area); + if (GTK_WIDGET_VISIBLE (details->vsb) + && gtk_widget_intersect (details->vsb, area, &child_area)) + gtk_widget_draw (details->vsb, &child_area); } /* Forall handler for the scroll frame widget */ static void -gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals, +nautilus_scroll_frame_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (container != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (container)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (container)); g_return_if_fail (callback != NULL); - sf = GTK_SCROLL_FRAME (container); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (container); + details = sf->details; if (GTK_CONTAINER_CLASS (parent_class)->forall) (* GTK_CONTAINER_CLASS (parent_class)->forall) ( @@ -496,20 +491,20 @@ gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals, callback, callback_data); if (include_internals) { - if (priv->vsb) - (* callback) (priv->vsb, callback_data); + if (details->vsb) + (* callback) (details->vsb, callback_data); - if (priv->hsb) - (* callback) (priv->hsb, callback_data); + if (details->hsb) + (* callback) (details->hsb, callback_data); } } /* Size_request handler for the scroll frame widget */ static void -gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) +nautilus_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; gint extra_width; gint extra_height; @@ -517,12 +512,11 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) GtkRequisition vsb_requisition; GtkRequisition child_requisition; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); g_return_if_fail (requisition != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; bin = GTK_BIN (widget); extra_width = 0; @@ -531,13 +525,13 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) requisition->width = GTK_CONTAINER (widget)->border_width * 2; requisition->height = GTK_CONTAINER (widget)->border_width * 2; - if (priv->shadow_type != GTK_SHADOW_NONE) { + if (details->shadow_type != GTK_SHADOW_NONE) { requisition->width += 2 * widget->style->klass->xthickness; requisition->height += 2 * widget->style->klass->ythickness; } - gtk_widget_size_request (priv->hsb, &hsb_requisition); - gtk_widget_size_request (priv->vsb, &vsb_requisition); + gtk_widget_size_request (details->hsb, &hsb_requisition); + gtk_widget_size_request (details->vsb, &vsb_requisition); if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { static guint quark_aux_info; @@ -547,7 +541,7 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) gtk_widget_size_request (bin->child, &child_requisition); - if (priv->hsb_policy == GTK_POLICY_NEVER) + if (details->hsb_policy == GTK_POLICY_NEVER) requisition->width += child_requisition.width; else { GtkWidgetAuxInfo *aux_info; @@ -561,7 +555,7 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) requisition->width += vsb_requisition.width; } - if (priv->vsb_policy == GTK_POLICY_NEVER) + if (details->vsb_policy == GTK_POLICY_NEVER) requisition->height += child_requisition.height; else { GtkWidgetAuxInfo *aux_info; @@ -576,16 +570,16 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) } } - if (priv->hsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (priv->hsb)) { + if (details->hsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (details->hsb)) { requisition->width = MAX (requisition->width, hsb_requisition.width); - if (!extra_height || GTK_WIDGET_VISIBLE (priv->hsb)) - extra_height = priv->sb_spacing + hsb_requisition.height; + if (!extra_height || GTK_WIDGET_VISIBLE (details->hsb)) + extra_height = details->sb_spacing + hsb_requisition.height; } - if (priv->vsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (priv->vsb)) { + if (details->vsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (details->vsb)) { requisition->height = MAX (requisition->height, vsb_requisition.height); - if (!extra_width || GTK_WIDGET_VISIBLE (priv->vsb)) - extra_width = priv->sb_spacing + vsb_requisition.width; + if (!extra_width || GTK_WIDGET_VISIBLE (details->vsb)) + extra_width = details->sb_spacing + vsb_requisition.width; } requisition->width += MAX (0, extra_width); @@ -596,85 +590,83 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) static void compute_relative_allocation (GtkWidget *widget, GtkAllocation *allocation) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_assert (widget != NULL); - g_assert (GTK_IS_SCROLL_FRAME (widget)); + g_assert (NAUTILUS_IS_SCROLL_FRAME (widget)); g_assert (allocation != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; allocation->x = GTK_CONTAINER (widget)->border_width; allocation->y = GTK_CONTAINER (widget)->border_width; allocation->width = MAX (1, (gint) widget->allocation.width - allocation->x * 2); allocation->height = MAX (1, (gint) widget->allocation.height - allocation->y * 2); - if (priv->vsb_visible) { + if (details->vsb_visible) { GtkRequisition vsb_requisition; gint possible_new_width; - gtk_widget_get_child_requisition (priv->vsb, &vsb_requisition); + gtk_widget_get_child_requisition (details->vsb, &vsb_requisition); - if (priv->frame_placement == GTK_CORNER_TOP_RIGHT - || priv->frame_placement == GTK_CORNER_BOTTOM_RIGHT) - allocation->x += vsb_requisition.width + priv->sb_spacing; + if (details->frame_placement == GTK_CORNER_TOP_RIGHT + || details->frame_placement == GTK_CORNER_BOTTOM_RIGHT) + allocation->x += vsb_requisition.width + details->sb_spacing; possible_new_width = ((gint) allocation->width - - ((gint) vsb_requisition.width + priv->sb_spacing)); + - ((gint) vsb_requisition.width + details->sb_spacing)); allocation->width = MAX (0, possible_new_width); } - if (priv->hsb_visible) { + if (details->hsb_visible) { GtkRequisition hsb_requisition; gint possible_new_height; - gtk_widget_get_child_requisition (priv->hsb, &hsb_requisition); + gtk_widget_get_child_requisition (details->hsb, &hsb_requisition); - if (priv->frame_placement == GTK_CORNER_BOTTOM_LEFT - || priv->frame_placement == GTK_CORNER_BOTTOM_RIGHT) - allocation->y += hsb_requisition.height + priv->sb_spacing; + if (details->frame_placement == GTK_CORNER_BOTTOM_LEFT + || details->frame_placement == GTK_CORNER_BOTTOM_RIGHT) + allocation->y += hsb_requisition.height + details->sb_spacing; possible_new_height = ( ((gint)allocation->height) - - ((gint)hsb_requisition.height) + ((gint)priv->sb_spacing)); + - ((gint)hsb_requisition.height) + ((gint)details->sb_spacing)); allocation->height = MAX (0, possible_new_height); } } /* Size_allocate handler for the scroll frame widget */ static void -gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) +nautilus_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; GtkAllocation relative_allocation; GtkAllocation child_allocation; gint xthickness, ythickness; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); g_return_if_fail (allocation != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; bin = GTK_BIN (widget); widget->allocation = *allocation; - if (priv->hsb_policy == GTK_POLICY_ALWAYS) - priv->hsb_visible = TRUE; - else if (priv->hsb_policy == GTK_POLICY_NEVER) - priv->hsb_visible = FALSE; + if (details->hsb_policy == GTK_POLICY_ALWAYS) + details->hsb_visible = TRUE; + else if (details->hsb_policy == GTK_POLICY_NEVER) + details->hsb_visible = FALSE; - if (priv->vsb_policy == GTK_POLICY_ALWAYS) - priv->vsb_visible = TRUE; - else if (priv->vsb_policy == GTK_POLICY_NEVER) - priv->vsb_visible = FALSE; + if (details->vsb_policy == GTK_POLICY_ALWAYS) + details->vsb_visible = TRUE; + else if (details->vsb_policy == GTK_POLICY_NEVER) + details->vsb_visible = FALSE; - if (priv->shadow_type == GTK_SHADOW_NONE) { + if (details->shadow_type == GTK_SHADOW_NONE) { xthickness = 0; ythickness = 0; } else { @@ -692,20 +684,20 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) compute_relative_allocation (widget, &relative_allocation); - priv->frame_x = relative_allocation.x + allocation->x; - priv->frame_y = relative_allocation.y + allocation->y; - priv->frame_w = relative_allocation.width; - priv->frame_h = relative_allocation.height; + details->frame_x = relative_allocation.x + allocation->x; + details->frame_y = relative_allocation.y + allocation->y; + details->frame_w = relative_allocation.width; + details->frame_h = relative_allocation.height; - child_allocation.x = priv->frame_x + xthickness; - child_allocation.y = priv->frame_y + ythickness; - possible_new_size = priv->frame_w - 2 * xthickness; + child_allocation.x = details->frame_x + xthickness; + child_allocation.y = details->frame_y + ythickness; + possible_new_size = details->frame_w - 2 * xthickness; child_allocation.width = MAX(1, possible_new_size); - possible_new_size = priv->frame_h - 2 * ythickness; + possible_new_size = details->frame_h - 2 * ythickness; child_allocation.height = MAX(1, possible_new_size); - previous_hvis = priv->hsb_visible; - previous_vvis = priv->vsb_visible; + previous_hvis = details->hsb_visible; + previous_vvis = details->vsb_visible; gtk_widget_size_allocate (bin->child, &child_allocation); @@ -713,10 +705,10 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) * vscrollbar flip visiblity, then we need both. */ if (count - && previous_hvis != priv->hsb_visible - && previous_vvis != priv->vsb_visible) { - priv->hsb_visible = TRUE; - priv->vsb_visible = TRUE; + && previous_hvis != details->hsb_visible + && previous_vvis != details->vsb_visible) { + details->hsb_visible = TRUE; + details->vsb_visible = TRUE; /* a new resize is already queued at this point, * so we will immediatedly get reinvoked @@ -725,26 +717,26 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) } count++; - } while (previous_hvis != priv->hsb_visible - || previous_vvis != priv->vsb_visible); + } while (previous_hvis != details->hsb_visible + || previous_vvis != details->vsb_visible); } else compute_relative_allocation (widget, &relative_allocation); - if (priv->hsb_visible) { + if (details->hsb_visible) { GtkRequisition hscrollbar_requisition; - gtk_widget_get_child_requisition (priv->hsb, &hscrollbar_requisition); + gtk_widget_get_child_requisition (details->hsb, &hscrollbar_requisition); - if (!GTK_WIDGET_VISIBLE (priv->hsb)) - gtk_widget_show (priv->hsb); + if (!GTK_WIDGET_VISIBLE (details->hsb)) + gtk_widget_show (details->hsb); child_allocation.x = relative_allocation.x; - if (priv->frame_placement == GTK_CORNER_TOP_LEFT - || priv->frame_placement == GTK_CORNER_TOP_RIGHT) + if (details->frame_placement == GTK_CORNER_TOP_LEFT + || details->frame_placement == GTK_CORNER_TOP_RIGHT) child_allocation.y = (relative_allocation.y #if 0 + relative_allocation.height - + priv->sb_spacing); + + details->sb_spacing); #else + relative_allocation.height); #endif @@ -756,23 +748,23 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) child_allocation.x += allocation->x; child_allocation.y += allocation->y; - gtk_widget_size_allocate (priv->hsb, &child_allocation); - } else if (GTK_WIDGET_VISIBLE (priv->hsb)) - gtk_widget_hide (priv->hsb); + gtk_widget_size_allocate (details->hsb, &child_allocation); + } else if (GTK_WIDGET_VISIBLE (details->hsb)) + gtk_widget_hide (details->hsb); - if (priv->vsb_visible) { + if (details->vsb_visible) { GtkRequisition vscrollbar_requisition; - if (!GTK_WIDGET_VISIBLE (priv->vsb)) - gtk_widget_show (priv->vsb); + if (!GTK_WIDGET_VISIBLE (details->vsb)) + gtk_widget_show (details->vsb); - gtk_widget_get_child_requisition (priv->vsb, &vscrollbar_requisition); + gtk_widget_get_child_requisition (details->vsb, &vscrollbar_requisition); - if (priv->frame_placement == GTK_CORNER_TOP_LEFT - || priv->frame_placement == GTK_CORNER_BOTTOM_LEFT) + if (details->frame_placement == GTK_CORNER_TOP_LEFT + || details->frame_placement == GTK_CORNER_BOTTOM_LEFT) child_allocation.x = (relative_allocation.x + relative_allocation.width - + priv->sb_spacing); + + details->sb_spacing); else child_allocation.x = GTK_CONTAINER (sf)->border_width; @@ -782,22 +774,21 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) child_allocation.x += allocation->x; child_allocation.y += allocation->y; - gtk_widget_size_allocate (priv->vsb, &child_allocation); - } else if (GTK_WIDGET_VISIBLE (priv->vsb)) - gtk_widget_hide (priv->vsb); + gtk_widget_size_allocate (details->vsb, &child_allocation); + } else if (GTK_WIDGET_VISIBLE (details->vsb)) + gtk_widget_hide (details->vsb); } /* Expose handler for the scroll frame widget */ static gint -gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) +nautilus_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) { - GtkScrollFrame *sf; + NautilusScrollFrame *sf; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_SCROLL_FRAME (widget), FALSE); + g_return_val_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); - sf = GTK_SCROLL_FRAME (widget); + sf = NAUTILUS_SCROLL_FRAME (widget); if (GTK_WIDGET_DRAWABLE (widget)) draw_shadow (sf, &event->area); @@ -810,14 +801,14 @@ gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) /* Add handler for the scroll frame widget */ static void -gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child) +nautilus_scroll_frame_add (GtkContainer *container, GtkWidget *child) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; - sf = GTK_SCROLL_FRAME (container); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (container); + details = sf->details; bin = GTK_BIN (container); g_return_if_fail (bin->child == NULL); @@ -826,10 +817,10 @@ gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child) /* this is a temporary message */ if (!gtk_widget_set_scroll_adjustments (child, - gtk_range_get_adjustment (GTK_RANGE (priv->hsb)), - gtk_range_get_adjustment (GTK_RANGE (priv->vsb)))) - g_warning ("gtk_scroll_frame_add(): cannot add non scrollable widget " - "use gtk_scroll_frame_add_with_viewport() instead"); + gtk_range_get_adjustment (GTK_RANGE (details->hsb)), + gtk_range_get_adjustment (GTK_RANGE (details->vsb)))) + g_warning ("nautilus_scroll_frame_add(): cannot add non scrollable widget " + "use nautilus_scroll_frame_add_with_viewport() instead"); if (GTK_WIDGET_REALIZED (child->parent)) gtk_widget_realize (child); @@ -844,10 +835,9 @@ gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child) /* Remove method for the scroll frame widget */ static void -gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child) +nautilus_scroll_frame_remove (GtkContainer *container, GtkWidget *child) { - g_return_if_fail (container != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (container)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (container)); g_return_if_fail (child != NULL); g_return_if_fail (GTK_BIN (container)->child == child); @@ -859,7 +849,7 @@ gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child) } /** - * gtk_scroll_frame_new: + * nautilus_scroll_frame_new: * @hadj: If non-NULL, the adjustment to use for horizontal scrolling. * @vadj: If non-NULL, the adjustment to use for vertical scrolling. * @@ -868,7 +858,7 @@ gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child) * Return value: The newly-created scroll frame widget. **/ GtkWidget * -gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) +nautilus_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) { if (hadj) g_return_val_if_fail (GTK_IS_ADJUSTMENT (hadj), NULL); @@ -876,7 +866,7 @@ gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) if (vadj) g_return_val_if_fail (GTK_IS_ADJUSTMENT (vadj), NULL); - return gtk_widget_new (GTK_TYPE_SCROLL_FRAME, + return gtk_widget_new (NAUTILUS_TYPE_SCROLL_FRAME, "hadjustment", hadj, "vadjustment", vadj, NULL); @@ -886,39 +876,38 @@ gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) static void adjustment_changed (GtkAdjustment *adj, gpointer data) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (adj != NULL); g_return_if_fail (GTK_IS_ADJUSTMENT (adj)); g_return_if_fail (data != NULL); - sf = GTK_SCROLL_FRAME (data); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (data); + details = sf->details; - if (adj == gtk_range_get_adjustment (GTK_RANGE (priv->hsb))) { - if (priv->hsb_policy == GTK_POLICY_AUTOMATIC) { + if (adj == gtk_range_get_adjustment (GTK_RANGE (details->hsb))) { + if (details->hsb_policy == GTK_POLICY_AUTOMATIC) { gboolean visible; - visible = priv->hsb_visible; - priv->hsb_visible = (adj->upper - adj->lower > adj->page_size); - if (priv->hsb_visible != visible) + visible = details->hsb_visible; + details->hsb_visible = (adj->upper - adj->lower > adj->page_size); + if (details->hsb_visible != visible) gtk_widget_queue_resize (GTK_WIDGET (sf)); } - } else if (adj == gtk_range_get_adjustment (GTK_RANGE (priv->vsb))) { - if (priv->vsb_policy == GTK_POLICY_AUTOMATIC) { + } else if (adj == gtk_range_get_adjustment (GTK_RANGE (details->vsb))) { + if (details->vsb_policy == GTK_POLICY_AUTOMATIC) { gboolean visible; - visible = priv->vsb_visible; - priv->vsb_visible = (adj->upper - adj->lower > adj->page_size); - if (priv->vsb_visible != visible) + visible = details->vsb_visible; + details->vsb_visible = (adj->upper - adj->lower > adj->page_size); + if (details->vsb_visible != visible) gtk_widget_queue_resize (GTK_WIDGET (sf)); } } } /** - * gtk_scroll_frame_set_hadjustment: + * nautilus_scroll_frame_set_hadjustment: * @sf: A scroll frame widget. * @adj: An adjustment. * @@ -926,43 +915,42 @@ adjustment_changed (GtkAdjustment *adj, gpointer data) * widget. **/ void -gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) +nautilus_scroll_frame_set_hadjustment (NautilusScrollFrame *sf, GtkAdjustment *adj) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; if (adj) g_return_if_fail (GTK_IS_ADJUSTMENT (adj)); else adj = GTK_ADJUSTMENT (gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL)); - if (!priv->hsb) { + if (!details->hsb) { gtk_widget_push_composite_child (); - priv->hsb = gtk_hscrollbar_new (adj); - gtk_widget_set_composite_name (priv->hsb, "hscrollbar"); + details->hsb = gtk_hscrollbar_new (adj); + gtk_widget_set_composite_name (details->hsb, "hscrollbar"); gtk_widget_pop_composite_child (); - gtk_widget_set_parent (priv->hsb, GTK_WIDGET (sf)); - gtk_widget_ref (priv->hsb); - gtk_widget_show (priv->hsb); + gtk_widget_set_parent (details->hsb, GTK_WIDGET (sf)); + gtk_widget_ref (details->hsb); + gtk_widget_show (details->hsb); } else { GtkAdjustment *old_adj; - old_adj = gtk_range_get_adjustment (GTK_RANGE (priv->hsb)); + old_adj = gtk_range_get_adjustment (GTK_RANGE (details->hsb)); if (old_adj == adj) return; gtk_signal_disconnect_by_func (GTK_OBJECT (old_adj), GTK_SIGNAL_FUNC (adjustment_changed), sf); - gtk_range_set_adjustment (GTK_RANGE (priv->hsb), adj); + gtk_range_set_adjustment (GTK_RANGE (details->hsb), adj); } - adj = gtk_range_get_adjustment (GTK_RANGE (priv->hsb)); + adj = gtk_range_get_adjustment (GTK_RANGE (details->hsb)); gtk_signal_connect (GTK_OBJECT (adj), "changed", GTK_SIGNAL_FUNC (adjustment_changed), @@ -972,12 +960,12 @@ gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) if (GTK_BIN (sf)->child) gtk_widget_set_scroll_adjustments ( GTK_BIN (sf)->child, - gtk_range_get_adjustment (GTK_RANGE (priv->hsb)), - gtk_range_get_adjustment (GTK_RANGE (priv->vsb))); + gtk_range_get_adjustment (GTK_RANGE (details->hsb)), + gtk_range_get_adjustment (GTK_RANGE (details->vsb))); } /** - * gtk_scroll_frame_set_vadjustment: + * nautilus_scroll_frame_set_vadjustment: * @sf: A scroll frame widget. * @adj: An adjustment. * @@ -985,43 +973,42 @@ gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) * widget. **/ void -gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) +nautilus_scroll_frame_set_vadjustment (NautilusScrollFrame *sf, GtkAdjustment *adj) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; if (adj) g_return_if_fail (GTK_IS_ADJUSTMENT (adj)); else adj = GTK_ADJUSTMENT (gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL)); - if (!priv->vsb) { + if (!details->vsb) { gtk_widget_push_composite_child (); - priv->vsb = gtk_vscrollbar_new (adj); - gtk_widget_set_composite_name (priv->vsb, "vscrollbar"); + details->vsb = gtk_vscrollbar_new (adj); + gtk_widget_set_composite_name (details->vsb, "vscrollbar"); gtk_widget_pop_composite_child (); - gtk_widget_set_parent (priv->vsb, GTK_WIDGET (sf)); - gtk_widget_ref (priv->vsb); - gtk_widget_show (priv->vsb); + gtk_widget_set_parent (details->vsb, GTK_WIDGET (sf)); + gtk_widget_ref (details->vsb); + gtk_widget_show (details->vsb); } else { GtkAdjustment *old_adj; - old_adj = gtk_range_get_adjustment (GTK_RANGE (priv->vsb)); + old_adj = gtk_range_get_adjustment (GTK_RANGE (details->vsb)); if (old_adj == adj) return; gtk_signal_disconnect_by_func (GTK_OBJECT (old_adj), GTK_SIGNAL_FUNC (adjustment_changed), sf); - gtk_range_set_adjustment (GTK_RANGE (priv->vsb), adj); + gtk_range_set_adjustment (GTK_RANGE (details->vsb), adj); } - adj = gtk_range_get_adjustment (GTK_RANGE (priv->vsb)); + adj = gtk_range_get_adjustment (GTK_RANGE (details->vsb)); gtk_signal_connect (GTK_OBJECT (adj), "changed", GTK_SIGNAL_FUNC (adjustment_changed), @@ -1031,12 +1018,12 @@ gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) if (GTK_BIN (sf)->child) gtk_widget_set_scroll_adjustments ( GTK_BIN (sf)->child, - gtk_range_get_adjustment (GTK_RANGE (priv->hsb)), - gtk_range_get_adjustment (GTK_RANGE (priv->vsb))); + gtk_range_get_adjustment (GTK_RANGE (details->hsb)), + gtk_range_get_adjustment (GTK_RANGE (details->vsb))); } /** - * gtk_scroll_frame_get_hadjustment: + * nautilus_scroll_frame_get_hadjustment: * @sf: A scroll frame widget. * * Queries the horizontal adjustment of a scroll frame widget. @@ -1044,20 +1031,19 @@ gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) * Return value: The horizontal adjustment of the scroll frame, or NULL if none. **/ GtkAdjustment * -gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf) +nautilus_scroll_frame_get_hadjustment (NautilusScrollFrame *sf) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_val_if_fail (sf != NULL, NULL); - g_return_val_if_fail (GTK_IS_SCROLL_FRAME (sf), NULL); + g_return_val_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf), NULL); - priv = sf->priv; + details = sf->details; - return priv->hsb ? gtk_range_get_adjustment (GTK_RANGE (priv->hsb)) : NULL; + return details->hsb ? gtk_range_get_adjustment (GTK_RANGE (details->hsb)) : NULL; } /** - * gtk_scroll_frame_get_vadjustment: + * nautilus_scroll_frame_get_vadjustment: * @sf: A scroll frame widget. * * Queries the vertical adjustment of a scroll frame widget. @@ -1065,20 +1051,19 @@ gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf) * Return value: The vertical adjustment of the scroll frame, or NULL if none. **/ GtkAdjustment * -gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf) +nautilus_scroll_frame_get_vadjustment (NautilusScrollFrame *sf) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_val_if_fail (sf != NULL, NULL); - g_return_val_if_fail (GTK_IS_SCROLL_FRAME (sf), NULL); + g_return_val_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf), NULL); - priv = sf->priv; + details = sf->details; - return priv->vsb ? gtk_range_get_adjustment (GTK_RANGE (priv->vsb)) : NULL; + return details->vsb ? gtk_range_get_adjustment (GTK_RANGE (details->vsb)) : NULL; } /** - * gtk_scroll_frame_set_policy: + * nautilus_scroll_frame_set_policy: * @sf: A scroll frame widget. * @hsb_policy: Policy for the horizontal scrollbar. * @vsb_policy: Policy for the vertical scrollbar. @@ -1087,28 +1072,27 @@ gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf) * the scrollbars are to be shown or hidden. **/ void -gtk_scroll_frame_set_policy (GtkScrollFrame *sf, +nautilus_scroll_frame_set_policy (NautilusScrollFrame *sf, GtkPolicyType hsb_policy, GtkPolicyType vsb_policy) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; - if (priv->hsb_policy == hsb_policy && priv->vsb_policy == vsb_policy) + if (details->hsb_policy == hsb_policy && details->vsb_policy == vsb_policy) return; - priv->hsb_policy = hsb_policy; - priv->vsb_policy = vsb_policy; + details->hsb_policy = hsb_policy; + details->vsb_policy = vsb_policy; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_set_placement: + * nautilus_scroll_frame_set_placement: * @sf: A scroll frame widget. * @frame_placement: Placement for the frame. * @@ -1116,24 +1100,23 @@ gtk_scroll_frame_set_policy (GtkScrollFrame *sf, * scrollbars. **/ void -gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placement) +nautilus_scroll_frame_set_placement (NautilusScrollFrame *sf, GtkCornerType frame_placement) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; - if (priv->frame_placement == frame_placement) + if (details->frame_placement == frame_placement) return; - priv->frame_placement = frame_placement; + details->frame_placement = frame_placement; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_set_shadow_type: + * nautilus_scroll_frame_set_shadow_type: * @sf: A scroll frame widget. * @shadow_type: A shadow type. * @@ -1141,25 +1124,24 @@ gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placemen * insert a child that does not paint a frame on its own. **/ void -gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type) +nautilus_scroll_frame_set_shadow_type (NautilusScrollFrame *sf, GtkShadowType shadow_type) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); g_return_if_fail (shadow_type <= GTK_SHADOW_ETCHED_OUT); - priv = sf->priv; + details = sf->details; - if (priv->shadow_type == shadow_type) + if (details->shadow_type == shadow_type) return; - priv->shadow_type = shadow_type; + details->shadow_type = shadow_type; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_set_scrollbar_spacing: + * nautilus_scroll_frame_set_scrollbar_spacing: * @sf: A scroll frame widget. * @spacing: Desired spacing in pixels. * @@ -1167,24 +1149,23 @@ gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type) * widget. **/ void -gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing) +nautilus_scroll_frame_set_scrollbar_spacing (NautilusScrollFrame *sf, guint spacing) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; - if (priv->sb_spacing == spacing) + if (details->sb_spacing == spacing) return; - priv->sb_spacing = spacing; + details->sb_spacing = spacing; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_add_with_viewport: + * nautilus_scroll_frame_add_with_viewport: * @sf: A scroll frame widget. * @child: A widget. * @@ -1193,19 +1174,17 @@ gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing) * used only when a child does not support the scrolling interface. **/ void -gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child) +nautilus_scroll_frame_add_with_viewport (NautilusScrollFrame *sf, GtkWidget *child) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; GtkBin *bin; GtkWidget *viewport; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); - g_return_if_fail (child != NULL); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); g_return_if_fail (GTK_IS_WIDGET (child)); g_return_if_fail (child->parent == NULL); - priv = sf->priv; + details = sf->details; bin = GTK_BIN (sf); if (bin->child != NULL) { @@ -1214,8 +1193,8 @@ gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child) viewport = bin->child; } else { - viewport = gtk_viewport_new (gtk_scroll_frame_get_hadjustment (sf), - gtk_scroll_frame_get_vadjustment (sf)); + viewport = gtk_viewport_new (nautilus_scroll_frame_get_hadjustment (sf), + nautilus_scroll_frame_get_vadjustment (sf)); gtk_container_add (GTK_CONTAINER (sf), viewport); } diff --git a/libnautilus-extensions/nautilus-scroll-frame.h b/libnautilus-extensions/nautilus-scroll-frame.h index 749417a8b..2807b24fd 100644 --- a/libnautilus-extensions/nautilus-scroll-frame.h +++ b/libnautilus-extensions/nautilus-scroll-frame.h @@ -25,70 +25,62 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#ifndef __GTK_SCROLL_FRAME_H__ -#define __GTK_SCROLL_FRAME_H__ +#ifndef GTK_SCROLL_FRAME_H +#define GTK_SCROLL_FRAME_H - -#include <gdk/gdk.h> #include <gtk/gtkbin.h> - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ - -#define GTK_TYPE_SCROLL_FRAME (gtk_scroll_frame_get_type ()) -#define GTK_SCROLL_FRAME(obj) (GTK_CHECK_CAST ((obj), \ - GTK_TYPE_SCROLL_FRAME, GtkScrollFrame)) -#define GTK_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \ - GTK_TYPE_SCROLL_FRAME, GtkScrollFrameClass)) -#define GTK_IS_SCROLL_FRAME(obj) (GTK_CHECK_TYPE ((obj), \ - GTK_TYPE_SCROLL_FRAME)) -#define GTK_IS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \ - GTK_TYPE_SCROLL_FRAME)) - - -typedef struct _GtkScrollFrame GtkScrollFrame; -typedef struct _GtkScrollFrameClass GtkScrollFrameClass; - -struct _GtkScrollFrame +#define NAUTILUS_TYPE_SCROLL_FRAME (nautilus_scroll_frame_get_type ()) +#define NAUTILUS_SCROLL_FRAME(obj) (GTK_CHECK_CAST ((obj), \ + NAUTILUS_TYPE_SCROLL_FRAME, NautilusScrollFrame)) +#define NAUTILUS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \ + NAUTILUS_TYPE_SCROLL_FRAME, NautilusScrollFrameClass)) +#define NAUTILUS_IS_SCROLL_FRAME(obj) (GTK_CHECK_TYPE ((obj), \ + NAUTILUS_TYPE_SCROLL_FRAME)) +#define NAUTILUS_IS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \ + NAUTILUS_TYPE_SCROLL_FRAME)) + +typedef struct NautilusScrollFrame NautilusScrollFrame; +typedef struct NautilusScrollFrameClass NautilusScrollFrameClass; +typedef struct NautilusScrollFrameDetails NautilusScrollFrameDetails; + +struct NautilusScrollFrame { GtkBin bin; - - /* Private data */ - gpointer priv; + NautilusScrollFrameDetails *details; }; - -struct _GtkScrollFrameClass +struct NautilusScrollFrameClass { GtkBinClass parent_class; }; - -GtkType gtk_scroll_frame_get_type (void); -GtkWidget *gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj); - -void gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj); -void gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj); - -GtkAdjustment *gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf); -GtkAdjustment *gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf); - -void gtk_scroll_frame_set_policy (GtkScrollFrame *sf, - GtkPolicyType hsb_policy, - GtkPolicyType vsb_policy); - -void gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placement); -void gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type); -void gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing); - -void gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child); - +GtkType nautilus_scroll_frame_get_type (void); +GtkWidget * nautilus_scroll_frame_new (GtkAdjustment *h_adjustment, + GtkAdjustment *v_adjustment); +void nautilus_scroll_frame_set_hadjustment (NautilusScrollFrame *frame, + GtkAdjustment *adj); +void nautilus_scroll_frame_set_vadjustment (NautilusScrollFrame *frame, + GtkAdjustment *adj); +GtkAdjustment *nautilus_scroll_frame_get_hadjustment (NautilusScrollFrame *frame); +GtkAdjustment *nautilus_scroll_frame_get_vadjustment (NautilusScrollFrame *frame); +void nautilus_scroll_frame_set_policy (NautilusScrollFrame *frame, + GtkPolicyType h_scroll_policy, + GtkPolicyType v_scroll_policy); +void nautilus_scroll_frame_set_placement (NautilusScrollFrame *frame, + GtkCornerType frame_placement); +void nautilus_scroll_frame_set_shadow_type (NautilusScrollFrame *frame, + GtkShadowType shadow_type); +void nautilus_scroll_frame_set_scrollbar_spacing (NautilusScrollFrame *frame, + guint spacing); +void nautilus_scroll_frame_add_with_viewport (NautilusScrollFrame *frame, + GtkWidget *child); #ifdef __cplusplus } #endif /* __cplusplus */ - -#endif /* __GTK_SCROLL_FRAME_H__ */ +#endif /* GTK_SCROLL_FRAME_H */ diff --git a/libnautilus-private/gtkscrollframe.c b/libnautilus-private/gtkscrollframe.c index 938c388c2..d8fed9059 100644 --- a/libnautilus-private/gtkscrollframe.c +++ b/libnautilus-private/gtkscrollframe.c @@ -80,8 +80,8 @@ enum { ARG_SCROLLBAR_SPACING }; -/* Private part of the GtkScrollFrame structure */ -typedef struct { +/* Private part of the NautilusScrollFrame structure */ +struct NautilusScrollFrameDetails { /* Horizontal and vertical scrollbars */ GtkWidget *hsb; GtkWidget *vsb; @@ -108,52 +108,52 @@ typedef struct { /* Shadow type for frame */ guint shadow_type : 3; -} ScrollFramePrivate; - - -static void gtk_scroll_frame_class_init (GtkScrollFrameClass *class); -static void gtk_scroll_frame_init (GtkScrollFrame *sf); -static void gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void gtk_scroll_frame_destroy (GtkObject *object); -static void gtk_scroll_frame_finalize (GtkObject *object); - -static void gtk_scroll_frame_map (GtkWidget *widget); -static void gtk_scroll_frame_unmap (GtkWidget *widget); -static void gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area); -static void gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition); -static void gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static gint gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event); - -static void gtk_scroll_frame_add (GtkContainer *container, GtkWidget *widget); -static void gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *widget); -static void gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals, +}; + + +static void nautilus_scroll_frame_class_init (NautilusScrollFrameClass *class); +static void nautilus_scroll_frame_init (NautilusScrollFrame *sf); +static void nautilus_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void nautilus_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void nautilus_scroll_frame_destroy (GtkObject *object); +static void nautilus_scroll_frame_finalize (GtkObject *object); + +static void nautilus_scroll_frame_map (GtkWidget *widget); +static void nautilus_scroll_frame_unmap (GtkWidget *widget); +static void nautilus_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area); +static void nautilus_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition); +static void nautilus_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static gint nautilus_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event); + +static void nautilus_scroll_frame_add (GtkContainer *container, GtkWidget *widget); +static void nautilus_scroll_frame_remove (GtkContainer *container, GtkWidget *widget); +static void nautilus_scroll_frame_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); static GtkBinClass *parent_class; /** - * gtk_scroll_frame_get_type: + * nautilus_scroll_frame_get_type: * @void: * - * Registers the &GtkScrollFrame class if necessary, and returns the type ID + * Registers the &NautilusScrollFrame class if necessary, and returns the type ID * associated to it. * - * Return value: The type ID of the &GtkScrollFrame class. + * Return value: The type ID of the &NautilusScrollFrame class. **/ GtkType -gtk_scroll_frame_get_type (void) +nautilus_scroll_frame_get_type (void) { static GtkType scroll_frame_type = 0; if (!scroll_frame_type) { static const GtkTypeInfo scroll_frame_info = { - "GtkScrollFrame", - sizeof (GtkScrollFrame), - sizeof (GtkScrollFrameClass), - (GtkClassInitFunc) gtk_scroll_frame_class_init, - (GtkObjectInitFunc) gtk_scroll_frame_init, + "NautilusScrollFrame", + sizeof (NautilusScrollFrame), + sizeof (NautilusScrollFrameClass), + (GtkClassInitFunc) nautilus_scroll_frame_class_init, + (GtkObjectInitFunc) nautilus_scroll_frame_init, NULL, /* reserved_1 */ NULL, /* reserved_2 */ (GtkClassInitFunc) NULL @@ -167,7 +167,7 @@ gtk_scroll_frame_get_type (void) /* Class initialization function for the scroll frame widget */ static void -gtk_scroll_frame_class_init (GtkScrollFrameClass *class) +nautilus_scroll_frame_class_init (NautilusScrollFrameClass *class) { GtkObjectClass *object_class; GtkWidgetClass *widget_class; @@ -179,109 +179,109 @@ gtk_scroll_frame_class_init (GtkScrollFrameClass *class) parent_class = gtk_type_class (GTK_TYPE_BIN); - gtk_object_add_arg_type ("GtkScrollFrame::hadjustment", + gtk_object_add_arg_type ("NautilusScrollFrame::hadjustment", GTK_TYPE_ADJUSTMENT, GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT, ARG_HADJUSTMENT); - gtk_object_add_arg_type ("GtkScrollFrame::vadjustment", + gtk_object_add_arg_type ("NautilusScrollFrame::vadjustment", GTK_TYPE_ADJUSTMENT, GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT, ARG_VADJUSTMENT); - gtk_object_add_arg_type ("GtkScrollFrame::hscrollbar_policy", + gtk_object_add_arg_type ("NautilusScrollFrame::hscrollbar_policy", GTK_TYPE_POLICY_TYPE, GTK_ARG_READWRITE, ARG_HSCROLLBAR_POLICY); - gtk_object_add_arg_type ("GtkScrollFrame::vscrollbar_policy", + gtk_object_add_arg_type ("NautilusScrollFrame::vscrollbar_policy", GTK_TYPE_POLICY_TYPE, GTK_ARG_READWRITE, ARG_VSCROLLBAR_POLICY); - gtk_object_add_arg_type ("GtkScrollFrame::frame_placement", + gtk_object_add_arg_type ("NautilusScrollFrame::frame_placement", GTK_TYPE_CORNER_TYPE, GTK_ARG_READWRITE, ARG_FRAME_PLACEMENT); - gtk_object_add_arg_type ("GtkScrollFrame::shadow_type", + gtk_object_add_arg_type ("NautilusScrollFrame::shadow_type", GTK_TYPE_SHADOW_TYPE, GTK_ARG_READWRITE, ARG_SHADOW_TYPE); - gtk_object_add_arg_type ("GtkScrollFrame::scrollbar_spacing", + gtk_object_add_arg_type ("NautilusScrollFrame::scrollbar_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_SCROLLBAR_SPACING); - object_class->set_arg = gtk_scroll_frame_set_arg; - object_class->get_arg = gtk_scroll_frame_get_arg; - object_class->destroy = gtk_scroll_frame_destroy; - object_class->finalize = gtk_scroll_frame_finalize; - - widget_class->map = gtk_scroll_frame_map; - widget_class->unmap = gtk_scroll_frame_unmap; - widget_class->draw = gtk_scroll_frame_draw; - widget_class->size_request = gtk_scroll_frame_size_request; - widget_class->size_allocate = gtk_scroll_frame_size_allocate; - widget_class->expose_event = gtk_scroll_frame_expose; - - container_class->add = gtk_scroll_frame_add; - container_class->remove = gtk_scroll_frame_remove; - container_class->forall = gtk_scroll_frame_forall; + object_class->set_arg = nautilus_scroll_frame_set_arg; + object_class->get_arg = nautilus_scroll_frame_get_arg; + object_class->destroy = nautilus_scroll_frame_destroy; + object_class->finalize = nautilus_scroll_frame_finalize; + + widget_class->map = nautilus_scroll_frame_map; + widget_class->unmap = nautilus_scroll_frame_unmap; + widget_class->draw = nautilus_scroll_frame_draw; + widget_class->size_request = nautilus_scroll_frame_size_request; + widget_class->size_allocate = nautilus_scroll_frame_size_allocate; + widget_class->expose_event = nautilus_scroll_frame_expose; + + container_class->add = nautilus_scroll_frame_add; + container_class->remove = nautilus_scroll_frame_remove; + container_class->forall = nautilus_scroll_frame_forall; } /* Object initialization function for the scroll frame widget */ static void -gtk_scroll_frame_init (GtkScrollFrame *sf) +nautilus_scroll_frame_init (NautilusScrollFrame *sf) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - priv = g_new0 (ScrollFramePrivate, 1); - sf->priv = priv; + details = g_new0 (NautilusScrollFrameDetails, 1); + sf->details = details; GTK_WIDGET_SET_FLAGS (sf, GTK_NO_WINDOW); gtk_container_set_resize_mode (GTK_CONTAINER (sf), GTK_RESIZE_QUEUE); - priv->sb_spacing = 3; - priv->hsb_policy = GTK_POLICY_ALWAYS; - priv->vsb_policy = GTK_POLICY_ALWAYS; - priv->frame_placement = GTK_CORNER_TOP_LEFT; - priv->shadow_type = GTK_SHADOW_NONE; + details->sb_spacing = 3; + details->hsb_policy = GTK_POLICY_ALWAYS; + details->vsb_policy = GTK_POLICY_ALWAYS; + details->frame_placement = GTK_CORNER_TOP_LEFT; + details->shadow_type = GTK_SHADOW_NONE; } /* Set_arg handler for the scroll frame widget */ static void -gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) +nautilus_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; switch (arg_id) { case ARG_HADJUSTMENT: - gtk_scroll_frame_set_hadjustment (sf, GTK_VALUE_POINTER (*arg)); + nautilus_scroll_frame_set_hadjustment (sf, GTK_VALUE_POINTER (*arg)); break; case ARG_VADJUSTMENT: - gtk_scroll_frame_set_vadjustment (sf, GTK_VALUE_POINTER (*arg)); + nautilus_scroll_frame_set_vadjustment (sf, GTK_VALUE_POINTER (*arg)); break; case ARG_HSCROLLBAR_POLICY: - gtk_scroll_frame_set_policy (sf, GTK_VALUE_ENUM (*arg), priv->vsb_policy); + nautilus_scroll_frame_set_policy (sf, GTK_VALUE_ENUM (*arg), details->vsb_policy); break; case ARG_VSCROLLBAR_POLICY: - gtk_scroll_frame_set_policy (sf, priv->hsb_policy, GTK_VALUE_ENUM (*arg)); + nautilus_scroll_frame_set_policy (sf, details->hsb_policy, GTK_VALUE_ENUM (*arg)); break; case ARG_FRAME_PLACEMENT: - gtk_scroll_frame_set_placement (sf, GTK_VALUE_ENUM (*arg)); + nautilus_scroll_frame_set_placement (sf, GTK_VALUE_ENUM (*arg)); break; case ARG_SHADOW_TYPE: - gtk_scroll_frame_set_shadow_type (sf, GTK_VALUE_ENUM (*arg)); + nautilus_scroll_frame_set_shadow_type (sf, GTK_VALUE_ENUM (*arg)); break; case ARG_SCROLLBAR_SPACING: - gtk_scroll_frame_set_scrollbar_spacing (sf, GTK_VALUE_UINT (*arg)); + nautilus_scroll_frame_set_scrollbar_spacing (sf, GTK_VALUE_UINT (*arg)); break; default: @@ -291,41 +291,41 @@ gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) /* Get_arg handler for the scroll frame widget */ static void -gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +nautilus_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; switch (arg_id) { case ARG_HADJUSTMENT: - GTK_VALUE_POINTER (*arg) = gtk_scroll_frame_get_hadjustment (sf); + GTK_VALUE_POINTER (*arg) = nautilus_scroll_frame_get_hadjustment (sf); break; case ARG_VADJUSTMENT: - GTK_VALUE_POINTER (*arg) = gtk_scroll_frame_get_vadjustment (sf); + GTK_VALUE_POINTER (*arg) = nautilus_scroll_frame_get_vadjustment (sf); break; case ARG_HSCROLLBAR_POLICY: - GTK_VALUE_ENUM (*arg) = priv->hsb_policy; + GTK_VALUE_ENUM (*arg) = details->hsb_policy; break; case ARG_VSCROLLBAR_POLICY: - GTK_VALUE_ENUM (*arg) = priv->vsb_policy; + GTK_VALUE_ENUM (*arg) = details->vsb_policy; break; case ARG_FRAME_PLACEMENT: - GTK_VALUE_ENUM (*arg) = priv->frame_placement; + GTK_VALUE_ENUM (*arg) = details->frame_placement; break; case ARG_SHADOW_TYPE: - GTK_VALUE_ENUM (*arg) = priv->shadow_type; + GTK_VALUE_ENUM (*arg) = details->shadow_type; break; case ARG_SCROLLBAR_SPACING: - GTK_VALUE_UINT (*arg) = priv->sb_spacing; + GTK_VALUE_UINT (*arg) = details->sb_spacing; break; default: @@ -336,21 +336,20 @@ gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) /* Destroy handler for the scroll frame widget */ static void -gtk_scroll_frame_destroy (GtkObject *object) +nautilus_scroll_frame_destroy (GtkObject *object) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (object != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (object)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (object)); - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; - gtk_widget_unparent (priv->hsb); - gtk_widget_unparent (priv->vsb); - gtk_widget_destroy (priv->hsb); - gtk_widget_destroy (priv->vsb); + gtk_widget_unparent (details->hsb); + gtk_widget_unparent (details->vsb); + gtk_widget_destroy (details->hsb); + gtk_widget_destroy (details->vsb); if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -358,18 +357,18 @@ gtk_scroll_frame_destroy (GtkObject *object) /* Finalize handler for the scroll frame widget */ static void -gtk_scroll_frame_finalize (GtkObject *object) +nautilus_scroll_frame_finalize (GtkObject *object) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; - gtk_widget_unref (priv->hsb); - gtk_widget_unref (priv->vsb); + gtk_widget_unref (details->hsb); + gtk_widget_unref (details->vsb); - g_free (priv); + g_free (details); if (GTK_OBJECT_CLASS (parent_class)->finalize) (* GTK_OBJECT_CLASS (parent_class)->finalize) (object); @@ -377,86 +376,83 @@ gtk_scroll_frame_finalize (GtkObject *object) /* Map handler for the scroll frame widget */ static void -gtk_scroll_frame_map (GtkWidget *widget) +nautilus_scroll_frame_map (GtkWidget *widget) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; /* chain parent class handler to map self and child */ if (GTK_WIDGET_CLASS (parent_class)->map) (* GTK_WIDGET_CLASS (parent_class)->map) (widget); - if (GTK_WIDGET_VISIBLE (priv->hsb) && !GTK_WIDGET_MAPPED (priv->hsb)) - gtk_widget_map (priv->hsb); + if (GTK_WIDGET_VISIBLE (details->hsb) && !GTK_WIDGET_MAPPED (details->hsb)) + gtk_widget_map (details->hsb); - if (GTK_WIDGET_VISIBLE (priv->vsb) && !GTK_WIDGET_MAPPED (priv->vsb)) - gtk_widget_map (priv->vsb); + if (GTK_WIDGET_VISIBLE (details->vsb) && !GTK_WIDGET_MAPPED (details->vsb)) + gtk_widget_map (details->vsb); } /* Unmap handler for the scroll frame widget */ static void -gtk_scroll_frame_unmap (GtkWidget *widget) +nautilus_scroll_frame_unmap (GtkWidget *widget) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; /* chain parent class handler to unmap self and child */ if (GTK_WIDGET_CLASS (parent_class)->unmap) (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget); - if (GTK_WIDGET_MAPPED (priv->hsb)) - gtk_widget_unmap (priv->hsb); + if (GTK_WIDGET_MAPPED (details->hsb)) + gtk_widget_unmap (details->hsb); - if (GTK_WIDGET_MAPPED (priv->vsb)) - gtk_widget_unmap (priv->vsb); + if (GTK_WIDGET_MAPPED (details->vsb)) + gtk_widget_unmap (details->vsb); } /* Draws the shadow of a scroll frame widget */ static void -draw_shadow (GtkScrollFrame *sf, GdkRectangle *area) +draw_shadow (NautilusScrollFrame *sf, GdkRectangle *area) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; g_assert (area != NULL); - priv = sf->priv; + details = sf->details; gtk_paint_shadow (GTK_WIDGET (sf)->style, GTK_WIDGET (sf)->window, - GTK_STATE_NORMAL, priv->shadow_type, + GTK_STATE_NORMAL, details->shadow_type, area, GTK_WIDGET (sf), "scroll_frame", - priv->frame_x, priv->frame_y, - priv->frame_w, priv->frame_h); + details->frame_x, details->frame_y, + details->frame_w, details->frame_h); } /* Draw handler for the scroll frame widget */ static void -gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area) +nautilus_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; GdkRectangle child_area; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); g_return_if_fail (area != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; bin = GTK_BIN (widget); if (GTK_WIDGET_DRAWABLE (widget)) @@ -466,29 +462,28 @@ gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area) && gtk_widget_intersect (bin->child, area, &child_area)) gtk_widget_draw (bin->child, &child_area); - if (GTK_WIDGET_VISIBLE (priv->hsb) - && gtk_widget_intersect (priv->hsb, area, &child_area)) - gtk_widget_draw (priv->hsb, &child_area); + if (GTK_WIDGET_VISIBLE (details->hsb) + && gtk_widget_intersect (details->hsb, area, &child_area)) + gtk_widget_draw (details->hsb, &child_area); - if (GTK_WIDGET_VISIBLE (priv->vsb) - && gtk_widget_intersect (priv->vsb, area, &child_area)) - gtk_widget_draw (priv->vsb, &child_area); + if (GTK_WIDGET_VISIBLE (details->vsb) + && gtk_widget_intersect (details->vsb, area, &child_area)) + gtk_widget_draw (details->vsb, &child_area); } /* Forall handler for the scroll frame widget */ static void -gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals, +nautilus_scroll_frame_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (container != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (container)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (container)); g_return_if_fail (callback != NULL); - sf = GTK_SCROLL_FRAME (container); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (container); + details = sf->details; if (GTK_CONTAINER_CLASS (parent_class)->forall) (* GTK_CONTAINER_CLASS (parent_class)->forall) ( @@ -496,20 +491,20 @@ gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals, callback, callback_data); if (include_internals) { - if (priv->vsb) - (* callback) (priv->vsb, callback_data); + if (details->vsb) + (* callback) (details->vsb, callback_data); - if (priv->hsb) - (* callback) (priv->hsb, callback_data); + if (details->hsb) + (* callback) (details->hsb, callback_data); } } /* Size_request handler for the scroll frame widget */ static void -gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) +nautilus_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; gint extra_width; gint extra_height; @@ -517,12 +512,11 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) GtkRequisition vsb_requisition; GtkRequisition child_requisition; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); g_return_if_fail (requisition != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; bin = GTK_BIN (widget); extra_width = 0; @@ -531,13 +525,13 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) requisition->width = GTK_CONTAINER (widget)->border_width * 2; requisition->height = GTK_CONTAINER (widget)->border_width * 2; - if (priv->shadow_type != GTK_SHADOW_NONE) { + if (details->shadow_type != GTK_SHADOW_NONE) { requisition->width += 2 * widget->style->klass->xthickness; requisition->height += 2 * widget->style->klass->ythickness; } - gtk_widget_size_request (priv->hsb, &hsb_requisition); - gtk_widget_size_request (priv->vsb, &vsb_requisition); + gtk_widget_size_request (details->hsb, &hsb_requisition); + gtk_widget_size_request (details->vsb, &vsb_requisition); if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { static guint quark_aux_info; @@ -547,7 +541,7 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) gtk_widget_size_request (bin->child, &child_requisition); - if (priv->hsb_policy == GTK_POLICY_NEVER) + if (details->hsb_policy == GTK_POLICY_NEVER) requisition->width += child_requisition.width; else { GtkWidgetAuxInfo *aux_info; @@ -561,7 +555,7 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) requisition->width += vsb_requisition.width; } - if (priv->vsb_policy == GTK_POLICY_NEVER) + if (details->vsb_policy == GTK_POLICY_NEVER) requisition->height += child_requisition.height; else { GtkWidgetAuxInfo *aux_info; @@ -576,16 +570,16 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) } } - if (priv->hsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (priv->hsb)) { + if (details->hsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (details->hsb)) { requisition->width = MAX (requisition->width, hsb_requisition.width); - if (!extra_height || GTK_WIDGET_VISIBLE (priv->hsb)) - extra_height = priv->sb_spacing + hsb_requisition.height; + if (!extra_height || GTK_WIDGET_VISIBLE (details->hsb)) + extra_height = details->sb_spacing + hsb_requisition.height; } - if (priv->vsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (priv->vsb)) { + if (details->vsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (details->vsb)) { requisition->height = MAX (requisition->height, vsb_requisition.height); - if (!extra_width || GTK_WIDGET_VISIBLE (priv->vsb)) - extra_width = priv->sb_spacing + vsb_requisition.width; + if (!extra_width || GTK_WIDGET_VISIBLE (details->vsb)) + extra_width = details->sb_spacing + vsb_requisition.width; } requisition->width += MAX (0, extra_width); @@ -596,85 +590,83 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) static void compute_relative_allocation (GtkWidget *widget, GtkAllocation *allocation) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_assert (widget != NULL); - g_assert (GTK_IS_SCROLL_FRAME (widget)); + g_assert (NAUTILUS_IS_SCROLL_FRAME (widget)); g_assert (allocation != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; allocation->x = GTK_CONTAINER (widget)->border_width; allocation->y = GTK_CONTAINER (widget)->border_width; allocation->width = MAX (1, (gint) widget->allocation.width - allocation->x * 2); allocation->height = MAX (1, (gint) widget->allocation.height - allocation->y * 2); - if (priv->vsb_visible) { + if (details->vsb_visible) { GtkRequisition vsb_requisition; gint possible_new_width; - gtk_widget_get_child_requisition (priv->vsb, &vsb_requisition); + gtk_widget_get_child_requisition (details->vsb, &vsb_requisition); - if (priv->frame_placement == GTK_CORNER_TOP_RIGHT - || priv->frame_placement == GTK_CORNER_BOTTOM_RIGHT) - allocation->x += vsb_requisition.width + priv->sb_spacing; + if (details->frame_placement == GTK_CORNER_TOP_RIGHT + || details->frame_placement == GTK_CORNER_BOTTOM_RIGHT) + allocation->x += vsb_requisition.width + details->sb_spacing; possible_new_width = ((gint) allocation->width - - ((gint) vsb_requisition.width + priv->sb_spacing)); + - ((gint) vsb_requisition.width + details->sb_spacing)); allocation->width = MAX (0, possible_new_width); } - if (priv->hsb_visible) { + if (details->hsb_visible) { GtkRequisition hsb_requisition; gint possible_new_height; - gtk_widget_get_child_requisition (priv->hsb, &hsb_requisition); + gtk_widget_get_child_requisition (details->hsb, &hsb_requisition); - if (priv->frame_placement == GTK_CORNER_BOTTOM_LEFT - || priv->frame_placement == GTK_CORNER_BOTTOM_RIGHT) - allocation->y += hsb_requisition.height + priv->sb_spacing; + if (details->frame_placement == GTK_CORNER_BOTTOM_LEFT + || details->frame_placement == GTK_CORNER_BOTTOM_RIGHT) + allocation->y += hsb_requisition.height + details->sb_spacing; possible_new_height = ( ((gint)allocation->height) - - ((gint)hsb_requisition.height) + ((gint)priv->sb_spacing)); + - ((gint)hsb_requisition.height) + ((gint)details->sb_spacing)); allocation->height = MAX (0, possible_new_height); } } /* Size_allocate handler for the scroll frame widget */ static void -gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) +nautilus_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; GtkAllocation relative_allocation; GtkAllocation child_allocation; gint xthickness, ythickness; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); g_return_if_fail (allocation != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; bin = GTK_BIN (widget); widget->allocation = *allocation; - if (priv->hsb_policy == GTK_POLICY_ALWAYS) - priv->hsb_visible = TRUE; - else if (priv->hsb_policy == GTK_POLICY_NEVER) - priv->hsb_visible = FALSE; + if (details->hsb_policy == GTK_POLICY_ALWAYS) + details->hsb_visible = TRUE; + else if (details->hsb_policy == GTK_POLICY_NEVER) + details->hsb_visible = FALSE; - if (priv->vsb_policy == GTK_POLICY_ALWAYS) - priv->vsb_visible = TRUE; - else if (priv->vsb_policy == GTK_POLICY_NEVER) - priv->vsb_visible = FALSE; + if (details->vsb_policy == GTK_POLICY_ALWAYS) + details->vsb_visible = TRUE; + else if (details->vsb_policy == GTK_POLICY_NEVER) + details->vsb_visible = FALSE; - if (priv->shadow_type == GTK_SHADOW_NONE) { + if (details->shadow_type == GTK_SHADOW_NONE) { xthickness = 0; ythickness = 0; } else { @@ -692,20 +684,20 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) compute_relative_allocation (widget, &relative_allocation); - priv->frame_x = relative_allocation.x + allocation->x; - priv->frame_y = relative_allocation.y + allocation->y; - priv->frame_w = relative_allocation.width; - priv->frame_h = relative_allocation.height; + details->frame_x = relative_allocation.x + allocation->x; + details->frame_y = relative_allocation.y + allocation->y; + details->frame_w = relative_allocation.width; + details->frame_h = relative_allocation.height; - child_allocation.x = priv->frame_x + xthickness; - child_allocation.y = priv->frame_y + ythickness; - possible_new_size = priv->frame_w - 2 * xthickness; + child_allocation.x = details->frame_x + xthickness; + child_allocation.y = details->frame_y + ythickness; + possible_new_size = details->frame_w - 2 * xthickness; child_allocation.width = MAX(1, possible_new_size); - possible_new_size = priv->frame_h - 2 * ythickness; + possible_new_size = details->frame_h - 2 * ythickness; child_allocation.height = MAX(1, possible_new_size); - previous_hvis = priv->hsb_visible; - previous_vvis = priv->vsb_visible; + previous_hvis = details->hsb_visible; + previous_vvis = details->vsb_visible; gtk_widget_size_allocate (bin->child, &child_allocation); @@ -713,10 +705,10 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) * vscrollbar flip visiblity, then we need both. */ if (count - && previous_hvis != priv->hsb_visible - && previous_vvis != priv->vsb_visible) { - priv->hsb_visible = TRUE; - priv->vsb_visible = TRUE; + && previous_hvis != details->hsb_visible + && previous_vvis != details->vsb_visible) { + details->hsb_visible = TRUE; + details->vsb_visible = TRUE; /* a new resize is already queued at this point, * so we will immediatedly get reinvoked @@ -725,26 +717,26 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) } count++; - } while (previous_hvis != priv->hsb_visible - || previous_vvis != priv->vsb_visible); + } while (previous_hvis != details->hsb_visible + || previous_vvis != details->vsb_visible); } else compute_relative_allocation (widget, &relative_allocation); - if (priv->hsb_visible) { + if (details->hsb_visible) { GtkRequisition hscrollbar_requisition; - gtk_widget_get_child_requisition (priv->hsb, &hscrollbar_requisition); + gtk_widget_get_child_requisition (details->hsb, &hscrollbar_requisition); - if (!GTK_WIDGET_VISIBLE (priv->hsb)) - gtk_widget_show (priv->hsb); + if (!GTK_WIDGET_VISIBLE (details->hsb)) + gtk_widget_show (details->hsb); child_allocation.x = relative_allocation.x; - if (priv->frame_placement == GTK_CORNER_TOP_LEFT - || priv->frame_placement == GTK_CORNER_TOP_RIGHT) + if (details->frame_placement == GTK_CORNER_TOP_LEFT + || details->frame_placement == GTK_CORNER_TOP_RIGHT) child_allocation.y = (relative_allocation.y #if 0 + relative_allocation.height - + priv->sb_spacing); + + details->sb_spacing); #else + relative_allocation.height); #endif @@ -756,23 +748,23 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) child_allocation.x += allocation->x; child_allocation.y += allocation->y; - gtk_widget_size_allocate (priv->hsb, &child_allocation); - } else if (GTK_WIDGET_VISIBLE (priv->hsb)) - gtk_widget_hide (priv->hsb); + gtk_widget_size_allocate (details->hsb, &child_allocation); + } else if (GTK_WIDGET_VISIBLE (details->hsb)) + gtk_widget_hide (details->hsb); - if (priv->vsb_visible) { + if (details->vsb_visible) { GtkRequisition vscrollbar_requisition; - if (!GTK_WIDGET_VISIBLE (priv->vsb)) - gtk_widget_show (priv->vsb); + if (!GTK_WIDGET_VISIBLE (details->vsb)) + gtk_widget_show (details->vsb); - gtk_widget_get_child_requisition (priv->vsb, &vscrollbar_requisition); + gtk_widget_get_child_requisition (details->vsb, &vscrollbar_requisition); - if (priv->frame_placement == GTK_CORNER_TOP_LEFT - || priv->frame_placement == GTK_CORNER_BOTTOM_LEFT) + if (details->frame_placement == GTK_CORNER_TOP_LEFT + || details->frame_placement == GTK_CORNER_BOTTOM_LEFT) child_allocation.x = (relative_allocation.x + relative_allocation.width - + priv->sb_spacing); + + details->sb_spacing); else child_allocation.x = GTK_CONTAINER (sf)->border_width; @@ -782,22 +774,21 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) child_allocation.x += allocation->x; child_allocation.y += allocation->y; - gtk_widget_size_allocate (priv->vsb, &child_allocation); - } else if (GTK_WIDGET_VISIBLE (priv->vsb)) - gtk_widget_hide (priv->vsb); + gtk_widget_size_allocate (details->vsb, &child_allocation); + } else if (GTK_WIDGET_VISIBLE (details->vsb)) + gtk_widget_hide (details->vsb); } /* Expose handler for the scroll frame widget */ static gint -gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) +nautilus_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) { - GtkScrollFrame *sf; + NautilusScrollFrame *sf; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_SCROLL_FRAME (widget), FALSE); + g_return_val_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); - sf = GTK_SCROLL_FRAME (widget); + sf = NAUTILUS_SCROLL_FRAME (widget); if (GTK_WIDGET_DRAWABLE (widget)) draw_shadow (sf, &event->area); @@ -810,14 +801,14 @@ gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) /* Add handler for the scroll frame widget */ static void -gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child) +nautilus_scroll_frame_add (GtkContainer *container, GtkWidget *child) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; - sf = GTK_SCROLL_FRAME (container); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (container); + details = sf->details; bin = GTK_BIN (container); g_return_if_fail (bin->child == NULL); @@ -826,10 +817,10 @@ gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child) /* this is a temporary message */ if (!gtk_widget_set_scroll_adjustments (child, - gtk_range_get_adjustment (GTK_RANGE (priv->hsb)), - gtk_range_get_adjustment (GTK_RANGE (priv->vsb)))) - g_warning ("gtk_scroll_frame_add(): cannot add non scrollable widget " - "use gtk_scroll_frame_add_with_viewport() instead"); + gtk_range_get_adjustment (GTK_RANGE (details->hsb)), + gtk_range_get_adjustment (GTK_RANGE (details->vsb)))) + g_warning ("nautilus_scroll_frame_add(): cannot add non scrollable widget " + "use nautilus_scroll_frame_add_with_viewport() instead"); if (GTK_WIDGET_REALIZED (child->parent)) gtk_widget_realize (child); @@ -844,10 +835,9 @@ gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child) /* Remove method for the scroll frame widget */ static void -gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child) +nautilus_scroll_frame_remove (GtkContainer *container, GtkWidget *child) { - g_return_if_fail (container != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (container)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (container)); g_return_if_fail (child != NULL); g_return_if_fail (GTK_BIN (container)->child == child); @@ -859,7 +849,7 @@ gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child) } /** - * gtk_scroll_frame_new: + * nautilus_scroll_frame_new: * @hadj: If non-NULL, the adjustment to use for horizontal scrolling. * @vadj: If non-NULL, the adjustment to use for vertical scrolling. * @@ -868,7 +858,7 @@ gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child) * Return value: The newly-created scroll frame widget. **/ GtkWidget * -gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) +nautilus_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) { if (hadj) g_return_val_if_fail (GTK_IS_ADJUSTMENT (hadj), NULL); @@ -876,7 +866,7 @@ gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) if (vadj) g_return_val_if_fail (GTK_IS_ADJUSTMENT (vadj), NULL); - return gtk_widget_new (GTK_TYPE_SCROLL_FRAME, + return gtk_widget_new (NAUTILUS_TYPE_SCROLL_FRAME, "hadjustment", hadj, "vadjustment", vadj, NULL); @@ -886,39 +876,38 @@ gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) static void adjustment_changed (GtkAdjustment *adj, gpointer data) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (adj != NULL); g_return_if_fail (GTK_IS_ADJUSTMENT (adj)); g_return_if_fail (data != NULL); - sf = GTK_SCROLL_FRAME (data); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (data); + details = sf->details; - if (adj == gtk_range_get_adjustment (GTK_RANGE (priv->hsb))) { - if (priv->hsb_policy == GTK_POLICY_AUTOMATIC) { + if (adj == gtk_range_get_adjustment (GTK_RANGE (details->hsb))) { + if (details->hsb_policy == GTK_POLICY_AUTOMATIC) { gboolean visible; - visible = priv->hsb_visible; - priv->hsb_visible = (adj->upper - adj->lower > adj->page_size); - if (priv->hsb_visible != visible) + visible = details->hsb_visible; + details->hsb_visible = (adj->upper - adj->lower > adj->page_size); + if (details->hsb_visible != visible) gtk_widget_queue_resize (GTK_WIDGET (sf)); } - } else if (adj == gtk_range_get_adjustment (GTK_RANGE (priv->vsb))) { - if (priv->vsb_policy == GTK_POLICY_AUTOMATIC) { + } else if (adj == gtk_range_get_adjustment (GTK_RANGE (details->vsb))) { + if (details->vsb_policy == GTK_POLICY_AUTOMATIC) { gboolean visible; - visible = priv->vsb_visible; - priv->vsb_visible = (adj->upper - adj->lower > adj->page_size); - if (priv->vsb_visible != visible) + visible = details->vsb_visible; + details->vsb_visible = (adj->upper - adj->lower > adj->page_size); + if (details->vsb_visible != visible) gtk_widget_queue_resize (GTK_WIDGET (sf)); } } } /** - * gtk_scroll_frame_set_hadjustment: + * nautilus_scroll_frame_set_hadjustment: * @sf: A scroll frame widget. * @adj: An adjustment. * @@ -926,43 +915,42 @@ adjustment_changed (GtkAdjustment *adj, gpointer data) * widget. **/ void -gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) +nautilus_scroll_frame_set_hadjustment (NautilusScrollFrame *sf, GtkAdjustment *adj) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; if (adj) g_return_if_fail (GTK_IS_ADJUSTMENT (adj)); else adj = GTK_ADJUSTMENT (gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL)); - if (!priv->hsb) { + if (!details->hsb) { gtk_widget_push_composite_child (); - priv->hsb = gtk_hscrollbar_new (adj); - gtk_widget_set_composite_name (priv->hsb, "hscrollbar"); + details->hsb = gtk_hscrollbar_new (adj); + gtk_widget_set_composite_name (details->hsb, "hscrollbar"); gtk_widget_pop_composite_child (); - gtk_widget_set_parent (priv->hsb, GTK_WIDGET (sf)); - gtk_widget_ref (priv->hsb); - gtk_widget_show (priv->hsb); + gtk_widget_set_parent (details->hsb, GTK_WIDGET (sf)); + gtk_widget_ref (details->hsb); + gtk_widget_show (details->hsb); } else { GtkAdjustment *old_adj; - old_adj = gtk_range_get_adjustment (GTK_RANGE (priv->hsb)); + old_adj = gtk_range_get_adjustment (GTK_RANGE (details->hsb)); if (old_adj == adj) return; gtk_signal_disconnect_by_func (GTK_OBJECT (old_adj), GTK_SIGNAL_FUNC (adjustment_changed), sf); - gtk_range_set_adjustment (GTK_RANGE (priv->hsb), adj); + gtk_range_set_adjustment (GTK_RANGE (details->hsb), adj); } - adj = gtk_range_get_adjustment (GTK_RANGE (priv->hsb)); + adj = gtk_range_get_adjustment (GTK_RANGE (details->hsb)); gtk_signal_connect (GTK_OBJECT (adj), "changed", GTK_SIGNAL_FUNC (adjustment_changed), @@ -972,12 +960,12 @@ gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) if (GTK_BIN (sf)->child) gtk_widget_set_scroll_adjustments ( GTK_BIN (sf)->child, - gtk_range_get_adjustment (GTK_RANGE (priv->hsb)), - gtk_range_get_adjustment (GTK_RANGE (priv->vsb))); + gtk_range_get_adjustment (GTK_RANGE (details->hsb)), + gtk_range_get_adjustment (GTK_RANGE (details->vsb))); } /** - * gtk_scroll_frame_set_vadjustment: + * nautilus_scroll_frame_set_vadjustment: * @sf: A scroll frame widget. * @adj: An adjustment. * @@ -985,43 +973,42 @@ gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) * widget. **/ void -gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) +nautilus_scroll_frame_set_vadjustment (NautilusScrollFrame *sf, GtkAdjustment *adj) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; if (adj) g_return_if_fail (GTK_IS_ADJUSTMENT (adj)); else adj = GTK_ADJUSTMENT (gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL)); - if (!priv->vsb) { + if (!details->vsb) { gtk_widget_push_composite_child (); - priv->vsb = gtk_vscrollbar_new (adj); - gtk_widget_set_composite_name (priv->vsb, "vscrollbar"); + details->vsb = gtk_vscrollbar_new (adj); + gtk_widget_set_composite_name (details->vsb, "vscrollbar"); gtk_widget_pop_composite_child (); - gtk_widget_set_parent (priv->vsb, GTK_WIDGET (sf)); - gtk_widget_ref (priv->vsb); - gtk_widget_show (priv->vsb); + gtk_widget_set_parent (details->vsb, GTK_WIDGET (sf)); + gtk_widget_ref (details->vsb); + gtk_widget_show (details->vsb); } else { GtkAdjustment *old_adj; - old_adj = gtk_range_get_adjustment (GTK_RANGE (priv->vsb)); + old_adj = gtk_range_get_adjustment (GTK_RANGE (details->vsb)); if (old_adj == adj) return; gtk_signal_disconnect_by_func (GTK_OBJECT (old_adj), GTK_SIGNAL_FUNC (adjustment_changed), sf); - gtk_range_set_adjustment (GTK_RANGE (priv->vsb), adj); + gtk_range_set_adjustment (GTK_RANGE (details->vsb), adj); } - adj = gtk_range_get_adjustment (GTK_RANGE (priv->vsb)); + adj = gtk_range_get_adjustment (GTK_RANGE (details->vsb)); gtk_signal_connect (GTK_OBJECT (adj), "changed", GTK_SIGNAL_FUNC (adjustment_changed), @@ -1031,12 +1018,12 @@ gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) if (GTK_BIN (sf)->child) gtk_widget_set_scroll_adjustments ( GTK_BIN (sf)->child, - gtk_range_get_adjustment (GTK_RANGE (priv->hsb)), - gtk_range_get_adjustment (GTK_RANGE (priv->vsb))); + gtk_range_get_adjustment (GTK_RANGE (details->hsb)), + gtk_range_get_adjustment (GTK_RANGE (details->vsb))); } /** - * gtk_scroll_frame_get_hadjustment: + * nautilus_scroll_frame_get_hadjustment: * @sf: A scroll frame widget. * * Queries the horizontal adjustment of a scroll frame widget. @@ -1044,20 +1031,19 @@ gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) * Return value: The horizontal adjustment of the scroll frame, or NULL if none. **/ GtkAdjustment * -gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf) +nautilus_scroll_frame_get_hadjustment (NautilusScrollFrame *sf) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_val_if_fail (sf != NULL, NULL); - g_return_val_if_fail (GTK_IS_SCROLL_FRAME (sf), NULL); + g_return_val_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf), NULL); - priv = sf->priv; + details = sf->details; - return priv->hsb ? gtk_range_get_adjustment (GTK_RANGE (priv->hsb)) : NULL; + return details->hsb ? gtk_range_get_adjustment (GTK_RANGE (details->hsb)) : NULL; } /** - * gtk_scroll_frame_get_vadjustment: + * nautilus_scroll_frame_get_vadjustment: * @sf: A scroll frame widget. * * Queries the vertical adjustment of a scroll frame widget. @@ -1065,20 +1051,19 @@ gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf) * Return value: The vertical adjustment of the scroll frame, or NULL if none. **/ GtkAdjustment * -gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf) +nautilus_scroll_frame_get_vadjustment (NautilusScrollFrame *sf) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_val_if_fail (sf != NULL, NULL); - g_return_val_if_fail (GTK_IS_SCROLL_FRAME (sf), NULL); + g_return_val_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf), NULL); - priv = sf->priv; + details = sf->details; - return priv->vsb ? gtk_range_get_adjustment (GTK_RANGE (priv->vsb)) : NULL; + return details->vsb ? gtk_range_get_adjustment (GTK_RANGE (details->vsb)) : NULL; } /** - * gtk_scroll_frame_set_policy: + * nautilus_scroll_frame_set_policy: * @sf: A scroll frame widget. * @hsb_policy: Policy for the horizontal scrollbar. * @vsb_policy: Policy for the vertical scrollbar. @@ -1087,28 +1072,27 @@ gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf) * the scrollbars are to be shown or hidden. **/ void -gtk_scroll_frame_set_policy (GtkScrollFrame *sf, +nautilus_scroll_frame_set_policy (NautilusScrollFrame *sf, GtkPolicyType hsb_policy, GtkPolicyType vsb_policy) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; - if (priv->hsb_policy == hsb_policy && priv->vsb_policy == vsb_policy) + if (details->hsb_policy == hsb_policy && details->vsb_policy == vsb_policy) return; - priv->hsb_policy = hsb_policy; - priv->vsb_policy = vsb_policy; + details->hsb_policy = hsb_policy; + details->vsb_policy = vsb_policy; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_set_placement: + * nautilus_scroll_frame_set_placement: * @sf: A scroll frame widget. * @frame_placement: Placement for the frame. * @@ -1116,24 +1100,23 @@ gtk_scroll_frame_set_policy (GtkScrollFrame *sf, * scrollbars. **/ void -gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placement) +nautilus_scroll_frame_set_placement (NautilusScrollFrame *sf, GtkCornerType frame_placement) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; - if (priv->frame_placement == frame_placement) + if (details->frame_placement == frame_placement) return; - priv->frame_placement = frame_placement; + details->frame_placement = frame_placement; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_set_shadow_type: + * nautilus_scroll_frame_set_shadow_type: * @sf: A scroll frame widget. * @shadow_type: A shadow type. * @@ -1141,25 +1124,24 @@ gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placemen * insert a child that does not paint a frame on its own. **/ void -gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type) +nautilus_scroll_frame_set_shadow_type (NautilusScrollFrame *sf, GtkShadowType shadow_type) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); g_return_if_fail (shadow_type <= GTK_SHADOW_ETCHED_OUT); - priv = sf->priv; + details = sf->details; - if (priv->shadow_type == shadow_type) + if (details->shadow_type == shadow_type) return; - priv->shadow_type = shadow_type; + details->shadow_type = shadow_type; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_set_scrollbar_spacing: + * nautilus_scroll_frame_set_scrollbar_spacing: * @sf: A scroll frame widget. * @spacing: Desired spacing in pixels. * @@ -1167,24 +1149,23 @@ gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type) * widget. **/ void -gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing) +nautilus_scroll_frame_set_scrollbar_spacing (NautilusScrollFrame *sf, guint spacing) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; - if (priv->sb_spacing == spacing) + if (details->sb_spacing == spacing) return; - priv->sb_spacing = spacing; + details->sb_spacing = spacing; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_add_with_viewport: + * nautilus_scroll_frame_add_with_viewport: * @sf: A scroll frame widget. * @child: A widget. * @@ -1193,19 +1174,17 @@ gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing) * used only when a child does not support the scrolling interface. **/ void -gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child) +nautilus_scroll_frame_add_with_viewport (NautilusScrollFrame *sf, GtkWidget *child) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; GtkBin *bin; GtkWidget *viewport; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); - g_return_if_fail (child != NULL); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); g_return_if_fail (GTK_IS_WIDGET (child)); g_return_if_fail (child->parent == NULL); - priv = sf->priv; + details = sf->details; bin = GTK_BIN (sf); if (bin->child != NULL) { @@ -1214,8 +1193,8 @@ gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child) viewport = bin->child; } else { - viewport = gtk_viewport_new (gtk_scroll_frame_get_hadjustment (sf), - gtk_scroll_frame_get_vadjustment (sf)); + viewport = gtk_viewport_new (nautilus_scroll_frame_get_hadjustment (sf), + nautilus_scroll_frame_get_vadjustment (sf)); gtk_container_add (GTK_CONTAINER (sf), viewport); } diff --git a/libnautilus-private/gtkscrollframe.h b/libnautilus-private/gtkscrollframe.h index 749417a8b..2807b24fd 100644 --- a/libnautilus-private/gtkscrollframe.h +++ b/libnautilus-private/gtkscrollframe.h @@ -25,70 +25,62 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#ifndef __GTK_SCROLL_FRAME_H__ -#define __GTK_SCROLL_FRAME_H__ +#ifndef GTK_SCROLL_FRAME_H +#define GTK_SCROLL_FRAME_H - -#include <gdk/gdk.h> #include <gtk/gtkbin.h> - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ - -#define GTK_TYPE_SCROLL_FRAME (gtk_scroll_frame_get_type ()) -#define GTK_SCROLL_FRAME(obj) (GTK_CHECK_CAST ((obj), \ - GTK_TYPE_SCROLL_FRAME, GtkScrollFrame)) -#define GTK_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \ - GTK_TYPE_SCROLL_FRAME, GtkScrollFrameClass)) -#define GTK_IS_SCROLL_FRAME(obj) (GTK_CHECK_TYPE ((obj), \ - GTK_TYPE_SCROLL_FRAME)) -#define GTK_IS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \ - GTK_TYPE_SCROLL_FRAME)) - - -typedef struct _GtkScrollFrame GtkScrollFrame; -typedef struct _GtkScrollFrameClass GtkScrollFrameClass; - -struct _GtkScrollFrame +#define NAUTILUS_TYPE_SCROLL_FRAME (nautilus_scroll_frame_get_type ()) +#define NAUTILUS_SCROLL_FRAME(obj) (GTK_CHECK_CAST ((obj), \ + NAUTILUS_TYPE_SCROLL_FRAME, NautilusScrollFrame)) +#define NAUTILUS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \ + NAUTILUS_TYPE_SCROLL_FRAME, NautilusScrollFrameClass)) +#define NAUTILUS_IS_SCROLL_FRAME(obj) (GTK_CHECK_TYPE ((obj), \ + NAUTILUS_TYPE_SCROLL_FRAME)) +#define NAUTILUS_IS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \ + NAUTILUS_TYPE_SCROLL_FRAME)) + +typedef struct NautilusScrollFrame NautilusScrollFrame; +typedef struct NautilusScrollFrameClass NautilusScrollFrameClass; +typedef struct NautilusScrollFrameDetails NautilusScrollFrameDetails; + +struct NautilusScrollFrame { GtkBin bin; - - /* Private data */ - gpointer priv; + NautilusScrollFrameDetails *details; }; - -struct _GtkScrollFrameClass +struct NautilusScrollFrameClass { GtkBinClass parent_class; }; - -GtkType gtk_scroll_frame_get_type (void); -GtkWidget *gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj); - -void gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj); -void gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj); - -GtkAdjustment *gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf); -GtkAdjustment *gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf); - -void gtk_scroll_frame_set_policy (GtkScrollFrame *sf, - GtkPolicyType hsb_policy, - GtkPolicyType vsb_policy); - -void gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placement); -void gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type); -void gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing); - -void gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child); - +GtkType nautilus_scroll_frame_get_type (void); +GtkWidget * nautilus_scroll_frame_new (GtkAdjustment *h_adjustment, + GtkAdjustment *v_adjustment); +void nautilus_scroll_frame_set_hadjustment (NautilusScrollFrame *frame, + GtkAdjustment *adj); +void nautilus_scroll_frame_set_vadjustment (NautilusScrollFrame *frame, + GtkAdjustment *adj); +GtkAdjustment *nautilus_scroll_frame_get_hadjustment (NautilusScrollFrame *frame); +GtkAdjustment *nautilus_scroll_frame_get_vadjustment (NautilusScrollFrame *frame); +void nautilus_scroll_frame_set_policy (NautilusScrollFrame *frame, + GtkPolicyType h_scroll_policy, + GtkPolicyType v_scroll_policy); +void nautilus_scroll_frame_set_placement (NautilusScrollFrame *frame, + GtkCornerType frame_placement); +void nautilus_scroll_frame_set_shadow_type (NautilusScrollFrame *frame, + GtkShadowType shadow_type); +void nautilus_scroll_frame_set_scrollbar_spacing (NautilusScrollFrame *frame, + guint spacing); +void nautilus_scroll_frame_add_with_viewport (NautilusScrollFrame *frame, + GtkWidget *child); #ifdef __cplusplus } #endif /* __cplusplus */ - -#endif /* __GTK_SCROLL_FRAME_H__ */ +#endif /* GTK_SCROLL_FRAME_H */ diff --git a/libnautilus-private/nautilus-preferences-item.c b/libnautilus-private/nautilus-preferences-item.c index 9808891c4..25d57b14f 100644 --- a/libnautilus-private/nautilus-preferences-item.c +++ b/libnautilus-private/nautilus-preferences-item.c @@ -78,10 +78,10 @@ static void preferences_item_create_enum (NautilusPreferencesItem const NautilusPreference *prefrence); static void preferences_item_create_boolean (NautilusPreferencesItem *item, const NautilusPreference *prefrence); -static void enum_radio_group_changed_cb (GtkWidget *button_group, +static void enum_radio_group_changed_callback (GtkWidget *button_group, GtkWidget *button, gpointer user_data); -static void boolean_button_toggled_cb (GtkWidget *button_group, +static void boolean_button_toggled_callback (GtkWidget *button_group, gpointer user_data); NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesItem, nautilus_preferences_item, GTK_TYPE_VBOX) @@ -309,7 +309,7 @@ preferences_item_create_enum (NautilusPreferencesItem *item, gtk_signal_connect (GTK_OBJECT (item->details->child), "changed", - GTK_SIGNAL_FUNC (enum_radio_group_changed_cb), + GTK_SIGNAL_FUNC (enum_radio_group_changed_callback), (gpointer) item); } @@ -338,7 +338,7 @@ preferences_item_create_boolean (NautilusPreferencesItem *item, gtk_signal_connect (GTK_OBJECT (item->details->child), "toggled", - GTK_SIGNAL_FUNC (boolean_button_toggled_cb), + GTK_SIGNAL_FUNC (boolean_button_toggled_callback), (gpointer) item); } @@ -362,7 +362,7 @@ nautilus_preferences_item_new (const gchar *preference_name, } static void -enum_radio_group_changed_cb (GtkWidget *buttons, GtkWidget * button, gpointer user_data) +enum_radio_group_changed_callback (GtkWidget *buttons, GtkWidget * button, gpointer user_data) { NautilusPreferencesItem *item = (NautilusPreferencesItem *) user_data; const NautilusPreference *preference; @@ -380,7 +380,7 @@ enum_radio_group_changed_cb (GtkWidget *buttons, GtkWidget * button, gpointer us } static void -boolean_button_toggled_cb (GtkWidget *button, gpointer user_data) +boolean_button_toggled_callback (GtkWidget *button, gpointer user_data) { NautilusPreferencesItem *item = (NautilusPreferencesItem *) user_data; gboolean active_state; diff --git a/libnautilus-private/nautilus-scroll-frame.c b/libnautilus-private/nautilus-scroll-frame.c index 938c388c2..d8fed9059 100644 --- a/libnautilus-private/nautilus-scroll-frame.c +++ b/libnautilus-private/nautilus-scroll-frame.c @@ -80,8 +80,8 @@ enum { ARG_SCROLLBAR_SPACING }; -/* Private part of the GtkScrollFrame structure */ -typedef struct { +/* Private part of the NautilusScrollFrame structure */ +struct NautilusScrollFrameDetails { /* Horizontal and vertical scrollbars */ GtkWidget *hsb; GtkWidget *vsb; @@ -108,52 +108,52 @@ typedef struct { /* Shadow type for frame */ guint shadow_type : 3; -} ScrollFramePrivate; - - -static void gtk_scroll_frame_class_init (GtkScrollFrameClass *class); -static void gtk_scroll_frame_init (GtkScrollFrame *sf); -static void gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void gtk_scroll_frame_destroy (GtkObject *object); -static void gtk_scroll_frame_finalize (GtkObject *object); - -static void gtk_scroll_frame_map (GtkWidget *widget); -static void gtk_scroll_frame_unmap (GtkWidget *widget); -static void gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area); -static void gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition); -static void gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static gint gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event); - -static void gtk_scroll_frame_add (GtkContainer *container, GtkWidget *widget); -static void gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *widget); -static void gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals, +}; + + +static void nautilus_scroll_frame_class_init (NautilusScrollFrameClass *class); +static void nautilus_scroll_frame_init (NautilusScrollFrame *sf); +static void nautilus_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void nautilus_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void nautilus_scroll_frame_destroy (GtkObject *object); +static void nautilus_scroll_frame_finalize (GtkObject *object); + +static void nautilus_scroll_frame_map (GtkWidget *widget); +static void nautilus_scroll_frame_unmap (GtkWidget *widget); +static void nautilus_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area); +static void nautilus_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition); +static void nautilus_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation); +static gint nautilus_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event); + +static void nautilus_scroll_frame_add (GtkContainer *container, GtkWidget *widget); +static void nautilus_scroll_frame_remove (GtkContainer *container, GtkWidget *widget); +static void nautilus_scroll_frame_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); static GtkBinClass *parent_class; /** - * gtk_scroll_frame_get_type: + * nautilus_scroll_frame_get_type: * @void: * - * Registers the &GtkScrollFrame class if necessary, and returns the type ID + * Registers the &NautilusScrollFrame class if necessary, and returns the type ID * associated to it. * - * Return value: The type ID of the &GtkScrollFrame class. + * Return value: The type ID of the &NautilusScrollFrame class. **/ GtkType -gtk_scroll_frame_get_type (void) +nautilus_scroll_frame_get_type (void) { static GtkType scroll_frame_type = 0; if (!scroll_frame_type) { static const GtkTypeInfo scroll_frame_info = { - "GtkScrollFrame", - sizeof (GtkScrollFrame), - sizeof (GtkScrollFrameClass), - (GtkClassInitFunc) gtk_scroll_frame_class_init, - (GtkObjectInitFunc) gtk_scroll_frame_init, + "NautilusScrollFrame", + sizeof (NautilusScrollFrame), + sizeof (NautilusScrollFrameClass), + (GtkClassInitFunc) nautilus_scroll_frame_class_init, + (GtkObjectInitFunc) nautilus_scroll_frame_init, NULL, /* reserved_1 */ NULL, /* reserved_2 */ (GtkClassInitFunc) NULL @@ -167,7 +167,7 @@ gtk_scroll_frame_get_type (void) /* Class initialization function for the scroll frame widget */ static void -gtk_scroll_frame_class_init (GtkScrollFrameClass *class) +nautilus_scroll_frame_class_init (NautilusScrollFrameClass *class) { GtkObjectClass *object_class; GtkWidgetClass *widget_class; @@ -179,109 +179,109 @@ gtk_scroll_frame_class_init (GtkScrollFrameClass *class) parent_class = gtk_type_class (GTK_TYPE_BIN); - gtk_object_add_arg_type ("GtkScrollFrame::hadjustment", + gtk_object_add_arg_type ("NautilusScrollFrame::hadjustment", GTK_TYPE_ADJUSTMENT, GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT, ARG_HADJUSTMENT); - gtk_object_add_arg_type ("GtkScrollFrame::vadjustment", + gtk_object_add_arg_type ("NautilusScrollFrame::vadjustment", GTK_TYPE_ADJUSTMENT, GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT, ARG_VADJUSTMENT); - gtk_object_add_arg_type ("GtkScrollFrame::hscrollbar_policy", + gtk_object_add_arg_type ("NautilusScrollFrame::hscrollbar_policy", GTK_TYPE_POLICY_TYPE, GTK_ARG_READWRITE, ARG_HSCROLLBAR_POLICY); - gtk_object_add_arg_type ("GtkScrollFrame::vscrollbar_policy", + gtk_object_add_arg_type ("NautilusScrollFrame::vscrollbar_policy", GTK_TYPE_POLICY_TYPE, GTK_ARG_READWRITE, ARG_VSCROLLBAR_POLICY); - gtk_object_add_arg_type ("GtkScrollFrame::frame_placement", + gtk_object_add_arg_type ("NautilusScrollFrame::frame_placement", GTK_TYPE_CORNER_TYPE, GTK_ARG_READWRITE, ARG_FRAME_PLACEMENT); - gtk_object_add_arg_type ("GtkScrollFrame::shadow_type", + gtk_object_add_arg_type ("NautilusScrollFrame::shadow_type", GTK_TYPE_SHADOW_TYPE, GTK_ARG_READWRITE, ARG_SHADOW_TYPE); - gtk_object_add_arg_type ("GtkScrollFrame::scrollbar_spacing", + gtk_object_add_arg_type ("NautilusScrollFrame::scrollbar_spacing", GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_SCROLLBAR_SPACING); - object_class->set_arg = gtk_scroll_frame_set_arg; - object_class->get_arg = gtk_scroll_frame_get_arg; - object_class->destroy = gtk_scroll_frame_destroy; - object_class->finalize = gtk_scroll_frame_finalize; - - widget_class->map = gtk_scroll_frame_map; - widget_class->unmap = gtk_scroll_frame_unmap; - widget_class->draw = gtk_scroll_frame_draw; - widget_class->size_request = gtk_scroll_frame_size_request; - widget_class->size_allocate = gtk_scroll_frame_size_allocate; - widget_class->expose_event = gtk_scroll_frame_expose; - - container_class->add = gtk_scroll_frame_add; - container_class->remove = gtk_scroll_frame_remove; - container_class->forall = gtk_scroll_frame_forall; + object_class->set_arg = nautilus_scroll_frame_set_arg; + object_class->get_arg = nautilus_scroll_frame_get_arg; + object_class->destroy = nautilus_scroll_frame_destroy; + object_class->finalize = nautilus_scroll_frame_finalize; + + widget_class->map = nautilus_scroll_frame_map; + widget_class->unmap = nautilus_scroll_frame_unmap; + widget_class->draw = nautilus_scroll_frame_draw; + widget_class->size_request = nautilus_scroll_frame_size_request; + widget_class->size_allocate = nautilus_scroll_frame_size_allocate; + widget_class->expose_event = nautilus_scroll_frame_expose; + + container_class->add = nautilus_scroll_frame_add; + container_class->remove = nautilus_scroll_frame_remove; + container_class->forall = nautilus_scroll_frame_forall; } /* Object initialization function for the scroll frame widget */ static void -gtk_scroll_frame_init (GtkScrollFrame *sf) +nautilus_scroll_frame_init (NautilusScrollFrame *sf) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - priv = g_new0 (ScrollFramePrivate, 1); - sf->priv = priv; + details = g_new0 (NautilusScrollFrameDetails, 1); + sf->details = details; GTK_WIDGET_SET_FLAGS (sf, GTK_NO_WINDOW); gtk_container_set_resize_mode (GTK_CONTAINER (sf), GTK_RESIZE_QUEUE); - priv->sb_spacing = 3; - priv->hsb_policy = GTK_POLICY_ALWAYS; - priv->vsb_policy = GTK_POLICY_ALWAYS; - priv->frame_placement = GTK_CORNER_TOP_LEFT; - priv->shadow_type = GTK_SHADOW_NONE; + details->sb_spacing = 3; + details->hsb_policy = GTK_POLICY_ALWAYS; + details->vsb_policy = GTK_POLICY_ALWAYS; + details->frame_placement = GTK_CORNER_TOP_LEFT; + details->shadow_type = GTK_SHADOW_NONE; } /* Set_arg handler for the scroll frame widget */ static void -gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) +nautilus_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; switch (arg_id) { case ARG_HADJUSTMENT: - gtk_scroll_frame_set_hadjustment (sf, GTK_VALUE_POINTER (*arg)); + nautilus_scroll_frame_set_hadjustment (sf, GTK_VALUE_POINTER (*arg)); break; case ARG_VADJUSTMENT: - gtk_scroll_frame_set_vadjustment (sf, GTK_VALUE_POINTER (*arg)); + nautilus_scroll_frame_set_vadjustment (sf, GTK_VALUE_POINTER (*arg)); break; case ARG_HSCROLLBAR_POLICY: - gtk_scroll_frame_set_policy (sf, GTK_VALUE_ENUM (*arg), priv->vsb_policy); + nautilus_scroll_frame_set_policy (sf, GTK_VALUE_ENUM (*arg), details->vsb_policy); break; case ARG_VSCROLLBAR_POLICY: - gtk_scroll_frame_set_policy (sf, priv->hsb_policy, GTK_VALUE_ENUM (*arg)); + nautilus_scroll_frame_set_policy (sf, details->hsb_policy, GTK_VALUE_ENUM (*arg)); break; case ARG_FRAME_PLACEMENT: - gtk_scroll_frame_set_placement (sf, GTK_VALUE_ENUM (*arg)); + nautilus_scroll_frame_set_placement (sf, GTK_VALUE_ENUM (*arg)); break; case ARG_SHADOW_TYPE: - gtk_scroll_frame_set_shadow_type (sf, GTK_VALUE_ENUM (*arg)); + nautilus_scroll_frame_set_shadow_type (sf, GTK_VALUE_ENUM (*arg)); break; case ARG_SCROLLBAR_SPACING: - gtk_scroll_frame_set_scrollbar_spacing (sf, GTK_VALUE_UINT (*arg)); + nautilus_scroll_frame_set_scrollbar_spacing (sf, GTK_VALUE_UINT (*arg)); break; default: @@ -291,41 +291,41 @@ gtk_scroll_frame_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) /* Get_arg handler for the scroll frame widget */ static void -gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +nautilus_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; switch (arg_id) { case ARG_HADJUSTMENT: - GTK_VALUE_POINTER (*arg) = gtk_scroll_frame_get_hadjustment (sf); + GTK_VALUE_POINTER (*arg) = nautilus_scroll_frame_get_hadjustment (sf); break; case ARG_VADJUSTMENT: - GTK_VALUE_POINTER (*arg) = gtk_scroll_frame_get_vadjustment (sf); + GTK_VALUE_POINTER (*arg) = nautilus_scroll_frame_get_vadjustment (sf); break; case ARG_HSCROLLBAR_POLICY: - GTK_VALUE_ENUM (*arg) = priv->hsb_policy; + GTK_VALUE_ENUM (*arg) = details->hsb_policy; break; case ARG_VSCROLLBAR_POLICY: - GTK_VALUE_ENUM (*arg) = priv->vsb_policy; + GTK_VALUE_ENUM (*arg) = details->vsb_policy; break; case ARG_FRAME_PLACEMENT: - GTK_VALUE_ENUM (*arg) = priv->frame_placement; + GTK_VALUE_ENUM (*arg) = details->frame_placement; break; case ARG_SHADOW_TYPE: - GTK_VALUE_ENUM (*arg) = priv->shadow_type; + GTK_VALUE_ENUM (*arg) = details->shadow_type; break; case ARG_SCROLLBAR_SPACING: - GTK_VALUE_UINT (*arg) = priv->sb_spacing; + GTK_VALUE_UINT (*arg) = details->sb_spacing; break; default: @@ -336,21 +336,20 @@ gtk_scroll_frame_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) /* Destroy handler for the scroll frame widget */ static void -gtk_scroll_frame_destroy (GtkObject *object) +nautilus_scroll_frame_destroy (GtkObject *object) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (object != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (object)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (object)); - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; - gtk_widget_unparent (priv->hsb); - gtk_widget_unparent (priv->vsb); - gtk_widget_destroy (priv->hsb); - gtk_widget_destroy (priv->vsb); + gtk_widget_unparent (details->hsb); + gtk_widget_unparent (details->vsb); + gtk_widget_destroy (details->hsb); + gtk_widget_destroy (details->vsb); if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -358,18 +357,18 @@ gtk_scroll_frame_destroy (GtkObject *object) /* Finalize handler for the scroll frame widget */ static void -gtk_scroll_frame_finalize (GtkObject *object) +nautilus_scroll_frame_finalize (GtkObject *object) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - sf = GTK_SCROLL_FRAME (object); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (object); + details = sf->details; - gtk_widget_unref (priv->hsb); - gtk_widget_unref (priv->vsb); + gtk_widget_unref (details->hsb); + gtk_widget_unref (details->vsb); - g_free (priv); + g_free (details); if (GTK_OBJECT_CLASS (parent_class)->finalize) (* GTK_OBJECT_CLASS (parent_class)->finalize) (object); @@ -377,86 +376,83 @@ gtk_scroll_frame_finalize (GtkObject *object) /* Map handler for the scroll frame widget */ static void -gtk_scroll_frame_map (GtkWidget *widget) +nautilus_scroll_frame_map (GtkWidget *widget) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; /* chain parent class handler to map self and child */ if (GTK_WIDGET_CLASS (parent_class)->map) (* GTK_WIDGET_CLASS (parent_class)->map) (widget); - if (GTK_WIDGET_VISIBLE (priv->hsb) && !GTK_WIDGET_MAPPED (priv->hsb)) - gtk_widget_map (priv->hsb); + if (GTK_WIDGET_VISIBLE (details->hsb) && !GTK_WIDGET_MAPPED (details->hsb)) + gtk_widget_map (details->hsb); - if (GTK_WIDGET_VISIBLE (priv->vsb) && !GTK_WIDGET_MAPPED (priv->vsb)) - gtk_widget_map (priv->vsb); + if (GTK_WIDGET_VISIBLE (details->vsb) && !GTK_WIDGET_MAPPED (details->vsb)) + gtk_widget_map (details->vsb); } /* Unmap handler for the scroll frame widget */ static void -gtk_scroll_frame_unmap (GtkWidget *widget) +nautilus_scroll_frame_unmap (GtkWidget *widget) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; /* chain parent class handler to unmap self and child */ if (GTK_WIDGET_CLASS (parent_class)->unmap) (* GTK_WIDGET_CLASS (parent_class)->unmap) (widget); - if (GTK_WIDGET_MAPPED (priv->hsb)) - gtk_widget_unmap (priv->hsb); + if (GTK_WIDGET_MAPPED (details->hsb)) + gtk_widget_unmap (details->hsb); - if (GTK_WIDGET_MAPPED (priv->vsb)) - gtk_widget_unmap (priv->vsb); + if (GTK_WIDGET_MAPPED (details->vsb)) + gtk_widget_unmap (details->vsb); } /* Draws the shadow of a scroll frame widget */ static void -draw_shadow (GtkScrollFrame *sf, GdkRectangle *area) +draw_shadow (NautilusScrollFrame *sf, GdkRectangle *area) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; g_assert (area != NULL); - priv = sf->priv; + details = sf->details; gtk_paint_shadow (GTK_WIDGET (sf)->style, GTK_WIDGET (sf)->window, - GTK_STATE_NORMAL, priv->shadow_type, + GTK_STATE_NORMAL, details->shadow_type, area, GTK_WIDGET (sf), "scroll_frame", - priv->frame_x, priv->frame_y, - priv->frame_w, priv->frame_h); + details->frame_x, details->frame_y, + details->frame_w, details->frame_h); } /* Draw handler for the scroll frame widget */ static void -gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area) +nautilus_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; GdkRectangle child_area; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); g_return_if_fail (area != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; bin = GTK_BIN (widget); if (GTK_WIDGET_DRAWABLE (widget)) @@ -466,29 +462,28 @@ gtk_scroll_frame_draw (GtkWidget *widget, GdkRectangle *area) && gtk_widget_intersect (bin->child, area, &child_area)) gtk_widget_draw (bin->child, &child_area); - if (GTK_WIDGET_VISIBLE (priv->hsb) - && gtk_widget_intersect (priv->hsb, area, &child_area)) - gtk_widget_draw (priv->hsb, &child_area); + if (GTK_WIDGET_VISIBLE (details->hsb) + && gtk_widget_intersect (details->hsb, area, &child_area)) + gtk_widget_draw (details->hsb, &child_area); - if (GTK_WIDGET_VISIBLE (priv->vsb) - && gtk_widget_intersect (priv->vsb, area, &child_area)) - gtk_widget_draw (priv->vsb, &child_area); + if (GTK_WIDGET_VISIBLE (details->vsb) + && gtk_widget_intersect (details->vsb, area, &child_area)) + gtk_widget_draw (details->vsb, &child_area); } /* Forall handler for the scroll frame widget */ static void -gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals, +nautilus_scroll_frame_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (container != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (container)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (container)); g_return_if_fail (callback != NULL); - sf = GTK_SCROLL_FRAME (container); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (container); + details = sf->details; if (GTK_CONTAINER_CLASS (parent_class)->forall) (* GTK_CONTAINER_CLASS (parent_class)->forall) ( @@ -496,20 +491,20 @@ gtk_scroll_frame_forall (GtkContainer *container, gboolean include_internals, callback, callback_data); if (include_internals) { - if (priv->vsb) - (* callback) (priv->vsb, callback_data); + if (details->vsb) + (* callback) (details->vsb, callback_data); - if (priv->hsb) - (* callback) (priv->hsb, callback_data); + if (details->hsb) + (* callback) (details->hsb, callback_data); } } /* Size_request handler for the scroll frame widget */ static void -gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) +nautilus_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; gint extra_width; gint extra_height; @@ -517,12 +512,11 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) GtkRequisition vsb_requisition; GtkRequisition child_requisition; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); g_return_if_fail (requisition != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; bin = GTK_BIN (widget); extra_width = 0; @@ -531,13 +525,13 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) requisition->width = GTK_CONTAINER (widget)->border_width * 2; requisition->height = GTK_CONTAINER (widget)->border_width * 2; - if (priv->shadow_type != GTK_SHADOW_NONE) { + if (details->shadow_type != GTK_SHADOW_NONE) { requisition->width += 2 * widget->style->klass->xthickness; requisition->height += 2 * widget->style->klass->ythickness; } - gtk_widget_size_request (priv->hsb, &hsb_requisition); - gtk_widget_size_request (priv->vsb, &vsb_requisition); + gtk_widget_size_request (details->hsb, &hsb_requisition); + gtk_widget_size_request (details->vsb, &vsb_requisition); if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { static guint quark_aux_info; @@ -547,7 +541,7 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) gtk_widget_size_request (bin->child, &child_requisition); - if (priv->hsb_policy == GTK_POLICY_NEVER) + if (details->hsb_policy == GTK_POLICY_NEVER) requisition->width += child_requisition.width; else { GtkWidgetAuxInfo *aux_info; @@ -561,7 +555,7 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) requisition->width += vsb_requisition.width; } - if (priv->vsb_policy == GTK_POLICY_NEVER) + if (details->vsb_policy == GTK_POLICY_NEVER) requisition->height += child_requisition.height; else { GtkWidgetAuxInfo *aux_info; @@ -576,16 +570,16 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) } } - if (priv->hsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (priv->hsb)) { + if (details->hsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (details->hsb)) { requisition->width = MAX (requisition->width, hsb_requisition.width); - if (!extra_height || GTK_WIDGET_VISIBLE (priv->hsb)) - extra_height = priv->sb_spacing + hsb_requisition.height; + if (!extra_height || GTK_WIDGET_VISIBLE (details->hsb)) + extra_height = details->sb_spacing + hsb_requisition.height; } - if (priv->vsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (priv->vsb)) { + if (details->vsb_policy == GTK_POLICY_AUTOMATIC || GTK_WIDGET_VISIBLE (details->vsb)) { requisition->height = MAX (requisition->height, vsb_requisition.height); - if (!extra_width || GTK_WIDGET_VISIBLE (priv->vsb)) - extra_width = priv->sb_spacing + vsb_requisition.width; + if (!extra_width || GTK_WIDGET_VISIBLE (details->vsb)) + extra_width = details->sb_spacing + vsb_requisition.width; } requisition->width += MAX (0, extra_width); @@ -596,85 +590,83 @@ gtk_scroll_frame_size_request (GtkWidget *widget, GtkRequisition *requisition) static void compute_relative_allocation (GtkWidget *widget, GtkAllocation *allocation) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_assert (widget != NULL); - g_assert (GTK_IS_SCROLL_FRAME (widget)); + g_assert (NAUTILUS_IS_SCROLL_FRAME (widget)); g_assert (allocation != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; allocation->x = GTK_CONTAINER (widget)->border_width; allocation->y = GTK_CONTAINER (widget)->border_width; allocation->width = MAX (1, (gint) widget->allocation.width - allocation->x * 2); allocation->height = MAX (1, (gint) widget->allocation.height - allocation->y * 2); - if (priv->vsb_visible) { + if (details->vsb_visible) { GtkRequisition vsb_requisition; gint possible_new_width; - gtk_widget_get_child_requisition (priv->vsb, &vsb_requisition); + gtk_widget_get_child_requisition (details->vsb, &vsb_requisition); - if (priv->frame_placement == GTK_CORNER_TOP_RIGHT - || priv->frame_placement == GTK_CORNER_BOTTOM_RIGHT) - allocation->x += vsb_requisition.width + priv->sb_spacing; + if (details->frame_placement == GTK_CORNER_TOP_RIGHT + || details->frame_placement == GTK_CORNER_BOTTOM_RIGHT) + allocation->x += vsb_requisition.width + details->sb_spacing; possible_new_width = ((gint) allocation->width - - ((gint) vsb_requisition.width + priv->sb_spacing)); + - ((gint) vsb_requisition.width + details->sb_spacing)); allocation->width = MAX (0, possible_new_width); } - if (priv->hsb_visible) { + if (details->hsb_visible) { GtkRequisition hsb_requisition; gint possible_new_height; - gtk_widget_get_child_requisition (priv->hsb, &hsb_requisition); + gtk_widget_get_child_requisition (details->hsb, &hsb_requisition); - if (priv->frame_placement == GTK_CORNER_BOTTOM_LEFT - || priv->frame_placement == GTK_CORNER_BOTTOM_RIGHT) - allocation->y += hsb_requisition.height + priv->sb_spacing; + if (details->frame_placement == GTK_CORNER_BOTTOM_LEFT + || details->frame_placement == GTK_CORNER_BOTTOM_RIGHT) + allocation->y += hsb_requisition.height + details->sb_spacing; possible_new_height = ( ((gint)allocation->height) - - ((gint)hsb_requisition.height) + ((gint)priv->sb_spacing)); + - ((gint)hsb_requisition.height) + ((gint)details->sb_spacing)); allocation->height = MAX (0, possible_new_height); } } /* Size_allocate handler for the scroll frame widget */ static void -gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) +nautilus_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; GtkAllocation relative_allocation; GtkAllocation child_allocation; gint xthickness, ythickness; - g_return_if_fail (widget != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (widget)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget)); g_return_if_fail (allocation != NULL); - sf = GTK_SCROLL_FRAME (widget); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (widget); + details = sf->details; bin = GTK_BIN (widget); widget->allocation = *allocation; - if (priv->hsb_policy == GTK_POLICY_ALWAYS) - priv->hsb_visible = TRUE; - else if (priv->hsb_policy == GTK_POLICY_NEVER) - priv->hsb_visible = FALSE; + if (details->hsb_policy == GTK_POLICY_ALWAYS) + details->hsb_visible = TRUE; + else if (details->hsb_policy == GTK_POLICY_NEVER) + details->hsb_visible = FALSE; - if (priv->vsb_policy == GTK_POLICY_ALWAYS) - priv->vsb_visible = TRUE; - else if (priv->vsb_policy == GTK_POLICY_NEVER) - priv->vsb_visible = FALSE; + if (details->vsb_policy == GTK_POLICY_ALWAYS) + details->vsb_visible = TRUE; + else if (details->vsb_policy == GTK_POLICY_NEVER) + details->vsb_visible = FALSE; - if (priv->shadow_type == GTK_SHADOW_NONE) { + if (details->shadow_type == GTK_SHADOW_NONE) { xthickness = 0; ythickness = 0; } else { @@ -692,20 +684,20 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) compute_relative_allocation (widget, &relative_allocation); - priv->frame_x = relative_allocation.x + allocation->x; - priv->frame_y = relative_allocation.y + allocation->y; - priv->frame_w = relative_allocation.width; - priv->frame_h = relative_allocation.height; + details->frame_x = relative_allocation.x + allocation->x; + details->frame_y = relative_allocation.y + allocation->y; + details->frame_w = relative_allocation.width; + details->frame_h = relative_allocation.height; - child_allocation.x = priv->frame_x + xthickness; - child_allocation.y = priv->frame_y + ythickness; - possible_new_size = priv->frame_w - 2 * xthickness; + child_allocation.x = details->frame_x + xthickness; + child_allocation.y = details->frame_y + ythickness; + possible_new_size = details->frame_w - 2 * xthickness; child_allocation.width = MAX(1, possible_new_size); - possible_new_size = priv->frame_h - 2 * ythickness; + possible_new_size = details->frame_h - 2 * ythickness; child_allocation.height = MAX(1, possible_new_size); - previous_hvis = priv->hsb_visible; - previous_vvis = priv->vsb_visible; + previous_hvis = details->hsb_visible; + previous_vvis = details->vsb_visible; gtk_widget_size_allocate (bin->child, &child_allocation); @@ -713,10 +705,10 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) * vscrollbar flip visiblity, then we need both. */ if (count - && previous_hvis != priv->hsb_visible - && previous_vvis != priv->vsb_visible) { - priv->hsb_visible = TRUE; - priv->vsb_visible = TRUE; + && previous_hvis != details->hsb_visible + && previous_vvis != details->vsb_visible) { + details->hsb_visible = TRUE; + details->vsb_visible = TRUE; /* a new resize is already queued at this point, * so we will immediatedly get reinvoked @@ -725,26 +717,26 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) } count++; - } while (previous_hvis != priv->hsb_visible - || previous_vvis != priv->vsb_visible); + } while (previous_hvis != details->hsb_visible + || previous_vvis != details->vsb_visible); } else compute_relative_allocation (widget, &relative_allocation); - if (priv->hsb_visible) { + if (details->hsb_visible) { GtkRequisition hscrollbar_requisition; - gtk_widget_get_child_requisition (priv->hsb, &hscrollbar_requisition); + gtk_widget_get_child_requisition (details->hsb, &hscrollbar_requisition); - if (!GTK_WIDGET_VISIBLE (priv->hsb)) - gtk_widget_show (priv->hsb); + if (!GTK_WIDGET_VISIBLE (details->hsb)) + gtk_widget_show (details->hsb); child_allocation.x = relative_allocation.x; - if (priv->frame_placement == GTK_CORNER_TOP_LEFT - || priv->frame_placement == GTK_CORNER_TOP_RIGHT) + if (details->frame_placement == GTK_CORNER_TOP_LEFT + || details->frame_placement == GTK_CORNER_TOP_RIGHT) child_allocation.y = (relative_allocation.y #if 0 + relative_allocation.height - + priv->sb_spacing); + + details->sb_spacing); #else + relative_allocation.height); #endif @@ -756,23 +748,23 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) child_allocation.x += allocation->x; child_allocation.y += allocation->y; - gtk_widget_size_allocate (priv->hsb, &child_allocation); - } else if (GTK_WIDGET_VISIBLE (priv->hsb)) - gtk_widget_hide (priv->hsb); + gtk_widget_size_allocate (details->hsb, &child_allocation); + } else if (GTK_WIDGET_VISIBLE (details->hsb)) + gtk_widget_hide (details->hsb); - if (priv->vsb_visible) { + if (details->vsb_visible) { GtkRequisition vscrollbar_requisition; - if (!GTK_WIDGET_VISIBLE (priv->vsb)) - gtk_widget_show (priv->vsb); + if (!GTK_WIDGET_VISIBLE (details->vsb)) + gtk_widget_show (details->vsb); - gtk_widget_get_child_requisition (priv->vsb, &vscrollbar_requisition); + gtk_widget_get_child_requisition (details->vsb, &vscrollbar_requisition); - if (priv->frame_placement == GTK_CORNER_TOP_LEFT - || priv->frame_placement == GTK_CORNER_BOTTOM_LEFT) + if (details->frame_placement == GTK_CORNER_TOP_LEFT + || details->frame_placement == GTK_CORNER_BOTTOM_LEFT) child_allocation.x = (relative_allocation.x + relative_allocation.width - + priv->sb_spacing); + + details->sb_spacing); else child_allocation.x = GTK_CONTAINER (sf)->border_width; @@ -782,22 +774,21 @@ gtk_scroll_frame_size_allocate (GtkWidget *widget, GtkAllocation *allocation) child_allocation.x += allocation->x; child_allocation.y += allocation->y; - gtk_widget_size_allocate (priv->vsb, &child_allocation); - } else if (GTK_WIDGET_VISIBLE (priv->vsb)) - gtk_widget_hide (priv->vsb); + gtk_widget_size_allocate (details->vsb, &child_allocation); + } else if (GTK_WIDGET_VISIBLE (details->vsb)) + gtk_widget_hide (details->vsb); } /* Expose handler for the scroll frame widget */ static gint -gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) +nautilus_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) { - GtkScrollFrame *sf; + NautilusScrollFrame *sf; - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_SCROLL_FRAME (widget), FALSE); + g_return_val_if_fail (NAUTILUS_IS_SCROLL_FRAME (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); - sf = GTK_SCROLL_FRAME (widget); + sf = NAUTILUS_SCROLL_FRAME (widget); if (GTK_WIDGET_DRAWABLE (widget)) draw_shadow (sf, &event->area); @@ -810,14 +801,14 @@ gtk_scroll_frame_expose (GtkWidget *widget, GdkEventExpose *event) /* Add handler for the scroll frame widget */ static void -gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child) +nautilus_scroll_frame_add (GtkContainer *container, GtkWidget *child) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; GtkBin *bin; - sf = GTK_SCROLL_FRAME (container); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (container); + details = sf->details; bin = GTK_BIN (container); g_return_if_fail (bin->child == NULL); @@ -826,10 +817,10 @@ gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child) /* this is a temporary message */ if (!gtk_widget_set_scroll_adjustments (child, - gtk_range_get_adjustment (GTK_RANGE (priv->hsb)), - gtk_range_get_adjustment (GTK_RANGE (priv->vsb)))) - g_warning ("gtk_scroll_frame_add(): cannot add non scrollable widget " - "use gtk_scroll_frame_add_with_viewport() instead"); + gtk_range_get_adjustment (GTK_RANGE (details->hsb)), + gtk_range_get_adjustment (GTK_RANGE (details->vsb)))) + g_warning ("nautilus_scroll_frame_add(): cannot add non scrollable widget " + "use nautilus_scroll_frame_add_with_viewport() instead"); if (GTK_WIDGET_REALIZED (child->parent)) gtk_widget_realize (child); @@ -844,10 +835,9 @@ gtk_scroll_frame_add (GtkContainer *container, GtkWidget *child) /* Remove method for the scroll frame widget */ static void -gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child) +nautilus_scroll_frame_remove (GtkContainer *container, GtkWidget *child) { - g_return_if_fail (container != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (container)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (container)); g_return_if_fail (child != NULL); g_return_if_fail (GTK_BIN (container)->child == child); @@ -859,7 +849,7 @@ gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child) } /** - * gtk_scroll_frame_new: + * nautilus_scroll_frame_new: * @hadj: If non-NULL, the adjustment to use for horizontal scrolling. * @vadj: If non-NULL, the adjustment to use for vertical scrolling. * @@ -868,7 +858,7 @@ gtk_scroll_frame_remove (GtkContainer *container, GtkWidget *child) * Return value: The newly-created scroll frame widget. **/ GtkWidget * -gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) +nautilus_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) { if (hadj) g_return_val_if_fail (GTK_IS_ADJUSTMENT (hadj), NULL); @@ -876,7 +866,7 @@ gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) if (vadj) g_return_val_if_fail (GTK_IS_ADJUSTMENT (vadj), NULL); - return gtk_widget_new (GTK_TYPE_SCROLL_FRAME, + return gtk_widget_new (NAUTILUS_TYPE_SCROLL_FRAME, "hadjustment", hadj, "vadjustment", vadj, NULL); @@ -886,39 +876,38 @@ gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj) static void adjustment_changed (GtkAdjustment *adj, gpointer data) { - GtkScrollFrame *sf; - ScrollFramePrivate *priv; + NautilusScrollFrame *sf; + NautilusScrollFrameDetails *details; - g_return_if_fail (adj != NULL); g_return_if_fail (GTK_IS_ADJUSTMENT (adj)); g_return_if_fail (data != NULL); - sf = GTK_SCROLL_FRAME (data); - priv = sf->priv; + sf = NAUTILUS_SCROLL_FRAME (data); + details = sf->details; - if (adj == gtk_range_get_adjustment (GTK_RANGE (priv->hsb))) { - if (priv->hsb_policy == GTK_POLICY_AUTOMATIC) { + if (adj == gtk_range_get_adjustment (GTK_RANGE (details->hsb))) { + if (details->hsb_policy == GTK_POLICY_AUTOMATIC) { gboolean visible; - visible = priv->hsb_visible; - priv->hsb_visible = (adj->upper - adj->lower > adj->page_size); - if (priv->hsb_visible != visible) + visible = details->hsb_visible; + details->hsb_visible = (adj->upper - adj->lower > adj->page_size); + if (details->hsb_visible != visible) gtk_widget_queue_resize (GTK_WIDGET (sf)); } - } else if (adj == gtk_range_get_adjustment (GTK_RANGE (priv->vsb))) { - if (priv->vsb_policy == GTK_POLICY_AUTOMATIC) { + } else if (adj == gtk_range_get_adjustment (GTK_RANGE (details->vsb))) { + if (details->vsb_policy == GTK_POLICY_AUTOMATIC) { gboolean visible; - visible = priv->vsb_visible; - priv->vsb_visible = (adj->upper - adj->lower > adj->page_size); - if (priv->vsb_visible != visible) + visible = details->vsb_visible; + details->vsb_visible = (adj->upper - adj->lower > adj->page_size); + if (details->vsb_visible != visible) gtk_widget_queue_resize (GTK_WIDGET (sf)); } } } /** - * gtk_scroll_frame_set_hadjustment: + * nautilus_scroll_frame_set_hadjustment: * @sf: A scroll frame widget. * @adj: An adjustment. * @@ -926,43 +915,42 @@ adjustment_changed (GtkAdjustment *adj, gpointer data) * widget. **/ void -gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) +nautilus_scroll_frame_set_hadjustment (NautilusScrollFrame *sf, GtkAdjustment *adj) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; if (adj) g_return_if_fail (GTK_IS_ADJUSTMENT (adj)); else adj = GTK_ADJUSTMENT (gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL)); - if (!priv->hsb) { + if (!details->hsb) { gtk_widget_push_composite_child (); - priv->hsb = gtk_hscrollbar_new (adj); - gtk_widget_set_composite_name (priv->hsb, "hscrollbar"); + details->hsb = gtk_hscrollbar_new (adj); + gtk_widget_set_composite_name (details->hsb, "hscrollbar"); gtk_widget_pop_composite_child (); - gtk_widget_set_parent (priv->hsb, GTK_WIDGET (sf)); - gtk_widget_ref (priv->hsb); - gtk_widget_show (priv->hsb); + gtk_widget_set_parent (details->hsb, GTK_WIDGET (sf)); + gtk_widget_ref (details->hsb); + gtk_widget_show (details->hsb); } else { GtkAdjustment *old_adj; - old_adj = gtk_range_get_adjustment (GTK_RANGE (priv->hsb)); + old_adj = gtk_range_get_adjustment (GTK_RANGE (details->hsb)); if (old_adj == adj) return; gtk_signal_disconnect_by_func (GTK_OBJECT (old_adj), GTK_SIGNAL_FUNC (adjustment_changed), sf); - gtk_range_set_adjustment (GTK_RANGE (priv->hsb), adj); + gtk_range_set_adjustment (GTK_RANGE (details->hsb), adj); } - adj = gtk_range_get_adjustment (GTK_RANGE (priv->hsb)); + adj = gtk_range_get_adjustment (GTK_RANGE (details->hsb)); gtk_signal_connect (GTK_OBJECT (adj), "changed", GTK_SIGNAL_FUNC (adjustment_changed), @@ -972,12 +960,12 @@ gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) if (GTK_BIN (sf)->child) gtk_widget_set_scroll_adjustments ( GTK_BIN (sf)->child, - gtk_range_get_adjustment (GTK_RANGE (priv->hsb)), - gtk_range_get_adjustment (GTK_RANGE (priv->vsb))); + gtk_range_get_adjustment (GTK_RANGE (details->hsb)), + gtk_range_get_adjustment (GTK_RANGE (details->vsb))); } /** - * gtk_scroll_frame_set_vadjustment: + * nautilus_scroll_frame_set_vadjustment: * @sf: A scroll frame widget. * @adj: An adjustment. * @@ -985,43 +973,42 @@ gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) * widget. **/ void -gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) +nautilus_scroll_frame_set_vadjustment (NautilusScrollFrame *sf, GtkAdjustment *adj) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; if (adj) g_return_if_fail (GTK_IS_ADJUSTMENT (adj)); else adj = GTK_ADJUSTMENT (gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL)); - if (!priv->vsb) { + if (!details->vsb) { gtk_widget_push_composite_child (); - priv->vsb = gtk_vscrollbar_new (adj); - gtk_widget_set_composite_name (priv->vsb, "vscrollbar"); + details->vsb = gtk_vscrollbar_new (adj); + gtk_widget_set_composite_name (details->vsb, "vscrollbar"); gtk_widget_pop_composite_child (); - gtk_widget_set_parent (priv->vsb, GTK_WIDGET (sf)); - gtk_widget_ref (priv->vsb); - gtk_widget_show (priv->vsb); + gtk_widget_set_parent (details->vsb, GTK_WIDGET (sf)); + gtk_widget_ref (details->vsb); + gtk_widget_show (details->vsb); } else { GtkAdjustment *old_adj; - old_adj = gtk_range_get_adjustment (GTK_RANGE (priv->vsb)); + old_adj = gtk_range_get_adjustment (GTK_RANGE (details->vsb)); if (old_adj == adj) return; gtk_signal_disconnect_by_func (GTK_OBJECT (old_adj), GTK_SIGNAL_FUNC (adjustment_changed), sf); - gtk_range_set_adjustment (GTK_RANGE (priv->vsb), adj); + gtk_range_set_adjustment (GTK_RANGE (details->vsb), adj); } - adj = gtk_range_get_adjustment (GTK_RANGE (priv->vsb)); + adj = gtk_range_get_adjustment (GTK_RANGE (details->vsb)); gtk_signal_connect (GTK_OBJECT (adj), "changed", GTK_SIGNAL_FUNC (adjustment_changed), @@ -1031,12 +1018,12 @@ gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) if (GTK_BIN (sf)->child) gtk_widget_set_scroll_adjustments ( GTK_BIN (sf)->child, - gtk_range_get_adjustment (GTK_RANGE (priv->hsb)), - gtk_range_get_adjustment (GTK_RANGE (priv->vsb))); + gtk_range_get_adjustment (GTK_RANGE (details->hsb)), + gtk_range_get_adjustment (GTK_RANGE (details->vsb))); } /** - * gtk_scroll_frame_get_hadjustment: + * nautilus_scroll_frame_get_hadjustment: * @sf: A scroll frame widget. * * Queries the horizontal adjustment of a scroll frame widget. @@ -1044,20 +1031,19 @@ gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj) * Return value: The horizontal adjustment of the scroll frame, or NULL if none. **/ GtkAdjustment * -gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf) +nautilus_scroll_frame_get_hadjustment (NautilusScrollFrame *sf) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_val_if_fail (sf != NULL, NULL); - g_return_val_if_fail (GTK_IS_SCROLL_FRAME (sf), NULL); + g_return_val_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf), NULL); - priv = sf->priv; + details = sf->details; - return priv->hsb ? gtk_range_get_adjustment (GTK_RANGE (priv->hsb)) : NULL; + return details->hsb ? gtk_range_get_adjustment (GTK_RANGE (details->hsb)) : NULL; } /** - * gtk_scroll_frame_get_vadjustment: + * nautilus_scroll_frame_get_vadjustment: * @sf: A scroll frame widget. * * Queries the vertical adjustment of a scroll frame widget. @@ -1065,20 +1051,19 @@ gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf) * Return value: The vertical adjustment of the scroll frame, or NULL if none. **/ GtkAdjustment * -gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf) +nautilus_scroll_frame_get_vadjustment (NautilusScrollFrame *sf) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_val_if_fail (sf != NULL, NULL); - g_return_val_if_fail (GTK_IS_SCROLL_FRAME (sf), NULL); + g_return_val_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf), NULL); - priv = sf->priv; + details = sf->details; - return priv->vsb ? gtk_range_get_adjustment (GTK_RANGE (priv->vsb)) : NULL; + return details->vsb ? gtk_range_get_adjustment (GTK_RANGE (details->vsb)) : NULL; } /** - * gtk_scroll_frame_set_policy: + * nautilus_scroll_frame_set_policy: * @sf: A scroll frame widget. * @hsb_policy: Policy for the horizontal scrollbar. * @vsb_policy: Policy for the vertical scrollbar. @@ -1087,28 +1072,27 @@ gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf) * the scrollbars are to be shown or hidden. **/ void -gtk_scroll_frame_set_policy (GtkScrollFrame *sf, +nautilus_scroll_frame_set_policy (NautilusScrollFrame *sf, GtkPolicyType hsb_policy, GtkPolicyType vsb_policy) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; - if (priv->hsb_policy == hsb_policy && priv->vsb_policy == vsb_policy) + if (details->hsb_policy == hsb_policy && details->vsb_policy == vsb_policy) return; - priv->hsb_policy = hsb_policy; - priv->vsb_policy = vsb_policy; + details->hsb_policy = hsb_policy; + details->vsb_policy = vsb_policy; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_set_placement: + * nautilus_scroll_frame_set_placement: * @sf: A scroll frame widget. * @frame_placement: Placement for the frame. * @@ -1116,24 +1100,23 @@ gtk_scroll_frame_set_policy (GtkScrollFrame *sf, * scrollbars. **/ void -gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placement) +nautilus_scroll_frame_set_placement (NautilusScrollFrame *sf, GtkCornerType frame_placement) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; - if (priv->frame_placement == frame_placement) + if (details->frame_placement == frame_placement) return; - priv->frame_placement = frame_placement; + details->frame_placement = frame_placement; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_set_shadow_type: + * nautilus_scroll_frame_set_shadow_type: * @sf: A scroll frame widget. * @shadow_type: A shadow type. * @@ -1141,25 +1124,24 @@ gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placemen * insert a child that does not paint a frame on its own. **/ void -gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type) +nautilus_scroll_frame_set_shadow_type (NautilusScrollFrame *sf, GtkShadowType shadow_type) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); g_return_if_fail (shadow_type <= GTK_SHADOW_ETCHED_OUT); - priv = sf->priv; + details = sf->details; - if (priv->shadow_type == shadow_type) + if (details->shadow_type == shadow_type) return; - priv->shadow_type = shadow_type; + details->shadow_type = shadow_type; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_set_scrollbar_spacing: + * nautilus_scroll_frame_set_scrollbar_spacing: * @sf: A scroll frame widget. * @spacing: Desired spacing in pixels. * @@ -1167,24 +1149,23 @@ gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type) * widget. **/ void -gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing) +nautilus_scroll_frame_set_scrollbar_spacing (NautilusScrollFrame *sf, guint spacing) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); - priv = sf->priv; + details = sf->details; - if (priv->sb_spacing == spacing) + if (details->sb_spacing == spacing) return; - priv->sb_spacing = spacing; + details->sb_spacing = spacing; gtk_widget_queue_resize (GTK_WIDGET (sf)); } /** - * gtk_scroll_frame_add_with_viewport: + * nautilus_scroll_frame_add_with_viewport: * @sf: A scroll frame widget. * @child: A widget. * @@ -1193,19 +1174,17 @@ gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing) * used only when a child does not support the scrolling interface. **/ void -gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child) +nautilus_scroll_frame_add_with_viewport (NautilusScrollFrame *sf, GtkWidget *child) { - ScrollFramePrivate *priv; + NautilusScrollFrameDetails *details; GtkBin *bin; GtkWidget *viewport; - g_return_if_fail (sf != NULL); - g_return_if_fail (GTK_IS_SCROLL_FRAME (sf)); - g_return_if_fail (child != NULL); + g_return_if_fail (NAUTILUS_IS_SCROLL_FRAME (sf)); g_return_if_fail (GTK_IS_WIDGET (child)); g_return_if_fail (child->parent == NULL); - priv = sf->priv; + details = sf->details; bin = GTK_BIN (sf); if (bin->child != NULL) { @@ -1214,8 +1193,8 @@ gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child) viewport = bin->child; } else { - viewport = gtk_viewport_new (gtk_scroll_frame_get_hadjustment (sf), - gtk_scroll_frame_get_vadjustment (sf)); + viewport = gtk_viewport_new (nautilus_scroll_frame_get_hadjustment (sf), + nautilus_scroll_frame_get_vadjustment (sf)); gtk_container_add (GTK_CONTAINER (sf), viewport); } diff --git a/libnautilus-private/nautilus-scroll-frame.h b/libnautilus-private/nautilus-scroll-frame.h index 749417a8b..2807b24fd 100644 --- a/libnautilus-private/nautilus-scroll-frame.h +++ b/libnautilus-private/nautilus-scroll-frame.h @@ -25,70 +25,62 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#ifndef __GTK_SCROLL_FRAME_H__ -#define __GTK_SCROLL_FRAME_H__ +#ifndef GTK_SCROLL_FRAME_H +#define GTK_SCROLL_FRAME_H - -#include <gdk/gdk.h> #include <gtk/gtkbin.h> - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ - -#define GTK_TYPE_SCROLL_FRAME (gtk_scroll_frame_get_type ()) -#define GTK_SCROLL_FRAME(obj) (GTK_CHECK_CAST ((obj), \ - GTK_TYPE_SCROLL_FRAME, GtkScrollFrame)) -#define GTK_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \ - GTK_TYPE_SCROLL_FRAME, GtkScrollFrameClass)) -#define GTK_IS_SCROLL_FRAME(obj) (GTK_CHECK_TYPE ((obj), \ - GTK_TYPE_SCROLL_FRAME)) -#define GTK_IS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \ - GTK_TYPE_SCROLL_FRAME)) - - -typedef struct _GtkScrollFrame GtkScrollFrame; -typedef struct _GtkScrollFrameClass GtkScrollFrameClass; - -struct _GtkScrollFrame +#define NAUTILUS_TYPE_SCROLL_FRAME (nautilus_scroll_frame_get_type ()) +#define NAUTILUS_SCROLL_FRAME(obj) (GTK_CHECK_CAST ((obj), \ + NAUTILUS_TYPE_SCROLL_FRAME, NautilusScrollFrame)) +#define NAUTILUS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \ + NAUTILUS_TYPE_SCROLL_FRAME, NautilusScrollFrameClass)) +#define NAUTILUS_IS_SCROLL_FRAME(obj) (GTK_CHECK_TYPE ((obj), \ + NAUTILUS_TYPE_SCROLL_FRAME)) +#define NAUTILUS_IS_SCROLL_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \ + NAUTILUS_TYPE_SCROLL_FRAME)) + +typedef struct NautilusScrollFrame NautilusScrollFrame; +typedef struct NautilusScrollFrameClass NautilusScrollFrameClass; +typedef struct NautilusScrollFrameDetails NautilusScrollFrameDetails; + +struct NautilusScrollFrame { GtkBin bin; - - /* Private data */ - gpointer priv; + NautilusScrollFrameDetails *details; }; - -struct _GtkScrollFrameClass +struct NautilusScrollFrameClass { GtkBinClass parent_class; }; - -GtkType gtk_scroll_frame_get_type (void); -GtkWidget *gtk_scroll_frame_new (GtkAdjustment *hadj, GtkAdjustment *vadj); - -void gtk_scroll_frame_set_hadjustment (GtkScrollFrame *sf, GtkAdjustment *adj); -void gtk_scroll_frame_set_vadjustment (GtkScrollFrame *sf, GtkAdjustment *adj); - -GtkAdjustment *gtk_scroll_frame_get_hadjustment (GtkScrollFrame *sf); -GtkAdjustment *gtk_scroll_frame_get_vadjustment (GtkScrollFrame *sf); - -void gtk_scroll_frame_set_policy (GtkScrollFrame *sf, - GtkPolicyType hsb_policy, - GtkPolicyType vsb_policy); - -void gtk_scroll_frame_set_placement (GtkScrollFrame *sf, GtkCornerType frame_placement); -void gtk_scroll_frame_set_shadow_type (GtkScrollFrame *sf, GtkShadowType shadow_type); -void gtk_scroll_frame_set_scrollbar_spacing (GtkScrollFrame *sf, guint spacing); - -void gtk_scroll_frame_add_with_viewport (GtkScrollFrame *sf, GtkWidget *child); - +GtkType nautilus_scroll_frame_get_type (void); +GtkWidget * nautilus_scroll_frame_new (GtkAdjustment *h_adjustment, + GtkAdjustment *v_adjustment); +void nautilus_scroll_frame_set_hadjustment (NautilusScrollFrame *frame, + GtkAdjustment *adj); +void nautilus_scroll_frame_set_vadjustment (NautilusScrollFrame *frame, + GtkAdjustment *adj); +GtkAdjustment *nautilus_scroll_frame_get_hadjustment (NautilusScrollFrame *frame); +GtkAdjustment *nautilus_scroll_frame_get_vadjustment (NautilusScrollFrame *frame); +void nautilus_scroll_frame_set_policy (NautilusScrollFrame *frame, + GtkPolicyType h_scroll_policy, + GtkPolicyType v_scroll_policy); +void nautilus_scroll_frame_set_placement (NautilusScrollFrame *frame, + GtkCornerType frame_placement); +void nautilus_scroll_frame_set_shadow_type (NautilusScrollFrame *frame, + GtkShadowType shadow_type); +void nautilus_scroll_frame_set_scrollbar_spacing (NautilusScrollFrame *frame, + guint spacing); +void nautilus_scroll_frame_add_with_viewport (NautilusScrollFrame *frame, + GtkWidget *child); #ifdef __cplusplus } #endif /* __cplusplus */ - -#endif /* __GTK_SCROLL_FRAME_H__ */ +#endif /* GTK_SCROLL_FRAME_H */ diff --git a/libnautilus/nautilus-clipboard.c b/libnautilus/nautilus-clipboard.c index 8a5ebc667..551253624 100644 --- a/libnautilus/nautilus-clipboard.c +++ b/libnautilus/nautilus-clipboard.c @@ -1,5 +1,7 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + /* nautilus-clipboard.c + * * Nautilus Clipboard support. For now, routines to support component cut * and paste. * @@ -21,329 +23,160 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * - * Author: Rebecca Schulman <rebecka@eazel.com> + * Authors: Rebecca Schulman <rebecka@eazel.com>, + * Darin Adler <darin@eazel.com> */ -#include <config.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkwidget.h> -#include <gtk/gtkeditable.h> -#include <gtk/gtkscrolledwindow.h> -#include <gnome.h> -#include <bonobo/bonobo-control.h> +#include <config.h> #include "nautilus-clipboard.h" - -#define MENU_PATH_CUT "/Edit/Cut" -#define MENU_PATH_COPY "/Edit/Copy" -#define MENU_PATH_PASTE "/Edit/Paste" -#define MENU_PATH_CLEAR "/Edit/Clear" - - +#include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-stock.h> -#include <libnautilus-extensions/nautilus-gtk-macros.h> - - -/* forward declarations */ - -static void nautilus_clipboard_info_initialize_class (NautilusClipboardInfoClass *klass); -void nautilus_clipboard_info_initialize (NautilusClipboardInfo *info); -void nautilus_clipboard_info_destroy (NautilusClipboardInfo *info); - -void nautilus_clipboard_info_destroy_cb (GtkObject *object, gpointer user_data); - -NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusClipboardInfo, nautilus_clipboard_info, GTK_TYPE_SCROLLED_WINDOW) - -NautilusClipboardInfo* nautilus_clipboard_info_new (void); - -static BonoboControl * nautilus_clipboard_info_get_bonobo_control (NautilusClipboardInfo *info); -/* static BonoboUIHandler* nautilus_clipboard_info_get_bonobo_ui_handler (NautilusClipboardInfo *info); */ -static void nautilus_component_bonobo_menu_cut_cb (BonoboUIHandler *uihandler, - gpointer data, const char *path); -static void nautilus_component_bonobo_menu_copy_cb (BonoboUIHandler *uihandler, - gpointer data, const char *path); -static void nautilus_component_bonobo_menu_paste_cb (BonoboUIHandler *uihandler, - gpointer data, const char *path); -static void nautilus_component_bonobo_menu_clear_cb (BonoboUIHandler *uihandler, - gpointer data, const char *path); - -struct NautilusClipboardDetails { - char *component_name; - GtkWidget *clipboard_owner; - NautilusView *view; -}; - - - -NautilusClipboardInfo* -nautilus_clipboard_info_new () -{ - return NAUTILUS_CLIPBOARD_INFO (gtk_type_new (nautilus_clipboard_info_get_type ())); -} - - - -void -nautilus_clipboard_info_initialize (NautilusClipboardInfo *info) -{ - - info->details = g_new0 (NautilusClipboardDetails, 1); - info->details->component_name = NULL; - info->details->clipboard_owner = NULL; - info->details->view = NULL; -} - - - - +#include "nautilus-bonobo-ui.h" static void -nautilus_clipboard_info_initialize_class (NautilusClipboardInfoClass *klass) +cut_callback (BonoboUIHandler *ui_handler, + gpointer callback_data, + const char *path) { + g_assert (BONOBO_IS_UI_HANDLER (ui_handler)); + g_assert (strcmp (path, NAUTILUS_MENU_PATH_CUT_ITEM) == 0); - klass->destroy = nautilus_clipboard_info_destroy; - -} - - -void -nautilus_clipboard_info_destroy (NautilusClipboardInfo *info) -{ - - g_free (info->details->component_name); - gtk_widget_unref (info->details->clipboard_owner); - - if (info->details->view != NULL) { - bonobo_object_unref (BONOBO_OBJECT (info->details->view)); - } - - g_free (info->details); - - NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (GTK_OBJECT (info))); -} - -void -nautilus_clipboard_info_destroy_cb (GtkObject *object, gpointer user_data) -{ - NautilusClipboardInfo *view; - - g_assert (NAUTILUS_IS_CLIPBOARD_INFO (user_data)); - view = NAUTILUS_CLIPBOARD_INFO (user_data); - - nautilus_clipboard_info_destroy (view); - -} - - -void -nautilus_clipboard_info_set_component_name (NautilusClipboardInfo *info, char *component_name) -{ - info->details->component_name = g_strdup(component_name); -} - -char* -nautilus_clipboard_info_get_component_name (NautilusClipboardInfo *info) -{ - - return info->details->component_name; -} - - - -void -nautilus_clipboard_info_set_clipboard_owner (NautilusClipboardInfo *info, GtkWidget *clipboard_owner) -{ - g_assert (GTK_IS_EDITABLE (clipboard_owner)); - info->details->clipboard_owner = clipboard_owner; - gtk_widget_ref (clipboard_owner); -} - -GtkWidget * -nautilus_clipboard_info_get_clipboard_owner (NautilusClipboardInfo *info) -{ - return info->details->clipboard_owner; + gtk_editable_cut_clipboard (GTK_EDITABLE (callback_data)); } -void -nautilus_clipboard_info_set_view (NautilusClipboardInfo *info, NautilusView *view) +static void +copy_callback (BonoboUIHandler *ui_handler, + gpointer callback_data, + const char *path) { - g_return_if_fail (info != NULL); - g_return_if_fail (NAUTILUS_CLIPBOARD_INFO (info)); - g_return_if_fail (view != NULL); - g_return_if_fail (NAUTILUS_IS_VIEW (view)); - - bonobo_object_ref (BONOBO_OBJECT (view)); + g_assert (BONOBO_IS_UI_HANDLER (ui_handler)); + g_assert (strcmp (path, NAUTILUS_MENU_PATH_COPY_ITEM) == 0); - info->details->view = view; - -} - -NautilusView * -nautilus_clipboard_info_get_view (NautilusClipboardInfo *info) -{ - return info->details->view; + gtk_editable_copy_clipboard (GTK_EDITABLE (callback_data)); } - -/* -static BonoboUIHandler * -nautilus_clipboard_info_get_bonobo_ui_handler (NautilusClipboardInfo *info) -{ - return bonobo_control_get_ui_handler (nautilus_clipboard_info_get_bonobo_control (info)); -} -*/ - -static BonoboControl * -nautilus_clipboard_info_get_bonobo_control (NautilusClipboardInfo *info) -{ - return nautilus_view_get_bonobo_control (info->details->view); -} - - -void -nautilus_component_merge_bonobo_items_cb (GtkWidget *widget, GdkEventAny *event, gpointer user_data) +static void +paste_callback (BonoboUIHandler *ui_handler, + gpointer callback_data, + const char *path) { - NautilusClipboardInfo *info; - BonoboUIHandler *local_ui_handler; - - - g_assert (NAUTILUS_IS_CLIPBOARD_INFO(user_data)); - info = NAUTILUS_CLIPBOARD_INFO(user_data); - g_assert (BONOBO_IS_CONTROL (nautilus_clipboard_info_get_bonobo_control (info))); - - local_ui_handler = bonobo_control_get_ui_handler (nautilus_clipboard_info_get_bonobo_control (info)); - - bonobo_ui_handler_set_container (local_ui_handler, - bonobo_control_get_remote_ui_handler (nautilus_clipboard_info_get_bonobo_control (info))); + g_assert (BONOBO_IS_UI_HANDLER (ui_handler)); + g_assert (strcmp (path, NAUTILUS_MENU_PATH_PASTE_ITEM) == 0); - bonobo_ui_handler_menu_new_item (local_ui_handler, - MENU_PATH_CUT, - _("_Cut"), - _("Remove selected text from selection"), - bonobo_ui_handler_menu_get_pos (local_ui_handler , MENU_PATH_CUT), - BONOBO_UI_HANDLER_PIXMAP_NONE, - NULL, - 0, - 0, - nautilus_component_bonobo_menu_cut_cb, - info); - bonobo_ui_handler_menu_new_item (local_ui_handler, - MENU_PATH_COPY, - _("_Copy"), - _("Copy selected text to the clipboard"), - bonobo_ui_handler_menu_get_pos (local_ui_handler , MENU_PATH_COPY), - BONOBO_UI_HANDLER_PIXMAP_NONE, - NULL, - 0, - 0, - nautilus_component_bonobo_menu_copy_cb, - info); - bonobo_ui_handler_menu_new_item (local_ui_handler, - MENU_PATH_PASTE, - _("_Paste"), - _("Paste text from clipboard into text box"), - bonobo_ui_handler_menu_get_pos (local_ui_handler , MENU_PATH_PASTE), - BONOBO_UI_HANDLER_PIXMAP_NONE, - NULL, - 0, - 0, - nautilus_component_bonobo_menu_paste_cb, - info); - bonobo_ui_handler_menu_new_item (local_ui_handler, - MENU_PATH_CLEAR, - _("_Clear"), - _("Clear the current selection"), - bonobo_ui_handler_menu_get_pos (local_ui_handler , MENU_PATH_CLEAR), - BONOBO_UI_HANDLER_PIXMAP_NONE, - NULL, - 0, - 0, - nautilus_component_bonobo_menu_clear_cb, - info); - - + gtk_editable_paste_clipboard (GTK_EDITABLE (callback_data)); } - -void -nautilus_component_unmerge_bonobo_items_cb (GtkWidget *widget, GdkEventAny *event, gpointer user_data) +static void +clear_callback (BonoboUIHandler *ui_handler, + gpointer callback_data, + const char *path) { - NautilusClipboardInfo *info; - BonoboUIHandler *local_ui_handler; + g_assert (BONOBO_IS_UI_HANDLER (ui_handler)); + g_assert (strcmp (path, NAUTILUS_MENU_PATH_CLEAR_ITEM) == 0); - - g_assert (NAUTILUS_IS_CLIPBOARD_INFO(user_data)); - info = NAUTILUS_CLIPBOARD_INFO(user_data); - - g_assert (BONOBO_IS_CONTROL (nautilus_clipboard_info_get_bonobo_control (info))); - local_ui_handler = bonobo_control_get_ui_handler (nautilus_clipboard_info_get_bonobo_control (info)); - bonobo_ui_handler_unset_container (local_ui_handler); - - + /* A negative index deletes until the end of the string */ + gtk_editable_delete_text (GTK_EDITABLE (callback_data), 0, -1); } static void -nautilus_component_bonobo_menu_cut_cb (BonoboUIHandler *uihandler, - gpointer data, const char *path) +add_menu_item (BonoboUIHandler *ui_handler, + const char *path, + const char *title, + const char *description, + BonoboUIHandlerCallbackFunc callback, + gpointer callback_data) { - NautilusClipboardInfo *info; - - g_assert (NAUTILUS_IS_CLIPBOARD_INFO (data)); - info = NAUTILUS_CLIPBOARD_INFO (data); - - g_assert (GTK_IS_EDITABLE (nautilus_clipboard_info_get_clipboard_owner (info))); - gtk_editable_cut_clipboard (GTK_EDITABLE (nautilus_clipboard_info_get_clipboard_owner (info))); - + bonobo_ui_handler_menu_new_item + (ui_handler, path, title, description, + bonobo_ui_handler_menu_get_pos (ui_handler, path), + BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, 0, 0, + callback, callback_data); } - - static void -nautilus_component_bonobo_menu_copy_cb (BonoboUIHandler *uihandler, - gpointer data, const char *path) +add_menu_items_callback (GtkWidget *widget, + GdkEventAny *event, + gpointer callback_data) { - NautilusClipboardInfo *info; - - g_assert (NAUTILUS_IS_CLIPBOARD_INFO (data)); - info = NAUTILUS_CLIPBOARD_INFO (data); - - g_assert (GTK_IS_EDITABLE (nautilus_clipboard_info_get_clipboard_owner (info))); - gtk_editable_copy_clipboard (GTK_EDITABLE (nautilus_clipboard_info_get_clipboard_owner (info))); + BonoboUIHandler *ui_handler; + g_assert (GTK_IS_EDITABLE (widget)); + + ui_handler = bonobo_control_get_ui_handler (BONOBO_CONTROL (callback_data)); + + /* I wish I understsood better why we have to do this. */ + /* FIXME: Doesn't the remote UI handler leak here? */ + bonobo_ui_handler_set_container + (ui_handler, + bonobo_control_get_remote_ui_handler (BONOBO_CONTROL (callback_data))); + + /* FIXME: We never mark any of these items insensitive. */ + add_menu_item (ui_handler, + NAUTILUS_MENU_PATH_CUT_ITEM, + _("_Cut"), + _("Remove selected text from selection"), + cut_callback, widget); + add_menu_item (ui_handler, + NAUTILUS_MENU_PATH_COPY_ITEM, + _("_Copy"), + _("Copy selected text to the clipboard"), + copy_callback, widget); + add_menu_item (ui_handler, + NAUTILUS_MENU_PATH_PASTE_ITEM, + _("_Paste"), + _("Paste text from clipboard into text box"), + paste_callback, widget); + add_menu_item (ui_handler, + NAUTILUS_MENU_PATH_CLEAR_ITEM, + _("_Clear"), + _("Clear the current selection"), + clear_callback, widget); } - static void -nautilus_component_bonobo_menu_paste_cb (BonoboUIHandler *uihandler, - gpointer data, const char *path) +remove_menu_items_callback (GtkWidget *widget, + GdkEventAny *event, + gpointer callback_data) { - NautilusClipboardInfo *info; - - g_assert (NAUTILUS_IS_CLIPBOARD_INFO (data)); - info = NAUTILUS_CLIPBOARD_INFO (data); - - g_assert (GTK_IS_EDITABLE (nautilus_clipboard_info_get_clipboard_owner (info))); - gtk_editable_paste_clipboard (GTK_EDITABLE (nautilus_clipboard_info_get_clipboard_owner (info))); + BonoboUIHandler *ui_handler; + g_assert (GTK_IS_EDITABLE (widget)); + ui_handler = bonobo_control_get_ui_handler (BONOBO_CONTROL (callback_data)); + bonobo_ui_handler_menu_remove (ui_handler, + NAUTILUS_MENU_PATH_CUT_ITEM); + bonobo_ui_handler_menu_remove (ui_handler, + NAUTILUS_MENU_PATH_COPY_ITEM); + bonobo_ui_handler_menu_remove (ui_handler, + NAUTILUS_MENU_PATH_PASTE_ITEM); + bonobo_ui_handler_menu_remove (ui_handler, + NAUTILUS_MENU_PATH_CLEAR_ITEM); } - - -static void -nautilus_component_bonobo_menu_clear_cb (BonoboUIHandler *uihandler, - gpointer data, const char *path) -{ - NautilusClipboardInfo *info; - - g_assert (NAUTILUS_IS_CLIPBOARD_INFO (data)); - info = NAUTILUS_CLIPBOARD_INFO (data); - - g_assert (GTK_IS_EDITABLE (nautilus_clipboard_info_get_clipboard_owner (info))); - /* A negative index deletes until the end of the string */ - gtk_editable_delete_text (GTK_EDITABLE (nautilus_clipboard_info_get_clipboard_owner (info)), - 0, -1); - +void +nautilus_clipboard_set_up_editable (GtkEditable *target, + BonoboControl *control) +{ + g_return_if_fail (GTK_IS_EDITABLE (target)); + g_return_if_fail (BONOBO_IS_CONTROL (control)); + + /* Attach code to add menus when it gets the focus. */ + bonobo_object_ref (BONOBO_OBJECT (control)); + gtk_signal_connect_full + (GTK_OBJECT (target), "focus_in_event", + GTK_SIGNAL_FUNC (add_menu_items_callback), + NULL, control, + (GtkDestroyNotify) bonobo_object_unref, + FALSE, FALSE); + + /* Attach code to remove menus when it loses the focus. */ + bonobo_object_ref (BONOBO_OBJECT (control)); + gtk_signal_connect_full + (GTK_OBJECT (target), "focus_out_event", + GTK_SIGNAL_FUNC (remove_menu_items_callback), + NULL, control, + (GtkDestroyNotify) bonobo_object_unref, + FALSE, FALSE); } diff --git a/libnautilus/nautilus-clipboard.h b/libnautilus/nautilus-clipboard.h index cc7623851..2f29b502b 100644 --- a/libnautilus/nautilus-clipboard.h +++ b/libnautilus/nautilus-clipboard.h @@ -22,67 +22,13 @@ * Author: Rebecca Schulman <rebecka@eazel.com> */ +#ifndef NAUTILUS_CLIPBOARD_H +#define NAUTILUS_CLIPBOARD_H -#ifndef NAUTILUS_CLIPBOARD_INFO_H -#define NAUTILUS_CLIPBOARD_INFO_H +#include <gtk/gtkeditable.h> +#include <bonobo/bonobo-control.h> - - -#include <gtk/gtkscrolledwindow.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-stock.h> -#include <libnautilus-extensions/nautilus-gtk-macros.h> -#include <libnautilus/nautilus-view-frame.h> - - - -typedef struct NautilusClipboardInfo NautilusClipboardInfo; -typedef struct NautilusClipboardInfoClass NautilusClipboardInfoClass; - - -#define NAUTILUS_TYPE_CLIPBOARD_INFO (nautilus_clipboard_info_get_type ()) -#define NAUTILUS_CLIPBOARD_INFO(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_CLIPBOARD_INFO, NautilusClipboardInfo)) -#define NAUTILUS_CLIPBOARD_INFO_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_CLIPBOARD_INFO, NautilusClipboardInfoClass)) -#define NAUTILUS_IS_CLIPBOARD_INFO(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_CLIPBOARD_INFO)) -#define NAUTILUS_IS_CLIPBOARD_INFO_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_CLIPBOARD_INFO)) - - -typedef struct NautilusClipboardDetails NautilusClipboardDetails; - - - -struct NautilusClipboardInfo { - GtkScrolledWindow parent; - NautilusClipboardDetails *details; -}; - -struct NautilusClipboardInfoClass { - GtkScrolledWindowClass parent_class; - void (* destroy) (NautilusClipboardInfo *info); -}; - -/* GtkObject support */ -GtkType nautilus_clipboard_info_get_type (void); -void nautilus_clipboard_info_initialize (NautilusClipboardInfo *info); -void nautilus_clipboard_info_destroy (NautilusClipboardInfo *info); -void nautilus_clipboard_info_destroy_cb (GtkObject *object, - gpointer user_data); -NautilusClipboardInfo *nautilus_clipboard_info_new (void); -void nautilus_clipboard_info_set_component_name (NautilusClipboardInfo *info, - char *component_name); -char * nautilus_clipboard_info_get_component_name (NautilusClipboardInfo *info); -void nautilus_clipboard_info_set_clipboard_owner (NautilusClipboardInfo *info, - GtkWidget *clipboard_owner); -GtkWidget * nautilus_clipboard_info_get_clipboard_owner (NautilusClipboardInfo *info); -void nautilus_clipboard_info_set_view (NautilusClipboardInfo *info, - NautilusView *view); -NautilusView * nautilus_clipboard_info_get_view (NautilusClipboardInfo *info); -void nautilus_clipboard_info_free (NautilusClipboardInfo *info); -void nautilus_component_merge_bonobo_items_cb (GtkWidget *widget, - GdkEventAny *event, - gpointer user_data); -void nautilus_component_unmerge_bonobo_items_cb (GtkWidget *widget, - GdkEventAny *event, - gpointer user_data); +void nautilus_clipboard_set_up_editable (GtkEditable *target, + BonoboControl *control); #endif diff --git a/nautilus-widgets/nautilus-preferences-item.c b/nautilus-widgets/nautilus-preferences-item.c index 9808891c4..25d57b14f 100644 --- a/nautilus-widgets/nautilus-preferences-item.c +++ b/nautilus-widgets/nautilus-preferences-item.c @@ -78,10 +78,10 @@ static void preferences_item_create_enum (NautilusPreferencesItem const NautilusPreference *prefrence); static void preferences_item_create_boolean (NautilusPreferencesItem *item, const NautilusPreference *prefrence); -static void enum_radio_group_changed_cb (GtkWidget *button_group, +static void enum_radio_group_changed_callback (GtkWidget *button_group, GtkWidget *button, gpointer user_data); -static void boolean_button_toggled_cb (GtkWidget *button_group, +static void boolean_button_toggled_callback (GtkWidget *button_group, gpointer user_data); NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesItem, nautilus_preferences_item, GTK_TYPE_VBOX) @@ -309,7 +309,7 @@ preferences_item_create_enum (NautilusPreferencesItem *item, gtk_signal_connect (GTK_OBJECT (item->details->child), "changed", - GTK_SIGNAL_FUNC (enum_radio_group_changed_cb), + GTK_SIGNAL_FUNC (enum_radio_group_changed_callback), (gpointer) item); } @@ -338,7 +338,7 @@ preferences_item_create_boolean (NautilusPreferencesItem *item, gtk_signal_connect (GTK_OBJECT (item->details->child), "toggled", - GTK_SIGNAL_FUNC (boolean_button_toggled_cb), + GTK_SIGNAL_FUNC (boolean_button_toggled_callback), (gpointer) item); } @@ -362,7 +362,7 @@ nautilus_preferences_item_new (const gchar *preference_name, } static void -enum_radio_group_changed_cb (GtkWidget *buttons, GtkWidget * button, gpointer user_data) +enum_radio_group_changed_callback (GtkWidget *buttons, GtkWidget * button, gpointer user_data) { NautilusPreferencesItem *item = (NautilusPreferencesItem *) user_data; const NautilusPreference *preference; @@ -380,7 +380,7 @@ enum_radio_group_changed_cb (GtkWidget *buttons, GtkWidget * button, gpointer us } static void -boolean_button_toggled_cb (GtkWidget *button, gpointer user_data) +boolean_button_toggled_callback (GtkWidget *button, gpointer user_data) { NautilusPreferencesItem *item = (NautilusPreferencesItem *) user_data; gboolean active_state; diff --git a/src/file-manager/Makefile.am b/src/file-manager/Makefile.am index 194b186b6..01785174f 100644 --- a/src/file-manager/Makefile.am +++ b/src/file-manager/Makefile.am @@ -36,30 +36,6 @@ libntl_file_manager_la_SOURCES= \ fm-properties-window.c \ fm-properties-window.h -# noinst_PROGRAMS=gnome-desktop - -# gnome_desktop_SOURCES= \ -# desktop-canvas.c \ -# desktop-canvas.h \ -# desktop-item.c \ -# desktop-item.h \ -# desktop-layout.h \ -# desktop-layout.c \ -# desktop-menu.h \ -# desktop-menu.c \ -# desktop-window.c \ -# desktop-window.h \ -# fm-directory-list.h \ -# fm-directory-list.c \ -# gnome-desktop.c - -# gnome_desktop_LDADD=\ -# $(BONOBO_LIBS) \ -# $(OAF_LIBS) \ -# $(GNOMEUI_LIBS) \ -# $(GDK_PIXBUF_LIBS) \ -# $(VFS_LIBS) - dfos-corba.h: GNOME_Desktop_FileOperationService.h $(dfos_corba_srcs): dfos_corba_stamp diff --git a/src/file-manager/desktop-canvas.c b/src/file-manager/desktop-canvas.c deleted file mode 100644 index 043948605..000000000 --- a/src/file-manager/desktop-canvas.c +++ /dev/null @@ -1,630 +0,0 @@ -/* -*- Mode: C; c-set-style: linux; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * Desktop component of GNOME file manager - * - * Copyright (C) 1999, 2000 Red Hat Inc., Free Software Foundation - * (based on Midnight Commander code by Federico Mena Quintero and Miguel de Icaza) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#include <config.h> -#include "desktop-canvas.h" -#include <gnome.h> -#include <gtk/gtk.h> -#include "desktop-menu.h" -#include "fm-icon-cache.h" -#include "desktop-item.h" - -static void desktop_canvas_class_init (DesktopCanvasClass *class); -static void desktop_canvas_init (DesktopCanvas *dcanvas); -static void desktop_canvas_realize (GtkWidget *widget); -static void desktop_canvas_size_allocate(GtkWidget *widget, - GtkAllocation *allocation); - -static void desktop_canvas_destroy (GtkObject *object); -static void desktop_canvas_finalize (GtkObject *object); - -static GnomeCanvasClass *parent_class; - - -/** - * desktop_canvas_get_type - * - * Returns the Gtk type assigned to the DesktopCanvas class. - */ -GtkType -desktop_canvas_get_type (void) -{ - static GtkType desktop_canvas_type = 0; - - if (!desktop_canvas_type) { - GtkTypeInfo desktop_canvas_info = { - "DesktopCanvas", - sizeof (DesktopCanvas), - sizeof (DesktopCanvasClass), - (GtkClassInitFunc) desktop_canvas_class_init, - (GtkObjectInitFunc) desktop_canvas_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - desktop_canvas_type = gtk_type_unique (gnome_canvas_get_type (), &desktop_canvas_info); - } - - return desktop_canvas_type; -} - -static void -desktop_canvas_class_init (DesktopCanvasClass *class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - object_class = (GtkObjectClass *) class; - widget_class = (GtkWidgetClass *) class; - - parent_class = gtk_type_class (gnome_canvas_get_type ()); - - object_class->destroy = desktop_canvas_destroy; - object_class->finalize = desktop_canvas_finalize; - - widget_class->realize = desktop_canvas_realize; - widget_class->size_allocate = desktop_canvas_size_allocate; -} - -static void -desktop_canvas_init (DesktopCanvas *dcanvas) -{ - dcanvas->background_info = desktop_background_info_new(); - dcanvas->background_update_idle = 0; - - dcanvas->popup = desktop_menu_new(); - - /* the attachment holds a refcount and eventually destroys - the popup */ - gnome_popup_menu_attach(dcanvas->popup, GTK_WIDGET(dcanvas), NULL); - - dcanvas->layout = desktop_layout_new(); - - dcanvas->desktop_dir_list = NULL; - dcanvas->entries_loaded_id = 0; - dcanvas->finished_load_id = 0; -} - -static void -desktop_canvas_destroy (GtkObject *object) -{ - DesktopCanvas *canvas; - - g_return_if_fail(object != NULL); - g_return_if_fail(DESKTOP_IS_CANVAS(object)); - - canvas = DESKTOP_CANVAS(object); - - if (canvas->background_update_idle != 0) { - gtk_idle_remove(canvas->background_update_idle); - canvas->background_update_idle = 0; - } - - if (canvas->desktop_dir_list != NULL) { - gtk_object_unref(GTK_OBJECT(canvas->desktop_dir_list)); - gtk_signal_disconnect(GTK_OBJECT(canvas->desktop_dir_list), - canvas->entries_loaded_id); - gtk_signal_disconnect(GTK_OBJECT(canvas->desktop_dir_list), - canvas->finished_load_id); - canvas->desktop_dir_list = NULL; - canvas->entries_loaded_id = 0; - canvas->finished_load_id = 0; - } - - (* GTK_OBJECT_CLASS(parent_class)->destroy) (object); -} - -static void -desktop_canvas_finalize (GtkObject *object) -{ - DesktopCanvas *canvas; - - g_return_if_fail(object != NULL); - g_return_if_fail(DESKTOP_IS_CANVAS(object)); - - canvas = DESKTOP_CANVAS(object); - - desktop_background_info_unref(canvas->background_info); - desktop_layout_unref(canvas->layout); - - (* GTK_OBJECT_CLASS(parent_class)->finalize) (object); -} - - -GtkWidget* -desktop_canvas_new (void) -{ - DesktopCanvas *dcanvas; - - dcanvas = gtk_type_new(desktop_canvas_get_type()); - - return GTK_WIDGET(dcanvas); -} - -/* - * GtkWidget functions - */ - -static void -desktop_canvas_realize (GtkWidget *widget) -{ - DesktopCanvas *dcanvas; - - g_return_if_fail (widget != NULL); - g_return_if_fail (DESKTOP_IS_CANVAS (widget)); - - dcanvas = DESKTOP_CANVAS (widget); - - if (GTK_WIDGET_CLASS (parent_class)->realize) - (* GTK_WIDGET_CLASS (parent_class)->realize) (widget); -} - -static void -desktop_canvas_size_allocate(GtkWidget *widget, - GtkAllocation *allocation) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS(widget), - 0.0, 0.0, - allocation->width, - allocation->height); - - desktop_layout_set_size(DESKTOP_CANVAS(widget)->layout, - 0, 0, - allocation->width, - allocation->height); - - desktop_layout_arrange(DESKTOP_CANVAS(widget)->layout, FALSE); /* FIXME */ - - if (GTK_WIDGET_CLASS (parent_class)->size_allocate) - (* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, - allocation); -} - -static void -dicon_size_request(DesktopLayoutItem *layout_item, - gint *x, gint *y, gint *width, gint *height, - gpointer user_data) -{ - DesktopItem *icon = user_data; - - desktop_item_size_request(icon, x, y, width, height); - - printf("size req: %d,%d %dx%d\n", *x, *y, *width, *height); -} - -static void -dicon_size_allocate(DesktopLayoutItem *layout_item, - gint x, gint y, gint width, gint height, - gpointer user_data) -{ - DesktopItem *icon = user_data; - - desktop_item_size_allocate(icon, x, y, width, height); - - printf("size alloc: %d,%d %dx%d\n", x, y, width, height); -} - -static void -dicon_destroy_notify(gpointer data) -{ - DesktopItem *icon = data; - - desktop_item_unref(icon); -} - -static void -entries_loaded_cb(FMDirectoryList *dlist, - GSList *entries, - gpointer data) -{ - DesktopCanvas *canvas = data; - GSList *iter; - - g_assert(canvas != NULL); - - iter = entries; - while (iter != NULL) { - FMDirectoryListEntry *entry = iter->data; - DesktopItem *icon; - DesktopLayoutItem *layout_item; - - printf("entry: %s\n", - fm_directory_list_entry_get_name(entry)); - - icon = desktop_icon_new(); - - desktop_icon_set_icon(icon, fm_directory_list_entry_get_icon(entry)); - desktop_icon_set_name(icon, fm_directory_list_entry_get_name(entry)); - - layout_item = desktop_layout_item_new(dicon_size_request, - dicon_size_allocate, - dicon_destroy_notify, - icon); - - - /* sort of a hack to have this here */ - desktop_item_realize(icon, - GNOME_CANVAS_GROUP(GNOME_CANVAS(canvas)->root)); - - desktop_layout_add_item(canvas->layout, - layout_item); - - desktop_layout_item_unref(layout_item); - - iter = g_slist_next(iter); - } -} - -static void -finished_load_cb(FMDirectoryList *dlist, gpointer data) -{ - DesktopCanvas *canvas = data; - - desktop_layout_arrange(canvas->layout, FALSE); -} - -void -desktop_canvas_load_desktop_icons(DesktopCanvas *canvas, const gchar *uri) -{ - g_return_if_fail(canvas != NULL); - g_return_if_fail(DESKTOP_IS_CANVAS(canvas)); - - if (canvas->desktop_dir_list != NULL) { - gtk_object_unref(GTK_OBJECT(canvas->desktop_dir_list)); - gtk_signal_disconnect(GTK_OBJECT(canvas->desktop_dir_list), - canvas->entries_loaded_id); - gtk_signal_disconnect(GTK_OBJECT(canvas->desktop_dir_list), - canvas->finished_load_id); - canvas->desktop_dir_list = NULL; - canvas->entries_loaded_id = 0; - canvas->finished_load_id = 0; - } - - if (uri != NULL) { - canvas->desktop_dir_list = fm_directory_list_new(); - - gtk_object_ref(GTK_OBJECT(canvas->desktop_dir_list)); - gtk_object_sink(GTK_OBJECT(canvas->desktop_dir_list)); - - canvas->entries_loaded_id = - gtk_signal_connect(GTK_OBJECT(canvas->desktop_dir_list), - "entries_loaded", - (GtkSignalFunc)entries_loaded_cb, - canvas); - - canvas->finished_load_id = - gtk_signal_connect(GTK_OBJECT(canvas->desktop_dir_list), - "finished_load", - (GtkSignalFunc)finished_load_cb, - canvas); - - fm_directory_list_load_uri(canvas->desktop_dir_list, - uri); - } -} - -/* - * Background accessor functions - */ - -static void -rgb32_to_gdkcolor(guint32 rgb, GdkColor* color) -{ - guchar r, g, b; - - r = (rgb >> 16) & 0xFF; - g = (rgb >> 8) & 0xFF; - b = rgb & 0xFF; - - color->red = r*255; - color->green = g*255; - color->blue = b*255; -} - -static void -set_widget_color(GtkWidget* w, guint32 rgb) -{ - GtkStyle* style; - - gtk_widget_ensure_style(w); - - style = gtk_style_copy(w->style); - - rgb32_to_gdkcolor(rgb, &style->bg[GTK_STATE_NORMAL]); - - /* FIXME should use modify_style */ - gtk_widget_set_style(w, style); - - gtk_style_unref(style); -} - -static gint -update_bg_idle(gpointer data) -{ - DesktopCanvas *canvas; - - canvas = data; - - g_return_val_if_fail(canvas != NULL, FALSE); - g_return_val_if_fail(DESKTOP_IS_CANVAS(canvas), FALSE); - - switch (canvas->background_info->background_type) { - case DesktopBackgroundSolid: - set_widget_color(GTK_WIDGET(canvas), canvas->background_info->solid_color); - break; - - default: - g_warning("FIXME background features not all implemented yet"); - break; - } - - canvas->background_update_idle = 0; - return FALSE; /* remove idle */ -} - -/* This function is expensive. All the "setters" check that a change has - actually been made before they call it. */ -static void -desktop_canvas_update_background (DesktopCanvas *canvas) -{ - g_return_if_fail(canvas != NULL); - g_return_if_fail(DESKTOP_IS_CANVAS(canvas)); - - if (canvas->background_update_idle == 0) - canvas->background_update_idle = gtk_idle_add(update_bg_idle, canvas); -} - -void -desktop_canvas_set_background_type (DesktopCanvas *canvas, - DesktopBackgroundType type) -{ - g_return_if_fail(canvas != NULL); - g_return_if_fail(DESKTOP_IS_CANVAS(canvas)); - - if (canvas->background_info->background_type == type) - return; - - canvas->background_info->background_type = type; - - desktop_canvas_update_background (canvas); -} - -DesktopBackgroundType -desktop_canvas_get_background_type (DesktopCanvas *canvas) -{ - g_return_val_if_fail(canvas != NULL, DesktopBackgroundSolid); - g_return_val_if_fail(DESKTOP_IS_CANVAS(canvas), DesktopBackgroundSolid); - - return canvas->background_info->background_type; -} - -DesktopImageType -desktop_canvas_get_image_background_type (DesktopCanvas *canvas) -{ - g_return_val_if_fail(canvas != NULL, DesktopImageCentered); - g_return_val_if_fail(DESKTOP_IS_CANVAS(canvas), DesktopImageCentered); - - return canvas->background_info->image_type; -} - -void -desktop_canvas_set_image_background_type (DesktopCanvas *canvas, - DesktopImageType type) -{ - g_return_if_fail(canvas != NULL); - g_return_if_fail(DESKTOP_IS_CANVAS(canvas)); - - if (canvas->background_info->image_type == type) - return; - - canvas->background_info->image_type = type; - - desktop_canvas_update_background (canvas); -} - -void -desktop_canvas_set_image_background_file (DesktopCanvas *canvas, - const gchar *filename) -{ - g_return_if_fail(canvas != NULL); - g_return_if_fail(DESKTOP_IS_CANVAS(canvas)); - - if (filename == NULL && - canvas->background_info->image_filename == NULL) - return; - - if (filename != NULL && - canvas->background_info->image_filename != NULL && - strcmp(canvas->background_info->image_filename, filename) == 0) - return; - - if (canvas->background_info->image_filename) - g_free(canvas->background_info->image_filename); - - canvas->background_info->image_filename = filename ? g_strdup(filename) : NULL; - - desktop_canvas_update_background (canvas); -} - - -gchar* -desktop_canvas_get_image_background_file (DesktopCanvas *canvas) -{ - g_return_val_if_fail(canvas != NULL, NULL); - g_return_val_if_fail(DESKTOP_IS_CANVAS(canvas), NULL); - - if (canvas->background_info->image_filename) - return g_strdup(canvas->background_info->image_filename); - else - return NULL; -} - - -guint32 -desktop_canvas_get_solid_background_color (DesktopCanvas *canvas) -{ - g_return_val_if_fail(canvas != NULL, 0); - g_return_val_if_fail(DESKTOP_IS_CANVAS(canvas), 0); - - return canvas->background_info->solid_color; -} - -void -desktop_canvas_set_solid_background_color (DesktopCanvas *canvas, - guint32 rgb) -{ - g_return_if_fail(canvas != NULL); - g_return_if_fail(DESKTOP_IS_CANVAS(canvas)); - - if (canvas->background_info->solid_color == rgb) - return; - - canvas->background_info->solid_color = rgb; - - desktop_canvas_update_background (canvas); -} - -DesktopGradientType -desktop_canvas_get_gradient_background_type (DesktopCanvas *canvas) -{ - g_return_val_if_fail(canvas != NULL, DesktopGradientVertical); - g_return_val_if_fail(DESKTOP_IS_CANVAS(canvas), DesktopGradientVertical); - - return canvas->background_info->gradient_type; -} - -void -desktop_canvas_set_gradient_background_type (DesktopCanvas *canvas, - DesktopGradientType type) -{ - g_return_if_fail(canvas != NULL); - g_return_if_fail(DESKTOP_IS_CANVAS(canvas)); - - if (canvas->background_info->gradient_type == type) - return; - - canvas->background_info->gradient_type = type; - - desktop_canvas_update_background (canvas); -} - -guint32 -desktop_canvas_get_northwest_gradient_color (DesktopCanvas *canvas) -{ - g_return_val_if_fail(canvas != NULL, 0); - g_return_val_if_fail(DESKTOP_IS_CANVAS(canvas), 0); - - return canvas->background_info->northwest_gradient_color; -} - -void -desktop_canvas_set_northwest_gradient_color (DesktopCanvas *canvas, - guint32 rgb) -{ - g_return_if_fail(canvas != NULL); - g_return_if_fail(DESKTOP_IS_CANVAS(canvas)); - - if (canvas->background_info->northwest_gradient_color == rgb) - return; - - canvas->background_info->northwest_gradient_color = rgb; - - desktop_canvas_update_background (canvas); -} - - -guint32 -desktop_canvas_get_southeast_gradient_color (DesktopCanvas *canvas) -{ - g_return_val_if_fail(canvas != NULL, 0); - g_return_val_if_fail(DESKTOP_IS_CANVAS(canvas), 0); - - return canvas->background_info->southeast_gradient_color; -} - -void -desktop_canvas_set_southeast_gradient_color (DesktopCanvas *canvas, - guint32 rgb) -{ - g_return_if_fail(canvas != NULL); - g_return_if_fail(DESKTOP_IS_CANVAS(canvas)); - - if (canvas->background_info->southeast_gradient_color == rgb) - return; - - canvas->background_info->southeast_gradient_color = rgb; - - desktop_canvas_update_background (canvas); -} - - -/* - * DesktopBackgroundInfo - */ - -DesktopBackgroundInfo* -desktop_background_info_new (void) -{ - DesktopBackgroundInfo *info; - - info = g_new(DesktopBackgroundInfo, 1); - - info->background_type = DesktopBackgroundSolid; - info->image_type = DesktopImageCentered; - info->image_filename = NULL; - info->gradient_type = DesktopGradientVertical; - info->northwest_gradient_color = 0x0500AA; - info->southeast_gradient_color = 0x0000FF; - info->solid_color = 0x0500AA; - - return info; -} - -void -desktop_background_info_unref(DesktopBackgroundInfo *info) -{ - g_return_if_fail(info != NULL); - g_return_if_fail(info->refcount > 0); - - info->refcount -= 1; - - if (info->refcount == 0) { - if (info->image_filename) - g_free(info->image_filename); - - g_free(info); - } -} - -void -desktop_background_info_ref (DesktopBackgroundInfo *info) -{ - g_return_if_fail(info != NULL); - g_return_if_fail(info->refcount > 0); - - info->refcount += 1; -} - - - - diff --git a/src/file-manager/desktop-canvas.h b/src/file-manager/desktop-canvas.h deleted file mode 100644 index 06ce649ce..000000000 --- a/src/file-manager/desktop-canvas.h +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- Mode: C; c-set-style: linux; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * Desktop component of GNOME file manager - * - * Copyright (C) 1999, 2000 Red Hat Inc., Free Software Foundation - * (based on Midnight Commander code by Federico Mena Quintero and Miguel de Icaza) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef GD_DESKTOP_CANVAS_H -#define GD_DESKTOP_CANVAS_H - -#include <libgnome/gnome-defs.h> -#include <libgnomeui/gnome-canvas.h> -#include "desktop-layout.h" -#include "fm-directory-list.h" - -BEGIN_GNOME_DECLS - - -typedef enum { - DesktopBackgroundImage, - DesktopBackgroundGradient, - DesktopBackgroundSolid -} DesktopBackgroundType; - -typedef enum { - DesktopImageTiled, - DesktopImageCentered, - DesktopImageScaled, - DesktopImageScaledAspect /* maintain aspect ratio */ -} DesktopImageType; - -typedef enum { - DesktopGradientVertical, - DesktopGradientHorizontal -} DesktopGradientType; - -/* This struct is a convenience thing for passing the desktop - background info around in a hunk. Not that it's not a union; if you - change the type, then change it back, the settings for the first type - are remembered. */ -typedef struct _DesktopBackgroundInfo DesktopBackgroundInfo; - -struct _DesktopBackgroundInfo { - guint refcount; - DesktopBackgroundType background_type; - DesktopImageType image_type; - gchar* image_filename; /* may be NULL */ - DesktopGradientType gradient_type; - guint32 northwest_gradient_color; - guint32 southeast_gradient_color; - guint32 solid_color; -}; - -DesktopBackgroundInfo* desktop_background_info_new (void); -void desktop_background_info_unref (DesktopBackgroundInfo *info); -void desktop_background_info_ref (DesktopBackgroundInfo *info); - -/* For everything but refcounting just access the struct directly, the - image_filename is allocated if non-NULL so g_free() before you replace it */ - -#define DESKTOP_TYPE_CANVAS (desktop_canvas_get_type ()) -#define DESKTOP_CANVAS(obj) (GTK_CHECK_CAST ((obj), DESKTOP_TYPE_CANVAS, DesktopCanvas)) -#define DESKTOP_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), DESKTOP_TYPE_CANVAS, DesktopCanvasClass)) -#define DESKTOP_IS_CANVAS(obj) (GTK_CHECK_TYPE ((obj), DESKTOP_TYPE_CANVAS)) -#define DESKTOP_IS_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), DESKTOP_TYPE_CANVAS)) - - -typedef struct _DesktopCanvas DesktopCanvas; -typedef struct _DesktopCanvasClass DesktopCanvasClass; - -struct _DesktopCanvas { - GnomeCanvas canvas; - - DesktopBackgroundInfo *background_info; - guint background_update_idle; - - GtkWidget *popup; - - DesktopLayout *layout; - - FMDirectoryList *desktop_dir_list; - guint entries_loaded_id; - guint finished_load_id; -}; - -struct _DesktopCanvasClass { - GnomeCanvasClass parent_class; -}; - - -/* Standard Gtk functions */ - -GtkType desktop_canvas_get_type (void); -GtkWidget *desktop_canvas_new (void); - -/* Desktop stuff */ -void desktop_canvas_load_desktop_icons (DesktopCanvas *canvas, - const gchar *uri); - -/* The get/set functions here are not tied to our IDL interface or to - GConf; these get/set functions are purely to update this "view" - they do not control the "model" */ -void desktop_canvas_set_background_type (DesktopCanvas *canvas, - DesktopBackgroundType type); -DesktopBackgroundType desktop_canvas_get_background_type (DesktopCanvas *canvas); -DesktopImageType desktop_canvas_get_image_background_type (DesktopCanvas *canvas); -void desktop_canvas_set_image_background_type (DesktopCanvas *canvas, - DesktopImageType type); -void desktop_canvas_set_image_background_file (DesktopCanvas *canvas, - const gchar *filename); - - -/* returns allocated string or NULL for unset */ -gchar* desktop_canvas_get_image_background_file (DesktopCanvas *canvas); - - -/* Colors are in 24-bit RGB format, in the rightmost bits */ -guint32 desktop_canvas_get_solid_background_color (DesktopCanvas *canvas); -void desktop_canvas_set_solid_background_color (DesktopCanvas *canvas, - guint32 rgb); -DesktopGradientType desktop_canvas_get_gradient_background_type (DesktopCanvas *canvas); -void desktop_canvas_set_gradient_background_type (DesktopCanvas *canvas, - DesktopGradientType type); -guint32 desktop_canvas_get_northwest_gradient_color (DesktopCanvas *canvas); -void desktop_canvas_set_northwest_gradient_color (DesktopCanvas *canvas, - guint32 rgb); -guint32 desktop_canvas_get_southeast_gradient_color (DesktopCanvas *canvas); -void desktop_canvas_set_southeast_gradient_color (DesktopCanvas *canvas, - guint32 rgb); - -END_GNOME_DECLS - -#endif diff --git a/src/file-manager/desktop-menu.c b/src/file-manager/desktop-menu.c deleted file mode 100644 index ef8ba9269..000000000 --- a/src/file-manager/desktop-menu.c +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; c-set-style: linux; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * Desktop component of GNOME file manager - * - * Copyright (C) 1999, 2000 Red Hat Inc., Free Software Foundation - * (based on Midnight Commander code by Federico Mena Quintero and Miguel de Icaza) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#include <config.h> -#include "desktop-menu.h" - -#include <libgnomeui/gnome-popup-menu.h> - -static void -exit_cb(GtkWidget *w, gpointer data) -{ - gtk_main_quit(); -} - -static GnomeUIInfo desktop_popup_items[] = { - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE ("Exit (debug only)", NULL, exit_cb), - GNOMEUIINFO_END -}; - -GtkWidget* -desktop_menu_new (void) -{ - GtkWidget *popup; - - popup = gnome_popup_menu_new (desktop_popup_items); - - return popup; -} - diff --git a/src/file-manager/desktop-menu.h b/src/file-manager/desktop-menu.h deleted file mode 100644 index ad279be5d..000000000 --- a/src/file-manager/desktop-menu.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C; c-set-style: linux; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * Desktop component of GNOME file manager - * - * Copyright (C) 1999, 2000 Red Hat Inc., Free Software Foundation - * (based on Midnight Commander code by Federico Mena Quintero and Miguel de Icaza) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef GD_DESKTOP_MENU_H -#define GD_DESKTOP_MENU_H - -#include <libgnome/gnome-defs.h> -#include <gtk/gtk.h> - -BEGIN_GNOME_DECLS - -GtkWidget* desktop_menu_new (void); - -END_GNOME_DECLS - -#endif diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 094145645..e90d5727f 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -516,8 +516,11 @@ bonobo_control_activate_callback (BonoboObject *control, gboolean state, gpointe local_ui_handler = bonobo_control_get_ui_handler (BONOBO_CONTROL (control)); if (state) { - bonobo_ui_handler_set_container (local_ui_handler, - bonobo_control_get_remote_ui_handler (BONOBO_CONTROL (control))); + /* FIXME: Doesn't the remote UI handler leak here? */ + bonobo_ui_handler_set_container + (local_ui_handler, + bonobo_control_get_remote_ui_handler (BONOBO_CONTROL (control))); + /* Add new menu items and perhaps whole menus */ fm_directory_view_merge_menus (view); /* Set initial sensitivity, wording, toggle state, etc. */ diff --git a/src/file-manager/fm-icon-text-window.c b/src/file-manager/fm-icon-text-window.c index 106cd2749..926f7235d 100644 --- a/src/file-manager/fm-icon-text-window.c +++ b/src/file-manager/fm-icon-text-window.c @@ -42,12 +42,12 @@ #include <libnautilus-extensions/nautilus-glib-extensions.h> #include <libnautilus-extensions/nautilus-global-preferences.h> -static void ensure_unique_attributes (int menu_index); -static gboolean fm_icon_text_window_delete_event_cb (GtkWidget *widget, - GdkEvent *event, - gpointer user_data); -static void fm_icon_text_window_destroy_cb (GtkObject *object, - gpointer user_data); +static void ensure_unique_attributes (int menu_index); +static gboolean fm_icon_text_window_delete_event_callback (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); +static void fm_icon_text_window_destroy_callback (GtkObject *object, + gpointer user_data); #define DEFAULT_ATTRIBUTE_NAMES "size|date_modified|type" #define PIECES_COUNT 3 @@ -161,7 +161,7 @@ get_chosen_attribute_name (GtkOptionMenu *option_menu) } static void -changed_attributes_option_menu_cb (GtkMenuItem *menu_item, gpointer user_data) +changed_attributes_option_menu_callback (GtkMenuItem *menu_item, gpointer user_data) { char ** attribute_names_array; char * attribute_names_string; @@ -225,7 +225,7 @@ create_attributes_option_menu (int menu_number) */ gtk_signal_connect (GTK_OBJECT (menu_item), "activate", - changed_attributes_option_menu_cb, + changed_attributes_option_menu_callback, GINT_TO_POINTER (menu_number)); } @@ -285,11 +285,11 @@ create_icon_text_window (void) NULL); gtk_signal_connect (GTK_OBJECT (window), "delete_event", - GTK_SIGNAL_FUNC (fm_icon_text_window_delete_event_cb), + GTK_SIGNAL_FUNC (fm_icon_text_window_delete_event_callback), NULL); gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (fm_icon_text_window_destroy_cb), + GTK_SIGNAL_FUNC (fm_icon_text_window_destroy_callback), NULL); return window; @@ -335,9 +335,9 @@ ensure_unique_attributes (int chosen_menu) } static gboolean -fm_icon_text_window_delete_event_cb (GtkWidget *widget, - GdkEvent *event, - gpointer user_data) +fm_icon_text_window_delete_event_callback (GtkWidget *widget, + GdkEvent *event, + gpointer user_data) { /* Hide but don't destroy */ gtk_widget_hide(widget); @@ -345,8 +345,8 @@ fm_icon_text_window_delete_event_cb (GtkWidget *widget, } static void -fm_icon_text_window_destroy_cb (GtkObject *object, - gpointer user_data) +fm_icon_text_window_destroy_callback (GtkObject *object, + gpointer user_data) { nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ATTRIBUTE_NAMES, synch_menus_with_preference, diff --git a/src/file-manager/gnome-desktop.c b/src/file-manager/gnome-desktop.c deleted file mode 100644 index c8735b9d1..000000000 --- a/src/file-manager/gnome-desktop.c +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; c-set-style: linux; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * Desktop component of GNOME file manager - * - * Copyright (C) 1999, 2000 Red Hat Inc., Free Software Foundation - * (based on Midnight Commander code by Federico Mena Quintero and Miguel de Icaza) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* NOTE this is just a test program, the desktop will probably be in - the file manager process, to share the icon cache and such */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <gnome.h> -#include <libgnorba/gnorba.h> -#include "desktop-window.h" -#include "desktop-canvas.h" - -static gint -delete_event_cb(GtkWidget* window, GdkEventAny* event, gpointer data) -{ - gtk_main_quit(); - - return TRUE; -} - -int -main (int argc, char *argv[]) -{ - GtkWidget *window; - GtkWidget *canvas; - CORBA_Environment ev; - -#ifdef ENABLE_NLS /* sadly we need this ifdef because otherwise the following get empty statement warnings */ - bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR); - textdomain (PACKAGE); -#endf - - CORBA_exception_init(&ev); - - gnome_CORBA_init ("gnome-desktop", VERSION, &argc, argv, - GNORBA_INIT_SERVER_FUNC, &ev); - gnome_vfs_init(); - gdk_rgb_init(); - - window = desktop_window_new(); - - gtk_widget_push_visual(gdk_rgb_get_visual()); - gtk_widget_push_colormap(gdk_rgb_get_cmap()); - canvas = desktop_canvas_new(); - gtk_widget_pop_visual(); - gtk_widget_pop_colormap(); - - gtk_container_add(GTK_CONTAINER(window), canvas); - - desktop_canvas_set_solid_background_color(DESKTOP_CANVAS(canvas), 0xFF0000); - - desktop_canvas_load_desktop_icons(DESKTOP_CANVAS (canvas), - "file:/cvs/gnome-cvs/nautilus/"); - - gtk_signal_connect(GTK_OBJECT(window), "delete_event", - GTK_SIGNAL_FUNC(delete_event_cb), NULL); - - gtk_widget_show_all(window); - - gtk_main (); - - return 0; -} - - diff --git a/src/nautilus-applicable-views.c b/src/nautilus-applicable-views.c index 85a7c462a..b02521bc5 100644 --- a/src/nautilus-applicable-views.c +++ b/src/nautilus-applicable-views.c @@ -637,7 +637,7 @@ sidebar_panel_preference_is_on (NautilusViewIdentifier *identifier, gchar *pref_name; gboolean enabled; - pref_name = g_strconcat ("/nautilus/metaviews/", identifier->iid, NULL); + pref_name = g_strconcat ("/nautilus/sidebar-views/", identifier->iid, NULL); enabled = nautilus_preferences_get_boolean (pref_name, FALSE); g_free (pref_name); diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c index d1a98fa07..c73380b69 100644 --- a/src/nautilus-information-panel.c +++ b/src/nautilus-information-panel.c @@ -472,8 +472,8 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (meta_view)); description = nautilus_view_frame_get_label (meta_view); + label = gtk_label_new (description); - g_free (description); gtk_widget_show (label); @@ -486,6 +486,8 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie nautilus_index_tabs_add_view (index_panel->details->index_tabs, description, GTK_WIDGET (meta_view), page_num); + g_free (description); + gtk_widget_show (GTK_WIDGET (meta_view)); } diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c index dc95a56b4..596f63574 100644 --- a/src/nautilus-navigation-window.c +++ b/src/nautilus-navigation-window.c @@ -195,12 +195,12 @@ static void nautilus_window_set_arg (GtkObject *object, static void nautilus_window_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void nautilus_window_goto_uri_cb (GtkWidget *widget, +static void nautilus_window_goto_uri_callback (GtkWidget *widget, const char *uri, GtkWidget *window); -static void zoom_in_cb (NautilusZoomControl *zoom_control, +static void zoom_in_callback (NautilusZoomControl *zoom_control, NautilusWindow *window); -static void zoom_out_cb (NautilusZoomControl *zoom_control, +static void zoom_out_callback (NautilusZoomControl *zoom_control, NautilusWindow *window); /* milliseconds */ @@ -336,7 +336,7 @@ nautilus_window_goto_uri (NautilusWindow *window, const char *uri) } static void -nautilus_window_goto_uri_cb (GtkWidget *widget, +nautilus_window_goto_uri_callback (GtkWidget *widget, const char *uri, GtkWidget *window) { @@ -344,7 +344,7 @@ nautilus_window_goto_uri_cb (GtkWidget *widget, } static void -zoom_in_cb (NautilusZoomControl *zoom_control, +zoom_in_callback (NautilusZoomControl *zoom_control, NautilusWindow *window) { if (window->content_view != NULL) { @@ -353,7 +353,7 @@ zoom_in_cb (NautilusZoomControl *zoom_control, } static void -zoom_out_cb (NautilusZoomControl *zoom_control, +zoom_out_callback (NautilusZoomControl *zoom_control, NautilusWindow *window) { if (window->content_view != NULL) { @@ -394,7 +394,7 @@ nautilus_window_constructed (NautilusWindow *window) nautilus_location_bar_enable_undo (NAUTILUS_LOCATION_BAR (window->ent_uri), TRUE); gtk_signal_connect(GTK_OBJECT(window->ent_uri), "location_changed", - nautilus_window_goto_uri_cb, window); + nautilus_window_goto_uri_callback, window); gtk_box_pack_start(GTK_BOX(location_bar_box), window->ent_uri, TRUE, TRUE, GNOME_PAD_SMALL); behavior = GNOME_DOCK_ITEM_BEH_EXCLUSIVE | GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL; if(!gnome_preferences_get_toolbar_detachable()) @@ -409,8 +409,8 @@ nautilus_window_constructed (NautilusWindow *window) /* allocate the zoom control and place on the right next to the menu */ window->zoom_control = nautilus_zoom_control_new (); gtk_widget_show (window->zoom_control); - gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_in", zoom_in_cb, window); - gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_out", zoom_out_cb, window); + gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_in", zoom_in_callback, window); + gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_out", zoom_out_callback, window); gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0); gtk_widget_show_all(location_bar_box); @@ -1055,7 +1055,7 @@ nautilus_get_history_list () static void -nautilus_window_request_location_change_cb (NautilusViewFrame *view, +nautilus_window_request_location_change_callback (NautilusViewFrame *view, Nautilus_NavigationRequestInfo *info, NautilusWindow *window) { @@ -1064,7 +1064,7 @@ nautilus_window_request_location_change_cb (NautilusViewFrame *view, static void -nautilus_window_request_selection_change_cb (NautilusViewFrame *view, +nautilus_window_request_selection_change_callback (NautilusViewFrame *view, Nautilus_SelectionRequestInfo *info, NautilusWindow *window) { @@ -1072,7 +1072,7 @@ nautilus_window_request_selection_change_cb (NautilusViewFrame *view, } static void -nautilus_window_request_status_change_cb (NautilusViewFrame *view, +nautilus_window_request_status_change_callback (NautilusViewFrame *view, Nautilus_StatusRequestInfo *info, NautilusWindow *window) { @@ -1080,7 +1080,7 @@ nautilus_window_request_status_change_cb (NautilusViewFrame *view, } static void -nautilus_window_request_progress_change_cb (NautilusViewFrame *view, +nautilus_window_request_progress_change_callback (NautilusViewFrame *view, Nautilus_ProgressRequestInfo *info, NautilusWindow *window) { @@ -1103,19 +1103,19 @@ nautilus_window_connect_view(NautilusWindow *window, NautilusViewFrame *view) view_object = GTK_OBJECT(view); gtk_signal_connect(view_object, "request_location_change", - nautilus_window_request_location_change_cb, + nautilus_window_request_location_change_callback, window); gtk_signal_connect(view_object, "request_selection_change", - nautilus_window_request_selection_change_cb, + nautilus_window_request_selection_change_callback, window); gtk_signal_connect(view_object, "request_status_change", - nautilus_window_request_status_change_cb, + nautilus_window_request_status_change_callback, window); gtk_signal_connect(view_object, "request_progress_change", - nautilus_window_request_progress_change_cb, + nautilus_window_request_progress_change_callback, window); gtk_signal_connect(view_object, "destroy", diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c index dc95a56b4..596f63574 100644 --- a/src/nautilus-object-window.c +++ b/src/nautilus-object-window.c @@ -195,12 +195,12 @@ static void nautilus_window_set_arg (GtkObject *object, static void nautilus_window_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void nautilus_window_goto_uri_cb (GtkWidget *widget, +static void nautilus_window_goto_uri_callback (GtkWidget *widget, const char *uri, GtkWidget *window); -static void zoom_in_cb (NautilusZoomControl *zoom_control, +static void zoom_in_callback (NautilusZoomControl *zoom_control, NautilusWindow *window); -static void zoom_out_cb (NautilusZoomControl *zoom_control, +static void zoom_out_callback (NautilusZoomControl *zoom_control, NautilusWindow *window); /* milliseconds */ @@ -336,7 +336,7 @@ nautilus_window_goto_uri (NautilusWindow *window, const char *uri) } static void -nautilus_window_goto_uri_cb (GtkWidget *widget, +nautilus_window_goto_uri_callback (GtkWidget *widget, const char *uri, GtkWidget *window) { @@ -344,7 +344,7 @@ nautilus_window_goto_uri_cb (GtkWidget *widget, } static void -zoom_in_cb (NautilusZoomControl *zoom_control, +zoom_in_callback (NautilusZoomControl *zoom_control, NautilusWindow *window) { if (window->content_view != NULL) { @@ -353,7 +353,7 @@ zoom_in_cb (NautilusZoomControl *zoom_control, } static void -zoom_out_cb (NautilusZoomControl *zoom_control, +zoom_out_callback (NautilusZoomControl *zoom_control, NautilusWindow *window) { if (window->content_view != NULL) { @@ -394,7 +394,7 @@ nautilus_window_constructed (NautilusWindow *window) nautilus_location_bar_enable_undo (NAUTILUS_LOCATION_BAR (window->ent_uri), TRUE); gtk_signal_connect(GTK_OBJECT(window->ent_uri), "location_changed", - nautilus_window_goto_uri_cb, window); + nautilus_window_goto_uri_callback, window); gtk_box_pack_start(GTK_BOX(location_bar_box), window->ent_uri, TRUE, TRUE, GNOME_PAD_SMALL); behavior = GNOME_DOCK_ITEM_BEH_EXCLUSIVE | GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL; if(!gnome_preferences_get_toolbar_detachable()) @@ -409,8 +409,8 @@ nautilus_window_constructed (NautilusWindow *window) /* allocate the zoom control and place on the right next to the menu */ window->zoom_control = nautilus_zoom_control_new (); gtk_widget_show (window->zoom_control); - gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_in", zoom_in_cb, window); - gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_out", zoom_out_cb, window); + gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_in", zoom_in_callback, window); + gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_out", zoom_out_callback, window); gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0); gtk_widget_show_all(location_bar_box); @@ -1055,7 +1055,7 @@ nautilus_get_history_list () static void -nautilus_window_request_location_change_cb (NautilusViewFrame *view, +nautilus_window_request_location_change_callback (NautilusViewFrame *view, Nautilus_NavigationRequestInfo *info, NautilusWindow *window) { @@ -1064,7 +1064,7 @@ nautilus_window_request_location_change_cb (NautilusViewFrame *view, static void -nautilus_window_request_selection_change_cb (NautilusViewFrame *view, +nautilus_window_request_selection_change_callback (NautilusViewFrame *view, Nautilus_SelectionRequestInfo *info, NautilusWindow *window) { @@ -1072,7 +1072,7 @@ nautilus_window_request_selection_change_cb (NautilusViewFrame *view, } static void -nautilus_window_request_status_change_cb (NautilusViewFrame *view, +nautilus_window_request_status_change_callback (NautilusViewFrame *view, Nautilus_StatusRequestInfo *info, NautilusWindow *window) { @@ -1080,7 +1080,7 @@ nautilus_window_request_status_change_cb (NautilusViewFrame *view, } static void -nautilus_window_request_progress_change_cb (NautilusViewFrame *view, +nautilus_window_request_progress_change_callback (NautilusViewFrame *view, Nautilus_ProgressRequestInfo *info, NautilusWindow *window) { @@ -1103,19 +1103,19 @@ nautilus_window_connect_view(NautilusWindow *window, NautilusViewFrame *view) view_object = GTK_OBJECT(view); gtk_signal_connect(view_object, "request_location_change", - nautilus_window_request_location_change_cb, + nautilus_window_request_location_change_callback, window); gtk_signal_connect(view_object, "request_selection_change", - nautilus_window_request_selection_change_cb, + nautilus_window_request_selection_change_callback, window); gtk_signal_connect(view_object, "request_status_change", - nautilus_window_request_status_change_cb, + nautilus_window_request_status_change_callback, window); gtk_signal_connect(view_object, "request_progress_change", - nautilus_window_request_progress_change_cb, + nautilus_window_request_progress_change_callback, window); gtk_signal_connect(view_object, "destroy", diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c index d1a98fa07..c73380b69 100644 --- a/src/nautilus-sidebar.c +++ b/src/nautilus-sidebar.c @@ -472,8 +472,8 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (meta_view)); description = nautilus_view_frame_get_label (meta_view); + label = gtk_label_new (description); - g_free (description); gtk_widget_show (label); @@ -486,6 +486,8 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie nautilus_index_tabs_add_view (index_panel->details->index_tabs, description, GTK_WIDGET (meta_view), page_num); + g_free (description); + gtk_widget_show (GTK_WIDGET (meta_view)); } diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c index dc95a56b4..596f63574 100644 --- a/src/nautilus-spatial-window.c +++ b/src/nautilus-spatial-window.c @@ -195,12 +195,12 @@ static void nautilus_window_set_arg (GtkObject *object, static void nautilus_window_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void nautilus_window_goto_uri_cb (GtkWidget *widget, +static void nautilus_window_goto_uri_callback (GtkWidget *widget, const char *uri, GtkWidget *window); -static void zoom_in_cb (NautilusZoomControl *zoom_control, +static void zoom_in_callback (NautilusZoomControl *zoom_control, NautilusWindow *window); -static void zoom_out_cb (NautilusZoomControl *zoom_control, +static void zoom_out_callback (NautilusZoomControl *zoom_control, NautilusWindow *window); /* milliseconds */ @@ -336,7 +336,7 @@ nautilus_window_goto_uri (NautilusWindow *window, const char *uri) } static void -nautilus_window_goto_uri_cb (GtkWidget *widget, +nautilus_window_goto_uri_callback (GtkWidget *widget, const char *uri, GtkWidget *window) { @@ -344,7 +344,7 @@ nautilus_window_goto_uri_cb (GtkWidget *widget, } static void -zoom_in_cb (NautilusZoomControl *zoom_control, +zoom_in_callback (NautilusZoomControl *zoom_control, NautilusWindow *window) { if (window->content_view != NULL) { @@ -353,7 +353,7 @@ zoom_in_cb (NautilusZoomControl *zoom_control, } static void -zoom_out_cb (NautilusZoomControl *zoom_control, +zoom_out_callback (NautilusZoomControl *zoom_control, NautilusWindow *window) { if (window->content_view != NULL) { @@ -394,7 +394,7 @@ nautilus_window_constructed (NautilusWindow *window) nautilus_location_bar_enable_undo (NAUTILUS_LOCATION_BAR (window->ent_uri), TRUE); gtk_signal_connect(GTK_OBJECT(window->ent_uri), "location_changed", - nautilus_window_goto_uri_cb, window); + nautilus_window_goto_uri_callback, window); gtk_box_pack_start(GTK_BOX(location_bar_box), window->ent_uri, TRUE, TRUE, GNOME_PAD_SMALL); behavior = GNOME_DOCK_ITEM_BEH_EXCLUSIVE | GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL; if(!gnome_preferences_get_toolbar_detachable()) @@ -409,8 +409,8 @@ nautilus_window_constructed (NautilusWindow *window) /* allocate the zoom control and place on the right next to the menu */ window->zoom_control = nautilus_zoom_control_new (); gtk_widget_show (window->zoom_control); - gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_in", zoom_in_cb, window); - gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_out", zoom_out_cb, window); + gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_in", zoom_in_callback, window); + gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_out", zoom_out_callback, window); gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0); gtk_widget_show_all(location_bar_box); @@ -1055,7 +1055,7 @@ nautilus_get_history_list () static void -nautilus_window_request_location_change_cb (NautilusViewFrame *view, +nautilus_window_request_location_change_callback (NautilusViewFrame *view, Nautilus_NavigationRequestInfo *info, NautilusWindow *window) { @@ -1064,7 +1064,7 @@ nautilus_window_request_location_change_cb (NautilusViewFrame *view, static void -nautilus_window_request_selection_change_cb (NautilusViewFrame *view, +nautilus_window_request_selection_change_callback (NautilusViewFrame *view, Nautilus_SelectionRequestInfo *info, NautilusWindow *window) { @@ -1072,7 +1072,7 @@ nautilus_window_request_selection_change_cb (NautilusViewFrame *view, } static void -nautilus_window_request_status_change_cb (NautilusViewFrame *view, +nautilus_window_request_status_change_callback (NautilusViewFrame *view, Nautilus_StatusRequestInfo *info, NautilusWindow *window) { @@ -1080,7 +1080,7 @@ nautilus_window_request_status_change_cb (NautilusViewFrame *view, } static void -nautilus_window_request_progress_change_cb (NautilusViewFrame *view, +nautilus_window_request_progress_change_callback (NautilusViewFrame *view, Nautilus_ProgressRequestInfo *info, NautilusWindow *window) { @@ -1103,19 +1103,19 @@ nautilus_window_connect_view(NautilusWindow *window, NautilusViewFrame *view) view_object = GTK_OBJECT(view); gtk_signal_connect(view_object, "request_location_change", - nautilus_window_request_location_change_cb, + nautilus_window_request_location_change_callback, window); gtk_signal_connect(view_object, "request_selection_change", - nautilus_window_request_selection_change_cb, + nautilus_window_request_selection_change_callback, window); gtk_signal_connect(view_object, "request_status_change", - nautilus_window_request_status_change_cb, + nautilus_window_request_status_change_callback, window); gtk_signal_connect(view_object, "request_progress_change", - nautilus_window_request_progress_change_cb, + nautilus_window_request_progress_change_callback, window); gtk_signal_connect(view_object, "destroy", diff --git a/src/nautilus-window.c b/src/nautilus-window.c index dc95a56b4..596f63574 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -195,12 +195,12 @@ static void nautilus_window_set_arg (GtkObject *object, static void nautilus_window_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void nautilus_window_goto_uri_cb (GtkWidget *widget, +static void nautilus_window_goto_uri_callback (GtkWidget *widget, const char *uri, GtkWidget *window); -static void zoom_in_cb (NautilusZoomControl *zoom_control, +static void zoom_in_callback (NautilusZoomControl *zoom_control, NautilusWindow *window); -static void zoom_out_cb (NautilusZoomControl *zoom_control, +static void zoom_out_callback (NautilusZoomControl *zoom_control, NautilusWindow *window); /* milliseconds */ @@ -336,7 +336,7 @@ nautilus_window_goto_uri (NautilusWindow *window, const char *uri) } static void -nautilus_window_goto_uri_cb (GtkWidget *widget, +nautilus_window_goto_uri_callback (GtkWidget *widget, const char *uri, GtkWidget *window) { @@ -344,7 +344,7 @@ nautilus_window_goto_uri_cb (GtkWidget *widget, } static void -zoom_in_cb (NautilusZoomControl *zoom_control, +zoom_in_callback (NautilusZoomControl *zoom_control, NautilusWindow *window) { if (window->content_view != NULL) { @@ -353,7 +353,7 @@ zoom_in_cb (NautilusZoomControl *zoom_control, } static void -zoom_out_cb (NautilusZoomControl *zoom_control, +zoom_out_callback (NautilusZoomControl *zoom_control, NautilusWindow *window) { if (window->content_view != NULL) { @@ -394,7 +394,7 @@ nautilus_window_constructed (NautilusWindow *window) nautilus_location_bar_enable_undo (NAUTILUS_LOCATION_BAR (window->ent_uri), TRUE); gtk_signal_connect(GTK_OBJECT(window->ent_uri), "location_changed", - nautilus_window_goto_uri_cb, window); + nautilus_window_goto_uri_callback, window); gtk_box_pack_start(GTK_BOX(location_bar_box), window->ent_uri, TRUE, TRUE, GNOME_PAD_SMALL); behavior = GNOME_DOCK_ITEM_BEH_EXCLUSIVE | GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL; if(!gnome_preferences_get_toolbar_detachable()) @@ -409,8 +409,8 @@ nautilus_window_constructed (NautilusWindow *window) /* allocate the zoom control and place on the right next to the menu */ window->zoom_control = nautilus_zoom_control_new (); gtk_widget_show (window->zoom_control); - gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_in", zoom_in_cb, window); - gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_out", zoom_out_cb, window); + gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_in", zoom_in_callback, window); + gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_out", zoom_out_callback, window); gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0); gtk_widget_show_all(location_bar_box); @@ -1055,7 +1055,7 @@ nautilus_get_history_list () static void -nautilus_window_request_location_change_cb (NautilusViewFrame *view, +nautilus_window_request_location_change_callback (NautilusViewFrame *view, Nautilus_NavigationRequestInfo *info, NautilusWindow *window) { @@ -1064,7 +1064,7 @@ nautilus_window_request_location_change_cb (NautilusViewFrame *view, static void -nautilus_window_request_selection_change_cb (NautilusViewFrame *view, +nautilus_window_request_selection_change_callback (NautilusViewFrame *view, Nautilus_SelectionRequestInfo *info, NautilusWindow *window) { @@ -1072,7 +1072,7 @@ nautilus_window_request_selection_change_cb (NautilusViewFrame *view, } static void -nautilus_window_request_status_change_cb (NautilusViewFrame *view, +nautilus_window_request_status_change_callback (NautilusViewFrame *view, Nautilus_StatusRequestInfo *info, NautilusWindow *window) { @@ -1080,7 +1080,7 @@ nautilus_window_request_status_change_cb (NautilusViewFrame *view, } static void -nautilus_window_request_progress_change_cb (NautilusViewFrame *view, +nautilus_window_request_progress_change_callback (NautilusViewFrame *view, Nautilus_ProgressRequestInfo *info, NautilusWindow *window) { @@ -1103,19 +1103,19 @@ nautilus_window_connect_view(NautilusWindow *window, NautilusViewFrame *view) view_object = GTK_OBJECT(view); gtk_signal_connect(view_object, "request_location_change", - nautilus_window_request_location_change_cb, + nautilus_window_request_location_change_callback, window); gtk_signal_connect(view_object, "request_selection_change", - nautilus_window_request_selection_change_cb, + nautilus_window_request_selection_change_callback, window); gtk_signal_connect(view_object, "request_status_change", - nautilus_window_request_status_change_cb, + nautilus_window_request_status_change_callback, window); gtk_signal_connect(view_object, "request_progress_change", - nautilus_window_request_progress_change_cb, + nautilus_window_request_progress_change_callback, window); gtk_signal_connect(view_object, "destroy", diff --git a/src/nautilus-zoom-control.c b/src/nautilus-zoom-control.c index b7e7871ad..411093693 100644 --- a/src/nautilus-zoom-control.c +++ b/src/nautilus-zoom-control.c @@ -24,36 +24,38 @@ */ #include <config.h> +#include "nautilus-zoom-control.h" + +#include <libgnome/gnome-defs.h> + +#include <math.h> #include <gdk/gdk.h> -#include <gtk/gtkeventbox.h> -#include <gtk/gtkwidget.h> #include <gtk/gtksignal.h> -#include <stdio.h> -#include <gnome.h> -#include <math.h> +#include <gtk/gtkmenu.h> +#include <gtk/gtkmenuitem.h> +#include <libgnome/gnome-util.h> +#include <libgnomeui/gnome-pixmap.h> #include <libnautilus-extensions/nautilus-gtk-macros.h> #include <libnautilus-extensions/nautilus-icon-factory.h> -#include "nautilus-zoom-control.h" enum { - ZOOM_IN, - ZOOM_OUT, - LAST_SIGNAL + ZOOM_IN, + ZOOM_OUT, + LAST_SIGNAL }; -static guint nautilus_zoom_control_signals[LAST_SIGNAL]; - +static guint signals[LAST_SIGNAL]; static void nautilus_zoom_control_class_initialize (NautilusZoomControlClass *klass); static void nautilus_zoom_control_initialize (NautilusZoomControl *pixmap); static void nautilus_zoom_control_draw (GtkWidget *widget, GdkRectangle *box); -static gint nautilus_zoom_control_expose (GtkWidget *widget, +static int nautilus_zoom_control_expose (GtkWidget *widget, GdkEventExpose *event); static gboolean nautilus_zoom_control_button_press_event (GtkWidget *widget, GdkEventButton *event); static void set_zoom_level (NautilusZoomControl *zoom_control, - gint new_level); + int new_level); void draw_number_and_disable_arrows (GtkWidget *widget, GdkRectangle *box); @@ -100,23 +102,25 @@ nautilus_zoom_control_class_initialize (NautilusZoomControlClass *class) widget_class->expose_event = nautilus_zoom_control_expose; widget_class->button_press_event = nautilus_zoom_control_button_press_event; - nautilus_zoom_control_signals[ZOOM_IN] = gtk_signal_new ("zoom_in", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (NautilusZoomControlClass, - zoom_in), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - nautilus_zoom_control_signals[ZOOM_OUT] = gtk_signal_new ("zoom_out", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (NautilusZoomControlClass, - zoom_out), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, nautilus_zoom_control_signals, LAST_SIGNAL); + signals[ZOOM_IN] = + gtk_signal_new ("zoom_in", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (NautilusZoomControlClass, + zoom_in), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + signals[ZOOM_OUT] = + gtk_signal_new ("zoom_out", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (NautilusZoomControlClass, + zoom_out), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); } @@ -124,7 +128,7 @@ nautilus_zoom_control_class_initialize (NautilusZoomControlClass *class) static void nautilus_zoom_control_initialize (NautilusZoomControl *zoom_control) { - gchar *file_name; + char *file_name; GtkWidget *pix_widget; zoom_control->current_zoom = NAUTILUS_ZOOM_LEVEL_STANDARD; @@ -152,10 +156,10 @@ nautilus_zoom_control_new () /* draw the current zoom percentage */ void draw_number_and_disable_arrows(GtkWidget *widget, GdkRectangle *box) { - gchar buffer[8]; + char buffer[8]; GdkFont *label_font; GdkGC* temp_gc; - gint x, y, percent; + int x, y, percent; NautilusZoomControl *zoom_control = NAUTILUS_ZOOM_CONTROL (widget); label_font = gdk_font_load("-bitstream-courier-medium-r-normal-*-9-*-*-*-*-*-*-*"); @@ -195,7 +199,7 @@ nautilus_zoom_control_draw (GtkWidget *widget, GdkRectangle *box) /* handle expose events */ -static gint +static int nautilus_zoom_control_expose (GtkWidget *widget, GdkEventExpose *event) { GdkRectangle box; @@ -218,23 +222,26 @@ nautilus_zoom_control_expose (GtkWidget *widget, GdkEventExpose *event) /* routines to create and handle the zoom menu */ static void -zoom_menu_cb(GtkMenuItem *item, gpointer data) +zoom_menu_callback (GtkMenuItem *item, gpointer callback_data) { - NautilusZoomControl *zoom_control = NAUTILUS_ZOOM_CONTROL(gtk_object_get_user_data(GTK_OBJECT(item))); - if (zoom_control) - set_zoom_level(zoom_control, GPOINTER_TO_INT(data)); + set_zoom_level (NAUTILUS_ZOOM_CONTROL (gtk_object_get_user_data (GTK_OBJECT (item))), + GPOINTER_TO_INT (callback_data)); } static void -create_zoom_menu_item(GtkMenu* menu, GtkWidget *zoom_control, const gchar *item_text, gint zoom_index) +create_zoom_menu_item (GtkMenu *menu, GtkWidget *zoom_control, + const char *item_text, int zoom_index) { GtkWidget *menu_item; - menu_item = gtk_menu_item_new_with_label(item_text); - gtk_signal_connect(GTK_OBJECT (menu_item), "activate", GTK_SIGNAL_FUNC (zoom_menu_cb), GINT_TO_POINTER(zoom_index)); - - gtk_object_set_user_data(GTK_OBJECT(menu_item), zoom_control); - gtk_widget_show (menu_item); + menu_item = gtk_menu_item_new_with_label (item_text); + + gtk_object_set_user_data (GTK_OBJECT (menu_item), zoom_control); + gtk_signal_connect (GTK_OBJECT (menu_item), "activate", + GTK_SIGNAL_FUNC (zoom_menu_callback), + GINT_TO_POINTER (zoom_index)); + + gtk_widget_show (menu_item); gtk_menu_append (menu, menu_item); } @@ -255,7 +262,7 @@ create_zoom_menu(GtkWidget *zoom_control) } static void -set_zoom_level(NautilusZoomControl *zoom_control, gint new_level) +set_zoom_level(NautilusZoomControl *zoom_control, int new_level) { gtk_widget_queue_draw (GTK_WIDGET (zoom_control)); zoom_control->current_zoom = new_level; @@ -272,9 +279,9 @@ static gboolean nautilus_zoom_control_button_press_event (GtkWidget *widget, GdkEventButton *event) { NautilusZoomControl *zoom_control = NAUTILUS_ZOOM_CONTROL (widget); - gint width = widget->allocation.width; - gint center = width >> 1; - gint changed = FALSE; + int width = widget->allocation.width; + int center = width >> 1; + int changed = FALSE; /* check for the context menu button and handle by creating and showing the menu */ if (event->button == CONTEXTUAL_MENU_BUTTON) { @@ -289,11 +296,11 @@ nautilus_zoom_control_button_press_event (GtkWidget *widget, GdkEventButton *eve } if (event->x < (width / 3) && (zoom_control->current_zoom > zoom_control->min_zoom)) { - gtk_signal_emit (GTK_OBJECT (widget), nautilus_zoom_control_signals[ZOOM_OUT]); + gtk_signal_emit (GTK_OBJECT (widget), signals[ZOOM_OUT]); zoom_control->current_zoom -= 1; changed = TRUE; } else if ((event->x > ((2 * width) / 3)) && (zoom_control->current_zoom < zoom_control->max_zoom)) { - gtk_signal_emit (GTK_OBJECT (widget), nautilus_zoom_control_signals[ZOOM_IN]); + gtk_signal_emit (GTK_OBJECT (widget), signals[ZOOM_IN]); zoom_control->current_zoom += 1; changed = TRUE; } else if ((event->x >= (center - (width >> 3))) && (event->x <= (center + (width >> 3)))) { @@ -308,10 +315,8 @@ nautilus_zoom_control_button_press_event (GtkWidget *widget, GdkEventButton *eve return TRUE; } - void nautilus_zoom_control_reset_zoom_level (NautilusZoomControl *zoom_control) { - zoom_control->current_zoom = NAUTILUS_ZOOM_LEVEL_STANDARD; - set_zoom_level (zoom_control, zoom_control->current_zoom); + set_zoom_level (zoom_control, NAUTILUS_ZOOM_LEVEL_STANDARD); } diff --git a/src/nautilus-zoom-control.h b/src/nautilus-zoom-control.h index dc6a77fe3..cc906fba3 100644 --- a/src/nautilus-zoom-control.h +++ b/src/nautilus-zoom-control.h @@ -23,66 +23,59 @@ * */ -#ifndef __NAUTILUS_ZOOM_CONTROL_H__ -#define __NAUTILUS_ZOOM_CONTROL_H__ - +#ifndef NAUTILUS_ZOOM_CONTROL_H +#define NAUTILUS_ZOOM_CONTROL_H #include <gdk/gdk.h> -#include <gtk/gtkpixmap.h> - +#include <gtk/gtkeventbox.h> #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +#define NAUTILUS_TYPE_ZOOM_CONTROL (nautilus_zoom_control_get_type ()) +#define NAUTILUS_ZOOM_CONTROL(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ZOOM_CONTROL, NautilusZoomControl)) +#define NAUTILUS_ZOOM_CONTROL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ZOOM_CONTROL, NautilusZoomControlClass)) +#define NAUTILUS_IS_ZOOM_CONTROL(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ZOOM_CONTROL)) +#define NAUTILUS_IS_ZOOM_CONTROL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ZOOM_CONTROL)) -#define NAUTILUS_TYPE_ZOOM_CONTROL (nautilus_zoom_control_get_type ()) -#define NAUTILUS_ZOOM_CONTROL(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_ZOOM_CONTROL, NautilusZoomControl)) -#define NAUTILUS_ZOOM_CONTROL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_ZOOM_CONTROL, NautilusZoomControlClass)) -#define NAUTILUS_IS_ZOOM_CONTROL(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_ZOOM_CONTROL)) -#define NAUTILUS_IS_ZOOM_CONTROL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_ZOOM_CONTROL)) +typedef struct NautilusZoomControl NautilusZoomControl; +typedef struct NautilusZoomControlClass NautilusZoomControlClass; -typedef struct _NautilusZoomControl NautilusZoomControl; -typedef struct _NautilusZoomControlClass NautilusZoomControlClass; - -struct _NautilusZoomControl -{ - GtkPixmap pixmap; +struct NautilusZoomControl { + GtkEventBox parent; - gint current_zoom; - gint min_zoom; - gint max_zoom; + int current_zoom; + int min_zoom; + int max_zoom; double zoom_factor; }; - -struct _NautilusZoomControlClass -{ + +struct NautilusZoomControlClass { GtkEventBoxClass parent_class; - void (*zoom_in) (NautilusZoomControl *control); - void (*zoom_out) (NautilusZoomControl *control); + void (*zoom_in) (NautilusZoomControl *control); + void (*zoom_out) (NautilusZoomControl *control); }; +GtkType nautilus_zoom_control_get_type (void); +GtkWidget *nautilus_zoom_control_new (void); -GtkType nautilus_zoom_control_get_type (void); -GtkWidget* nautilus_zoom_control_new (void); - -void nautilus_zoom_control_set_zoom_level (NautilusZoomControl *zoom_control, - gdouble zoom_level); -void nautilus_zoom_control_set_min_zoom_level (NautilusZoomControl *zoom_control, - gdouble zoom_level); -void nautilus_zoom_control_set_max_zoom_level (NautilusZoomControl *zoom_control, - gdouble zoom_level); +void nautilus_zoom_control_set_zoom_level (NautilusZoomControl *zoom_control, + double zoom_level); +void nautilus_zoom_control_set_min_zoom_level (NautilusZoomControl *zoom_control, + double zoom_level); +void nautilus_zoom_control_set_max_zoom_level (NautilusZoomControl *zoom_control, + double zoom_level); -gdouble nautilus_zoom_control_get_zoom_level (NautilusZoomControl *zoom_control); -gdouble nautilus_zoom_control_get_min_zoom_level (NautilusZoomControl *zoom_control); -gdouble nautilus_zoom_control_get_max_zoom_level (NautilusZoomControl *zoom_control); +double nautilus_zoom_control_get_zoom_level (NautilusZoomControl *zoom_control); +double nautilus_zoom_control_get_min_zoom_level (NautilusZoomControl *zoom_control); +double nautilus_zoom_control_get_max_zoom_level (NautilusZoomControl *zoom_control); -void nautilus_zoom_control_reset_zoom_level (NautilusZoomControl *zoom_control); +void nautilus_zoom_control_reset_zoom_level (NautilusZoomControl *zoom_control); #ifdef __cplusplus } #endif /* __cplusplus */ - -#endif /* __NAUTILUS_ZOOM_CONTROL_H__ */ +#endif /* NAUTILUS_ZOOM_CONTROL_H */ diff --git a/src/ntl-index-panel.c b/src/ntl-index-panel.c index d1a98fa07..c73380b69 100644 --- a/src/ntl-index-panel.c +++ b/src/ntl-index-panel.c @@ -472,8 +472,8 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie g_return_if_fail (NAUTILUS_IS_VIEW_FRAME (meta_view)); description = nautilus_view_frame_get_label (meta_view); + label = gtk_label_new (description); - g_free (description); gtk_widget_show (label); @@ -486,6 +486,8 @@ nautilus_index_panel_add_meta_view (NautilusIndexPanel *index_panel, NautilusVie nautilus_index_tabs_add_view (index_panel->details->index_tabs, description, GTK_WIDGET (meta_view), page_num); + g_free (description); + gtk_widget_show (GTK_WIDGET (meta_view)); } diff --git a/src/ntl-uri-map.c b/src/ntl-uri-map.c index 85a7c462a..b02521bc5 100644 --- a/src/ntl-uri-map.c +++ b/src/ntl-uri-map.c @@ -637,7 +637,7 @@ sidebar_panel_preference_is_on (NautilusViewIdentifier *identifier, gchar *pref_name; gboolean enabled; - pref_name = g_strconcat ("/nautilus/metaviews/", identifier->iid, NULL); + pref_name = g_strconcat ("/nautilus/sidebar-views/", identifier->iid, NULL); enabled = nautilus_preferences_get_boolean (pref_name, FALSE); g_free (pref_name); diff --git a/src/ntl-window.c b/src/ntl-window.c index dc95a56b4..596f63574 100644 --- a/src/ntl-window.c +++ b/src/ntl-window.c @@ -195,12 +195,12 @@ static void nautilus_window_set_arg (GtkObject *object, static void nautilus_window_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void nautilus_window_goto_uri_cb (GtkWidget *widget, +static void nautilus_window_goto_uri_callback (GtkWidget *widget, const char *uri, GtkWidget *window); -static void zoom_in_cb (NautilusZoomControl *zoom_control, +static void zoom_in_callback (NautilusZoomControl *zoom_control, NautilusWindow *window); -static void zoom_out_cb (NautilusZoomControl *zoom_control, +static void zoom_out_callback (NautilusZoomControl *zoom_control, NautilusWindow *window); /* milliseconds */ @@ -336,7 +336,7 @@ nautilus_window_goto_uri (NautilusWindow *window, const char *uri) } static void -nautilus_window_goto_uri_cb (GtkWidget *widget, +nautilus_window_goto_uri_callback (GtkWidget *widget, const char *uri, GtkWidget *window) { @@ -344,7 +344,7 @@ nautilus_window_goto_uri_cb (GtkWidget *widget, } static void -zoom_in_cb (NautilusZoomControl *zoom_control, +zoom_in_callback (NautilusZoomControl *zoom_control, NautilusWindow *window) { if (window->content_view != NULL) { @@ -353,7 +353,7 @@ zoom_in_cb (NautilusZoomControl *zoom_control, } static void -zoom_out_cb (NautilusZoomControl *zoom_control, +zoom_out_callback (NautilusZoomControl *zoom_control, NautilusWindow *window) { if (window->content_view != NULL) { @@ -394,7 +394,7 @@ nautilus_window_constructed (NautilusWindow *window) nautilus_location_bar_enable_undo (NAUTILUS_LOCATION_BAR (window->ent_uri), TRUE); gtk_signal_connect(GTK_OBJECT(window->ent_uri), "location_changed", - nautilus_window_goto_uri_cb, window); + nautilus_window_goto_uri_callback, window); gtk_box_pack_start(GTK_BOX(location_bar_box), window->ent_uri, TRUE, TRUE, GNOME_PAD_SMALL); behavior = GNOME_DOCK_ITEM_BEH_EXCLUSIVE | GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL; if(!gnome_preferences_get_toolbar_detachable()) @@ -409,8 +409,8 @@ nautilus_window_constructed (NautilusWindow *window) /* allocate the zoom control and place on the right next to the menu */ window->zoom_control = nautilus_zoom_control_new (); gtk_widget_show (window->zoom_control); - gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_in", zoom_in_cb, window); - gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_out", zoom_out_cb, window); + gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_in", zoom_in_callback, window); + gtk_signal_connect (GTK_OBJECT (window->zoom_control), "zoom_out", zoom_out_callback, window); gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0); gtk_widget_show_all(location_bar_box); @@ -1055,7 +1055,7 @@ nautilus_get_history_list () static void -nautilus_window_request_location_change_cb (NautilusViewFrame *view, +nautilus_window_request_location_change_callback (NautilusViewFrame *view, Nautilus_NavigationRequestInfo *info, NautilusWindow *window) { @@ -1064,7 +1064,7 @@ nautilus_window_request_location_change_cb (NautilusViewFrame *view, static void -nautilus_window_request_selection_change_cb (NautilusViewFrame *view, +nautilus_window_request_selection_change_callback (NautilusViewFrame *view, Nautilus_SelectionRequestInfo *info, NautilusWindow *window) { @@ -1072,7 +1072,7 @@ nautilus_window_request_selection_change_cb (NautilusViewFrame *view, } static void -nautilus_window_request_status_change_cb (NautilusViewFrame *view, +nautilus_window_request_status_change_callback (NautilusViewFrame *view, Nautilus_StatusRequestInfo *info, NautilusWindow *window) { @@ -1080,7 +1080,7 @@ nautilus_window_request_status_change_cb (NautilusViewFrame *view, } static void -nautilus_window_request_progress_change_cb (NautilusViewFrame *view, +nautilus_window_request_progress_change_callback (NautilusViewFrame *view, Nautilus_ProgressRequestInfo *info, NautilusWindow *window) { @@ -1103,19 +1103,19 @@ nautilus_window_connect_view(NautilusWindow *window, NautilusViewFrame *view) view_object = GTK_OBJECT(view); gtk_signal_connect(view_object, "request_location_change", - nautilus_window_request_location_change_cb, + nautilus_window_request_location_change_callback, window); gtk_signal_connect(view_object, "request_selection_change", - nautilus_window_request_selection_change_cb, + nautilus_window_request_selection_change_callback, window); gtk_signal_connect(view_object, "request_status_change", - nautilus_window_request_status_change_cb, + nautilus_window_request_status_change_callback, window); gtk_signal_connect(view_object, "request_progress_change", - nautilus_window_request_progress_change_cb, + nautilus_window_request_progress_change_callback, window); gtk_signal_connect(view_object, "destroy", |