Re: Removing libgnome dependency



On Mon, Oct 6, 2008 at 8:28 PM, A. Walton <awalton gnome org> wrote:
> On Mon, Oct 6, 2008 at 6:50 AM, Alexander Larsson <alexl redhat com> wrote:
>> On Sat, 2008-10-04 at 15:59 +0200, Cosimo Cecchi wrote:
>>> On Sat, 2008-10-04 at 14:14 +0200, Cosimo Cecchi wrote:
>>> > On Fri, 2008-10-03 at 19:26 +0200, Cosimo Cecchi wrote:
>>> >
>>> > > I am currently working on gnome_program, gnome_help, gnome_popup_menu
>>> > > and gnome_authentication_manager, will post a patch soon.
>>> >
>>> > You can find my work so far in the attached patches.
>>> > I hopefully dropped all references to gnome_program, gnome_config,
>>> > gnome_authentication, gnome_color_picker and the use of the GNOME_*
>>> > class/type definition macros inside Nautilus.
>>> > I now plan to have a look at gnome_icon_entry and gnome_popup_menu; in
>>> > the meantime, is it OK to commit these to trunk?
>>>
>>> Last follow-up for today:
>>> - removed gnome_popup
>>> - removed gnome_icon_entry
>>> - removed all the useless libgnome/* includes, (and even an uncatched
>>> old gnome-vfs one!)
>>
>> Commited with a fix:
>>
>> @@ -753,11 +751,11 @@ button_pressed_callback (GtkTreeView *treeview, GdkEventButton *event,
>>                }
>>
>>                g_object_ref (view);
>> -
>> -               gnome_popup_menu_do_popup_modal (view->details->popup,
>> -                                                NULL, NULL, event, NULL,
>> -                                                GTK_WIDGET (treeview));
>> -
>> +
>> +               gtk_menu_popup (GTK_MENU (view->details->popup),
>> +                               NULL, NULL, NULL, NULL,
>> +                               event->button, event->time);
>> +
>>
>> Crashes due to freed view->details->popup_file
>
> Yeah, I saw this when I wrote this patch 4 months ago. Fixed it by
> simply doing what gnome_popup did;
>
> gtk_menu_popup (GTK_MENU (view->details->popup),
>                               NULL, NULL, NULL, NULL,
>                               event->button, event->time);
> gtk_grab_add (GTK_MENU (view->details->popup));
> gtk_main ();
> gtk_grab_remove (GTK_MENU (view->details->popup));
>
> It restores the modality of the menu and prevents the NautilusFile
> from being immediately unref'd. I'm not sure it's 100% correct, but it
> seems like that part of the code would need a bit of a rework
> otherwise. But I trust the people who wrote that code knew what they
> were doing, since it's worked up till now with no complaints.
>
> -A. Walton
>

This was a bad copy & paste, but you get the idea here, the menu's
running in it's own mainloop and it is removed when the menu is
deactivated. Otherwise I think you need to track the unref to where
the menu is destroyed and make sure to unref the file there, but that
would mean needing to rework that menu code a bit more I think, since
IIRC we create the menu once and keep it around, where most
applications will recreate the menu on demand.

Resending because GMail is not friendly to mailing lists.

>>
>>
>> Also, gnome_icon_entry is still used via eel_gnome_icon_selector_new.
>>
>>
>> --
>> nautilus-list mailing list
>> nautilus-list gnome org
>> http://mail.gnome.org/mailman/listinfo/nautilus-list
>>
>


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