Subject: Re: [gedit-list] Adding Tabs On Startup Bug?
Date: Wed, 1 Sep 2010 11:57:09 -0500
Thanks for the heads up! I do not mind refactoring my code once the next release is done.
"I don't know exactly what you are doing"
What the projects manager of CodeSlayer does is group related file system mount points. Each mount point is considered a project. What I am putting on the document (in a tab) in terms of metadata is the tree reference object so that it will open up the tree automatically, and a reference to the 'Project' object (which represents the mount point) so that a document can find out which project and group it belongs to. With this Project information other plugins can find their way back to the project and group. I think this will be invaluable once the Project object can flexibly have its own metadata attached to it.
But I have grand plans for CodeSlayer and plan on a deep integration with gedit. I work on quite a few open source projects but this is all I work on in my spare time now. I am very impressed with your AP!. I think out of all the source editors out there this is the first API that seems to have it right...and gedit does not even claim to be a "source" editor.
One of the bigger things I want to work on after I get the projects manager to a good place is search. The only search I have ever used that was amazing was the Adobe Homesite tool that I used years ago. And I really only used it at the time to use their search. I want it to be a separate module but also plugable with the projects manager so that it know what it means to search within a project and a group.
-Jeff
On Wed, Sep 1, 2010 at 10:44 AM, Jesse van den Kieboom <jessevdk gnome org> wrote:
On 09/01/2010 04:47 AM, Jeff Johnston wrote:
Connecting to the 'realize' event worked really well!
It is not perfect solution because I still get the default tab
(gedit.c). This is somewhat unfortunate, but not terrible.
Also (to Nacho), the gedit_commands_load_uri does not return a tab,
which I need to put metadata on the document object. Thank you for the
pointer though.
I don't know exactly what you are doing, but you could also just listen
to tab-added, and add the right metadata then? In any case, FYI in
gedit 3 you get back the tabs created by gedit_commands_load_uri(s).
Using gedit_window_create_tab should really not be encouraged because
it lacks some essential logic control that is put in
gedit_commands_load_uri. Don't be surprised if some things don't work
(like opening in an empty first document).
I am adding the ability to load tabs (documents) up on startup for my
CodeSlayer plugin. The problem is that if I add them when my plugin is
run then gedit starts up with a really small window. I found that the
problem is in the gedit_window_create_tab_from_uri() method.
Specifically it is the following code that causes the problem:
BTW I think you should use gedit_commands_load_uri/s
Regards.
if (!GTK_WIDGET_VISIBLE (window))
{
gtk_window_present (GTK_WINDOW (window));
}
If I comment out the gtk_window_present() method then gedit starts up
with the window as the size that I closed it. This code seems to be
showing the window if the window is not visible? I am wondering when
this would be useful? If it is needed then I am not sure how to get
around the issue. And, just to be clear, this is just a problem when
adding tabs when my plugin is started. It has something to do with the
fact that the plugins are called in the gedit_window_init(). If the
tabs are added after the window is created then it works. However, by
the time the window is fully initialized my plugin has no way to
automatically load up the tabs.
I do see in the gedit.c file that somehow I may be able to pass in a
"file_list". However, I am not sure how to get this to work with the
API directly. And even if it did that would not really work as well as
just using the API directly. When I create the tabs I add metadata to
the documents. If I just pass in a list of files then I cannot do that.
The other bit of code that I would like to talk about is in gedit.c
where it creates a tab if a "file_list" is not passed in. I am
wondering if it would be better to check the tabs to see if any exist.
If they do then a blank tab is not created.
Thoughts? I am more than willing to submit a patch if I know what the
right thing to do is.