Re: bonobo property page fix



On Thu, 2002-11-07 at 20:52, James Willcox wrote:

> +	pb = bonobo_property_bag_new (get_property, set_property,
> +				      view);
> +	bonobo_property_bag_add (pb, "URI", 0, BONOBO_ARG_STRING,
> +				 NULL, _("URI currently displayed"), 0);
> +	bonobo_control_set_properties (BONOBO_CONTROL (view),
> +				       BONOBO_OBJREF (pb), NULL);

bonobo_control_set_properties() dup_refs the propertybag, so if you
don't need it you should release_unref it.

>  	gtk_text_view_set_editable (GTK_TEXT_VIEW (notes->note_text_field), TRUE);	
>          gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (notes->note_text_field),
>                                       GTK_WRAP_WORD);
> -        gtk_box_pack_start (GTK_BOX (vbox), notes->note_text_field, TRUE, TRUE, 0);
> +	viewport = gtk_viewport_new (NULL, NULL);
> +	gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport),
> +				      GTK_SHADOW_IN);
> +	gtk_container_add (GTK_CONTAINER (viewport), notes->note_text_field);
> +        gtk_box_pack_start (GTK_BOX (vbox), viewport, TRUE, TRUE, 0);
>  

The text field should just go into a GtkScrolledWindow with the shadow
type set correctly.

> +		uri = nautilus_file_get_uri (window->details->target_file);
> +
>  		control = Bonobo_Unknown_queryInterface
>  				(obj, "IDL:Bonobo/Control:1.0", &ev);
>  
> -		view = Bonobo_Unknown_queryInterface
> -				(control, "IDL:Nautilus/View:1.0", &ev);
> -
> -		uri = nautilus_file_get_uri (window->details->target_file);
> +		arg = bonobo_arg_new (BONOBO_ARG_STRING);
> +		BONOBO_ARG_SET_STRING (arg, uri);
>  
> -		Nautilus_View_load_location (view, uri, &ev);
> +		pb = Bonobo_Control_getProperties (control, &ev);
> +		bonobo_pbclient_set_value_async (pb, "URI", arg, &ev);
> +		bonobo_arg_release (arg);
>
>  		if (!BONOBO_EX (&ev)) {
>  			widget = bonobo_widget_new_control_from_objref
>  						(control, CORBA_OBJECT_NIL);
> +			bonobo_object_release_unref (control, NULL);
>  		}

Looks like you're leaking 'pb', and it's probably worth checking for
exceptions from getProperties.

-dave




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]