mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-09-19 15:51:40 +00:00
Fixed 1497 - problems with freeing the CORBA returned preferred zoom level
* libnautilus/nautilus-zoomable.c: (nautilus_g_list_from_ZoomLevelList), (nautilus_ZoomLevelListBuffer_from_zoom_levels), (impl_Nautilus_Zoomable__get_preferred_zoom_level_list), (nautilus_zoomable_initialize_class), (nautilus_zoomable_set_arg), (nautilus_zoomable_get_arg), (nautilus_zoomable_new_from_bonobo_control): * src/nautilus-view-frame.c: (nautilus_view_frame_get_preferred_zoom_levels): * src/nautilus-zoom-control.c: (nautilus_zoom_control_class_initialize), (nautilus_zoom_control_destroy), (nautilus_zoom_control_initialize), (create_zoom_menu_item): Fixed 1497 - problems with freeing the CORBA returned preferred zoom level lists. Finally done with 1425 - decoupling the zoom control from insider knowledge of the icon/list views.
This commit is contained in:
parent
711e7694b8
commit
16f98f7d21
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
|||
2000-06-28 Michael Engber <engber@eazel.com>
|
||||
|
||||
* libnautilus/nautilus-zoomable.c:
|
||||
(nautilus_g_list_from_ZoomLevelList),
|
||||
(nautilus_ZoomLevelListBuffer_from_zoom_levels),
|
||||
(impl_Nautilus_Zoomable__get_preferred_zoom_level_list),
|
||||
(nautilus_zoomable_initialize_class), (nautilus_zoomable_set_arg),
|
||||
(nautilus_zoomable_get_arg),
|
||||
(nautilus_zoomable_new_from_bonobo_control):
|
||||
* src/nautilus-view-frame.c:
|
||||
(nautilus_view_frame_get_preferred_zoom_levels):
|
||||
* src/nautilus-zoom-control.c:
|
||||
(nautilus_zoom_control_class_initialize),
|
||||
(nautilus_zoom_control_destroy),
|
||||
(nautilus_zoom_control_initialize), (create_zoom_menu_item):
|
||||
Fixed 1497 - problems with freeing the CORBA returned preferred
|
||||
zoom level lists. Finally done with 1425 - decoupling the zoom
|
||||
control from insider knowledge of the icon/list views.
|
||||
|
||||
2000-06-28 Darin Adler <darin@eazel.com>
|
||||
|
||||
* components/music/nautilus-music-view.c:
|
||||
|
|
|
@ -43,7 +43,8 @@ struct NautilusZoomableDetails {
|
|||
double max_zoom_level;
|
||||
gboolean is_continuous;
|
||||
|
||||
Nautilus_ZoomLevelList *preferred_zoom_levels;
|
||||
Nautilus_ZoomLevel *preferred_zoom_levels;
|
||||
int num_preferred_zoom_levels;
|
||||
|
||||
Nautilus_ZoomableFrame zoomable_frame;
|
||||
};
|
||||
|
@ -63,6 +64,7 @@ enum {
|
|||
ARG_MAX_ZOOM_LEVEL,
|
||||
ARG_IS_CONTINUOUS,
|
||||
ARG_PREFERRED_ZOOM_LEVELS,
|
||||
ARG_NUM_PREFERRED_ZOOM_LEVELS,
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL];
|
||||
|
@ -137,22 +139,19 @@ nautilus_g_list_from_ZoomLevelList (const Nautilus_ZoomLevelList *zoom_level_lis
|
|||
return g_list_reverse (list);
|
||||
}
|
||||
|
||||
static Nautilus_ZoomLevelList *
|
||||
nautilus_ZoomLevelList_from_zoom_levels (const double *zoom_levels, int num_levels)
|
||||
static Nautilus_ZoomLevel *
|
||||
nautilus_ZoomLevelListBuffer_from_zoom_levels (const double *zoom_levels, int num_levels)
|
||||
{
|
||||
int i;
|
||||
Nautilus_ZoomLevelList *list;
|
||||
Nautilus_ZoomLevel *buffer;
|
||||
|
||||
buffer = CORBA_sequence_Nautilus_ZoomLevel_allocbuf (num_levels);
|
||||
|
||||
list = Nautilus_ZoomLevelList__alloc ();
|
||||
list->_maximum = num_levels;
|
||||
list->_length = num_levels;
|
||||
list->_buffer = CORBA_sequence_Nautilus_ZoomLevel_allocbuf (num_levels);
|
||||
for (i = 0; i < num_levels; ++i) {
|
||||
list->_buffer[i] = zoom_levels[i];
|
||||
buffer[i] = zoom_levels[i];
|
||||
}
|
||||
CORBA_sequence_set_release (list, TRUE);
|
||||
|
||||
return list;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static CORBA_double
|
||||
|
@ -195,7 +194,16 @@ static Nautilus_ZoomLevelList *
|
|||
impl_Nautilus_Zoomable__get_preferred_zoom_level_list (impl_POA_Nautilus_Zoomable *servant,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
return servant->gtk_object->details->preferred_zoom_levels;
|
||||
Nautilus_ZoomLevelList *list;
|
||||
|
||||
list = Nautilus_ZoomLevelList__alloc ();
|
||||
list->_maximum = servant->gtk_object->details->num_preferred_zoom_levels;
|
||||
list->_length = servant->gtk_object->details->num_preferred_zoom_levels;
|
||||
list->_buffer = servant->gtk_object->details->preferred_zoom_levels;
|
||||
|
||||
/* set_release defaults to FALSE - CORBA_sequence_set_release (list, FALSE) */
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -356,6 +364,10 @@ nautilus_zoomable_initialize_class (NautilusZoomableClass *klass)
|
|||
GTK_TYPE_POINTER,
|
||||
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT | GTK_ARG_CONSTRUCT_ONLY,
|
||||
ARG_PREFERRED_ZOOM_LEVELS);
|
||||
gtk_object_add_arg_type ("NautilusZoomable::num_preferred_zoom_levels",
|
||||
GTK_TYPE_INT,
|
||||
GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT | GTK_ARG_CONSTRUCT_ONLY,
|
||||
ARG_NUM_PREFERRED_ZOOM_LEVELS);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -385,6 +397,9 @@ nautilus_zoomable_set_arg (GtkObject *object,
|
|||
case ARG_PREFERRED_ZOOM_LEVELS:
|
||||
zoomable->details->preferred_zoom_levels = GTK_VALUE_POINTER (*arg);
|
||||
break;
|
||||
case ARG_NUM_PREFERRED_ZOOM_LEVELS:
|
||||
zoomable->details->num_preferred_zoom_levels = GTK_VALUE_INT (*arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,6 +428,9 @@ nautilus_zoomable_get_arg (GtkObject *object,
|
|||
case ARG_PREFERRED_ZOOM_LEVELS:
|
||||
GTK_VALUE_POINTER (*arg) = NAUTILUS_ZOOMABLE (object)->details->preferred_zoom_levels;
|
||||
break;
|
||||
case ARG_NUM_PREFERRED_ZOOM_LEVELS:
|
||||
GTK_VALUE_INT (*arg) = NAUTILUS_ZOOMABLE (object)->details->num_preferred_zoom_levels;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +480,8 @@ nautilus_zoomable_new_from_bonobo_control (BonoboControl *bonobo_control,
|
|||
"min_zoom_level", min_zoom_level,
|
||||
"max_zoom_level", max_zoom_level,
|
||||
"is_continuous", is_continuous,
|
||||
"preferred_zoom_levels", nautilus_ZoomLevelList_from_zoom_levels (preferred_zoom_levels, num_preferred_zoom_levels),
|
||||
"preferred_zoom_levels", nautilus_ZoomLevelListBuffer_from_zoom_levels (preferred_zoom_levels, num_preferred_zoom_levels),
|
||||
"num_preferred_zoom_levels", num_preferred_zoom_levels,
|
||||
NULL));
|
||||
|
||||
return zoomable;
|
||||
|
|
|
@ -522,9 +522,7 @@ nautilus_view_frame_get_preferred_zoom_levels (NautilusViewFrame *view)
|
|||
zoom_levels = Nautilus_Zoomable__get_preferred_zoom_levels (view->zoomable, &ev);
|
||||
retval = nautilus_g_list_from_ZoomLevelList (zoom_levels);
|
||||
|
||||
/* FIXME: bugzilla.eazel.com 1497
|
||||
this free had been commented out, as it caused evilness.
|
||||
CORBA_free (zoom_levels); */
|
||||
CORBA_free (zoom_levels);
|
||||
|
||||
} else {
|
||||
retval = NULL;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <libgnomeui/gnome-pixmap.h>
|
||||
#include <libnautilus-extensions/nautilus-gtk-macros.h>
|
||||
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
|
||||
#include <libnautilus-extensions/nautilus-glib-extensions.h>
|
||||
#include <libnautilus-extensions/nautilus-icon-factory.h>
|
||||
#include <libnautilus-extensions/nautilus-file-utilities.h>
|
||||
|
||||
|
@ -53,6 +54,7 @@ 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_destroy (GtkObject *object);
|
||||
static void nautilus_zoom_control_draw (GtkWidget *widget,
|
||||
GdkRectangle *box);
|
||||
static int nautilus_zoom_control_expose (GtkWidget *widget,
|
||||
|
@ -101,6 +103,8 @@ nautilus_zoom_control_class_initialize (NautilusZoomControlClass *class)
|
|||
widget_class = (GtkWidgetClass*) class;
|
||||
parent_class = gtk_type_class (gtk_event_box_get_type ());
|
||||
|
||||
object_class->destroy = nautilus_zoom_control_destroy;
|
||||
|
||||
widget_class->draw = nautilus_zoom_control_draw;
|
||||
widget_class->expose_event = nautilus_zoom_control_expose;
|
||||
widget_class->button_press_event = nautilus_zoom_control_button_press_event;
|
||||
|
@ -148,6 +152,14 @@ nautilus_zoom_control_class_initialize (NautilusZoomControlClass *class)
|
|||
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_zoom_control_destroy (GtkObject *object)
|
||||
{
|
||||
nautilus_g_list_free_deep (NAUTILUS_ZOOM_CONTROL (object)->preferred_zoom_levels);
|
||||
|
||||
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_zoom_control_initialize (NautilusZoomControl *zoom_control)
|
||||
{
|
||||
|
@ -158,9 +170,6 @@ nautilus_zoom_control_initialize (NautilusZoomControl *zoom_control)
|
|||
zoom_control->min_zoom_level = 0.0;
|
||||
zoom_control->max_zoom_level = 2.0;
|
||||
zoom_control->preferred_zoom_levels = NULL;
|
||||
/* FIXME
|
||||
* need to nautilus_g_list_free_deep(zoom_control->preferred_zoom_levels) on destructions
|
||||
*/
|
||||
|
||||
/* allocate the pixmap that holds the image */
|
||||
|
||||
|
@ -268,13 +277,9 @@ create_zoom_menu_item (GtkMenu *menu, GtkWidget *zoom_control, double zoom_level
|
|||
{
|
||||
GtkWidget *menu_item;
|
||||
double *zoom_level_ptr;
|
||||
char *item_text;
|
||||
char item_text[8];
|
||||
|
||||
item_text = (char*) g_malloc(8);
|
||||
/* FIXME
|
||||
* need to make sure item_text is freed somewhere
|
||||
*/
|
||||
g_snprintf(item_text, 8, _("%.0f%%"), 100.0 * zoom_level);
|
||||
g_snprintf(item_text, sizeof (item_text), _("%.0f%%"), 100.0 * zoom_level);
|
||||
|
||||
menu_item = gtk_menu_item_new_with_label (item_text);
|
||||
|
||||
|
|
Loading…
Reference in a new issue