When quitting we avoid doing some unnecessary actions, and used to
simply destroy the Scintilla widget (and thus the notebook page)
instead of the elaborate UI updates.
Unfortunately, when the infobars landed they changed what is packed as
a notebook page, and now destroying the Scintilla widget alone is not
enough to close the page. Fix this by properly removing the whole page
no matter what it contains.
This issue was visible when quitting Geany with a project open.
Before infobar it didn't matter because the dialog was modal and interaction
with the doc was impossible. Now that you can interact it the doc should
be marked changed immediately.
Since cbf9813632d7ee921ffa1fda0d1f69128b2bc755 we have a proper
solution for maintaining line number consistent with the editor zoom,
so drop the old hack.
This also allows to remove the now useless third argument of
sci_set_line_numbers().
Save All updates the sidebar and title bar with the document that was
the current one when the action was triggered, but the action could
have changed the focused document if an non-file-backed file required
saving. So, make sure current document is the same after the action.
There is no need to expose the Glade-only callbacks in the header as
nobody uses them directly anyway; and not having them makes the header
a little less bloated.
The callback wasn't used from glade but is useful for some other places so
it's worth moving into document.c. This also fixes a bug where reload via sidebar
always reloads the current document instead of the actually clicked one.
We used to set the widget's style in a style-set handler, and despite
guarding ourselves from recursive invocations, the GTK frame clock
introduced by GTK 3.8 didn't like it very much.
So, replace the manual color modification by a simpler global widget
state modification, making the code simpler and smaller, yet achieving
the same result (or so I hope and see).
Since the infobar is backed in a GtkPaned that allows "shrink", if the
content is too wide, it's far end will just get cropped. Also, wrap
labels are nicer to display possibly long texts as it flows naturally.
Now document_get_from_page() supports arbitrary nesting inside the
notebook page, update document_get_notebook_page() to support it also,
by searching up for the direct notebook child rather than assuming it
is the ScintillaWidget's direct parent.
Directly use the GeanyDocument rather than pass the notebook page
widget and get the document from that. This makes the code more future
proof and less weird.
Since infobars notebook_tab_close_clicked_cb() wants a GeanyDocument as userdata.
show_tab_bar_popup_menu() on the other hand wants the actual GtkNotebook child.