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.
if (file_list != NULL)
{
...
}
else
{
gedit_window_create_tab (window, TRUE);
}
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 submitted the bug report as well.
-Jeff
On Mon, Aug 30, 2010 at 10:16 PM, Jeff
Johnston <jeff.johnston.mn@gmail.com>
wrote:
Thanks!
I will give the "realize" event a try and read up on the
gedit_commands_load_uri call.
I will also file a bug report tomorrow to evaluate the
gtk_window_present() code.
-Jeff
On Mon, Aug 30, 2010 at 3:31 AM, Nacho <nacho resa gmail com>
wrote:
On Mon, Aug 30, 2010 at 5:34 AM, Jeff Johnston <jeff.johnston.mn@gmail.com> wrote:
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.
-Jeff Johnston
_______________________________________________
gedit-list mailing list
gedit-list gnome org
http://mail.gnome.org/mailman/listinfo/gedit-list
|