Re: Hello ! It's been a long time !



Le mercredi 21 avril 2010 à 01:14:05% (+0530), Seemanta Dutta a écrit:
> Hello Nemiver folks!

Hey Seemanta!

> 
> It has been a long time since I last posted in this list. I started out
> sometime last year around this time, thinking I shall actively contribute to
> Nemiver development. But things took a different turn in my personal life,
> and that kept me busy for the best part of a year.

I hope you are doing fine nevertheless.

> 
> Now things are looking up a bit and I think it is time to continue what I
> had started off back then. One of the great things I found in Nemiver is the
> support from the lead maintainers, Dodji and Jonathon. Frankly the hand
> holding they do to newcomers is not found in many open source projects!
> Three cheers to them !!

:-)

> 
> But enough talk, let's talk about some code now. I have been wondering if it
> would be great to add a modal dialog in nemiver when the user selects the
> window manager cross button or File-->Exit from the Nemiver UI. I know that
> Nemiver quietly saves the session in such a case, but I feel, in the
> interest of consistent UI across all Gnome applications, it would be good to
> have this dialog.

Thank you for your energy and proactive-ness. It's really refreshing and 
appreciated.


> Now I have two questions with respect to this:
> 
> 0. First do we all agree to having this dialog ? If not, then I shall pick
> something else to work on! ;-)

I guess your proposal would be related to 
https://bugzilla.gnome.org/show_bug.cgi?id=553217 ?

If yes, would you mind implementing the dialog only when there currently 
is an inferior (inferior == a program being debugged)?
Otherwise, I fear that poping up the dialog when there is no inferior 
would get on the way of people's flow, so to speak. Please, do not 
refrain from trying to convince me if you disagree.

> 1. If answer to above is yes, what should be the UI in such a dialog?
> Cancel, Save and Quit, Quit ? What should be the text? How do I take care of
> translation while writing my code. Excuse me, if this is a dumb question.

As far as coding goes, I wouldn't say there are dumb questions :-)
Why not start with something like: "There is a program being currently 
debugged.  Do you really to exit from the debugger?" [Yes] [No].


> 
> 2. Can someone point me to the starting point if I were to contribute a
> patch for this work? I understand all the UI is made using glade and
> GtkBuilder and I have a little bit experience in GTK+ programming. But where
> shall I start if I wanted to contribute a patch for adding this
> functionality in Nemiver ? Any helpful hints that will help me get started
> would be greatly appreciated!

For yes/no dialogs, you don't need to mess with glade. You can use the 
function nemiver::ui_utils::ask_yes_no_question declared in 
src/uicommon/nmv-ui-utils.h like:

UString message;
message.printf (_("There is a program being currently debugged. Do you 
                  really want to exit from the debugger?"));
// Note that the _() macro surrounding the text does magically take care 
// of translation for you.

if (nemiver::ui_utils::ask_yes_no_question (message)
    == Gtk::RESPONSE_YES) {
    // Save your belongings, die and rest in peace
} else {
    // Live like if you will never die.
}

Now, the remaining (interesting) question is where to put that code. The 
short answer is "there is a /little/ bit of work for that".

That's because of the way the application is structured today. Basically 
Nemiver is a workbench that is a container of perspectives. Today there 
only is one debugging perspective. But tomorrow, you could image the 
presence of a valgrind perspective, or a tracing perspective, or 
whatever.

When the user clicks on the little cross at the top right corner of the 
window, she is asking for the workbench -- that contains all the 
perspectives -- to shut down and shut down all the perspectives it 
contains.

The feature that you are talking about basically requires that a given 
perspective vetoes the shutting down of the whole workbench.

So we would then need to implement a mechanism to

1/ Poll the perspectives whenever there is a shutdown request. If at 
least one perspective refuses to go down, the shutdown will not proceed 
any further. This is when the debugging perspective is going to notify 
the user about the presence of an inferior and ask for confirmation. If 
the user refuses to proceed forward, the perspective vetoes the shutdown 
request.

2/ If all perspectives agree to go down, then every single perspective 
will be notified that a shutdown is going to happen.

3/ Shutdown actually happens.

I think an interesting entry point to look at would be the function
Workbench::on_delete_event in src/workbench/nmv-workbench.cc. It's 
called whenever the user hits the cross in the top right corner of the 
window. If it returns true then no shutdown should happen.

In that function we could e.g. walk the list m_priv->perspectives which 
is a list<IPerspectiveSafePtr> perspectives, declared earlier in struct 
Workbench::Priv in the same file. During that walk, we could call a 
function IPerspective::agreed_to_shutdown on each instance of 
IPerspective. If one function returns false, then no shutdown happens.  
Otherwise, we just do the shutdown as we do today. There is a shutdown 
signal emitted by the workbench, so the perspective already have a mean 
to get notified as in step 2/.

Does this make sense to you? In any case, feel free to ask any more 
specific question you might have.

If it turns out you are not intersted in this task after all, there are 
plenty of TODO tasks already at http://live.gnome.org/Nemiver.  Click on 
the "TODO" link and you will see the list of enhancement requests filed 
in bugzilla. E.g., this one should be easy enough 
https://bugzilla.gnome.org/show_bug.cgi?id=533437

        Dodji


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