Re: Trash applet and Trash icon: d'n'd



Il giorno dom, 05-12-2004 alle 22:20 +0800, Davyd Madeley ha scritto:
> On Sun, 2004-12-05 at 14:32 +0100, Luca Ferretti wrote:
> 
> > So maybe libpanel-applet needs some API to declare an applet as single
> > instance. 
> 
> Catching this is easy. Since all instances of an applet run in one
> process, you can have a static gboolean already_running; and test the
> status of that.
> 
> Here's your problem, if they answer no you have two choices,
>  - You can quit, displaying the nasty - Trashapplet exited
>    unexpectantly... confusing to the user, plus they might choose to
>    reload. Users get stuck in loops....
>  - Or, you can deconfigure yourself (non-trivial) and then wait for the
>    end of the session. This is very similar to what null_applet does.
> 
> Of course, uses with two screens might want two trash applets.

Well, I was thinking something like:

* The user selects "Add to Panel..." and scroll the list of all
available applets.
* The user selects "Window List" applet and click Add button
* The panel execute this pseudo-code


        applet = selected_applet ()
        if (applet->is_running == TRUE) then
                if (applet->single_instance == TRUE) then
                        ask_confirm_before_add_to_panel (applet, panel)
                else add_to_panel (applet, panel)
        else add_to_panel (applet, panel)

where the applet variable is a struct storing all needed applet data
grabbed from server file.

* If the panel executes the ask confirm function, then it shows
something like

         ______________________________________________________
        |<b><big>"APPLET_NAME" is already on panel</big><b>    |
        |                                                      |
        |You asked to add an applet, but this yet available    |
        |in "PANEL_NAME". Please confirm if you really want to | 
        |add this applet to the panel.                         |
        |                                                      |
        |                              [Cancel] [Add Elsewhere]|
        |______________________________________________________|
        
(of course less jargon language) elsewhere silently add the applet to
panel.

* The applet now (and only now) can run its own code.

IMHO applets don't have to manage user messages (and translations ;-) or
instance checking, but I suppose that to manage it in panel code could
break API compatibility....

------------------

And some examples:

Single instance: Window List, Battery Monitor, CD Player, Sticky
Notes...

        Sticky Applet: each instance manages _all_ notes on desktop, so
        _usually_ you don't need to keep 2 Sticky Notes applet on panel.
        
        Battery Monitor: you don't need 3 battery monitors when you have
        only one battery :-)
        
        CD Player: I you have only one CD player device, you don't need
        4 CD Player applets
        
        Window List: of course you can use 2 window lists if you like
        them, but usually if you are trying to add a second one, maybe
        it's a fault.

Multiple instance: Network Monitor, System Monitor, Volume Mixer,
Clock...

        Network Monitor: each instance can display info about one
        network device, so you can add one applet to display info about
        at least ppp0, one for eth0...
        
        System Monitor: each instance can display info about one
        resource, so you can add one applet for CPU, one for memory, one
        for swap...
        
        Volume Mixer: each instance could show and manage a track.
        Unfortunately by now it's not possible :-( Try add a second
        mixer applet to panel and configure them to manage PCM and
        Master. You can't[1]
        
        Clock: each instance could show time and date for a different
        timezone. Unfortunately by now it's not possible :-([1]

So the philosophy is: "Don't prevent user to add a second applet, but
warn him if the second instance could not be useful." 

> --d
> 
> PS. If anyone knows of another way to remove an applet, I would love to
> know about it.

And if this don't exist, add as a bug for future panel releases :-P


[1] Good stuff for a Severity:Enhancement bug report !!!!!

-- 
Luca Ferretti <elle uca libero it>




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