Rewrite of the whole toolbar code. Now it is based on GtkActions and all elements can be added/removed/reordered using a simple XML file.

Add GeanyMenubuttonAction and GeanyEntryAction as GtkAction subclasses to have menu buttons and text entries in the toolbar.
Change the Goto line toolbar item back to a plain text entry again.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3328 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2008-12-06 11:10:06 +00:00
parent 2342390b2c
commit 8ed9710f48
29 changed files with 2043 additions and 2592 deletions

View File

@ -4,6 +4,20 @@
A patch to Scintilla 1.77 containing our changes to Scintilla
(these are mainly commentation character changes and the
column mode editing patch).
* data/ui_toolbar.xml, doc/geany.html, doc/geany.txt, geany.glade,
po/POTFILES.in, src/build.c, src/callbacks.c, src/callbacks.h,
src/geanyentryaction.c, src/geanyentryaction.h,
src/geanymenubuttonaction.c, src/geanymenubuttonaction.h,
src/interface.c, src/keybindings.c, src/keyfile.c, src/main.c,
src/Makefile.am, src/makefile.win32, src/navqueue.c, wscript,
src/plugindata.h, src/plugins.c, src/prefs.c, src/templates.c,
src/toolbar.c, src/toolbar.h, src/ui_utils.c, src/ui_utils.h:
Rewrite of the whole toolbar code. Now it is based on GtkActions
and all elements can be added/removed/reordered using a simple
XML file.
Add GeanyMenubuttonAction and GeanyEntryAction as GtkAction
subclasses to have menu buttons and text entries in the toolbar.
Change the Goto line toolbar item back to a plain text entry again.
2008-12-05 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

67
data/ui_toolbar.xml Normal file
View File

@ -0,0 +1,67 @@
<!--
This is Geany's toolbar UI definition.
The DTD can be found at http://library.gnome.org/devel/gtk/stable/GtkUIManager.html#GtkUIManager.description.
You can re-order all items and freely add and remove available actions.
You cannot add new actions which are not listed below.
Everything you add or change must be inside the /ui/toolbar/ path.
For changes to take effect, you need to restart Geany.
Available actions:
New - Create a new file
Open - Open an existing file
Save - Save the current file
SaveAll - Save all open files
Reload - Reload the current file from disk
Close - Close the current file
Cut - Cut the current selection
Copy - Copy the current selection
Paste - Paste the contents of the clipboard
Delete - Delete the current selection
Undo - Undo the last modification
Redo - Redo the last modification
NavBack - Navigate back a location
NavFor - Navigate forward a location
Compile - Compile the current file
Run - Run or view the current file
Color - Open a color chooser dialog, to interactively pick colors from a palette
ZoomIn - Zoom in the text
ZoomOut - Zoom out the text
UnIndent - Decrease indentation
Indent - Increase indentation
SearchEntry - The search field belonging to the 'Search' element (can be used alone)
Search - Find the entered text in the current file (only useful if you also use 'SearchEntry')
GotoEntry - The goto field belonging to the 'Goto' element (can be used alone)
Goto - Jump to the entered line number (only useful if you also use 'SearchEntry')
Quit - Quit Geany
-->
<ui>
<toolbar name='GeanyToolbar'>
<toolitem action='New' />
<toolitem action='Open' />
<toolitem action='Save' />
<toolitem action='SaveAll' />
<separator/>
<toolitem action='Reload' />
<toolitem action='Close' />
<separator/>
<toolitem action='NavBack' />
<toolitem action='NavFor' />
<separator/>
<toolitem action='Compile' />
<toolitem action='Run' />
<separator/>
<toolitem action='Color' />
<separator/>
<toolitem action='SearchEntry' />
<toolitem action='Search' />
<separator/>
<toolitem action='GotoEntry' />
<toolitem action='Goto' />
<separator/>
<toolitem action='Quit' />
</toolbar>
</ui>

File diff suppressed because it is too large Load Diff

View File

@ -1429,49 +1429,6 @@ Toolbar
Show Toolbar
Whether to show the toolbar.
Items
`````
Show File Operation buttons
Show the buttons to open a new file, open an existing file, save a file,
and save all files.
Show Cut and Delete buttons
Show buttons to cut and delete the current selection.
Show Copy and Paste buttons
Show buttons to copy the current selection and paste the contents of the clipboard.
Show Redo and Undo buttons
Show the undo/redo change buttons.
Show Back and Forward buttons
Show the buttons to navigate forwards and backwards between positions
in the current session's documents.
Show Compile and Run buttons
Show the buttons to run or compile a file.
Show Color Chooser button
Show the button to run the color chooser dialog.
Show Zoom In and Zoom Out buttons
Show the buttons to zoom in closer to a document or zoom out.
Show Increase and Decrease Indentation buttons
Show the buttons to increase or decrease the current line or
selection's indentation.
Show Search field
Show the incremental search bar in the toolbar (quicker than using
the Find command).
Show Go to Line field
Show a line number text entry (quicker than using the Go to Line
command).
Show Quit button
Show a button to quit geany.
Appearance
``````````
@ -3248,6 +3205,71 @@ fileheader The file header template. This wildcard file header, snippe
For details please see http://man.cx/strftime.
Customizing the toolbar
-----------------------
You can add, remove and reorder the elements in the toolbar by editing
the file ``ui_toolbar.xml``.
To override the system-wide configuration file, copy it from
``$prefix/share/geany`` to your configuration directory, usually
``~/.config/geany/``. ``$prefix`` is the path where Geany is installed
(commonly ``/usr/local``).
For example::
% cp /usr/local/share/geany/ui_toolbar.xml /home/username/.config/geany/
Then edit it and add any of the available elements listed in the file or remove
any of the existing elements. Of course, you can also reorder the elements as
you wish and add or remove additional separators.
This file must be valid XML unless it can't be loaded and the global toolbar
UI definition is used.
.. note::
(1) You cannot add new actions which are not listed below.
(2) Everything you add or change must be inside the /ui/toolbar/ path.
(3) After you finished the editing of the file, you need to restart Geany
for changes to take effect.
Available toolbar elements
^^^^^^^^^^^^^^^^^^^^^^^^^^
================== ==============================================================================
Element name Description
================== ==============================================================================
New Create a new file
Open Open an existing file
Save Save the current file
SaveAll Save all open files
Reload Reload the current file from disk
Close Close the current file
Cut Cut the current selection
Copy Copy the current selection
Paste Paste the contents of the clipboard
Delete Delete the current selection
Undo Undo the last modification
Redo Redo the last modification
NavBack Navigate back a location
NavFor Navigate forward a location
Compile Compile the current file
Run Run or view the current file
Color Open a color chooser dialog, to interactively pick colors from a palette
ZoomIn Zoom in the text
ZoomOut Zoom out the text
UnIndent Decrease indentation
Indent Increase indentation
SearchEntry The search field belonging to the 'Search' element (can be used alone)
Search Find the entered text in the current file (only useful if you also
use 'SearchEntry')
GotoEntry The goto field belonging to the 'Goto' element (can be used alone)
Goto Jump to the entered line number (only useful if you also use 'SearchEntry')
Quit Quit Geany
================== ==============================================================================
Plugin documentation
====================

View File

@ -1583,628 +1583,6 @@
</packing>
</child>
<child>
<widget class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
<property name="toolbar_style">GTK_TOOLBAR_ICONS</property>
<property name="tooltips">True</property>
<property name="show_arrow">True</property>
<signal name="key_press_event" handler="on_escape_key_press_event" last_modification_time="Thu, 03 Apr 2008 16:47:57 GMT"/>
<child>
<widget class="GtkMenuToolButton" id="toolbutton_new">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Create a new file</property>
<property name="stock_id">gtk-new</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_toolbutton_new_clicked" last_modification_time="Fri, 17 Feb 2006 17:37:56 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkMenuToolButton" id="toolbutton_open">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Open an existing file</property>
<property name="stock_id">gtk-open</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_toolbutton_open_clicked" last_modification_time="Mon, 01 Sep 2008 15:51:20 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_save">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Save the current file</property>
<property name="stock_id">gtk-save</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_toolbutton_save_clicked" last_modification_time="Mon, 01 Sep 2008 15:54:10 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_saveall">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Save all open files</property>
<property name="label" translatable="yes">Save all</property>
<property name="use_underline">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_save_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:20:04 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem7">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_reload">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Reload the current file from disk</property>
<property name="stock_id">gtk-revert-to-saved</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_toolbutton_reload_clicked" last_modification_time="Mon, 01 Sep 2008 15:56:00 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_close">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Close the current file</property>
<property name="stock_id">gtk-close</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_toolbutton_close_clicked" last_modification_time="Mon, 01 Sep 2008 15:56:49 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem2">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_cut">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Cut the current selection</property>
<property name="stock_id">gtk-cut</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_cut1_activate" last_modification_time="Mon, 10 Jul 2006 19:52:02 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_copy">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Copy the current selection</property>
<property name="stock_id">gtk-copy</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_copy1_activate" last_modification_time="Mon, 10 Jul 2006 19:52:02 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_paste">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Paste the contents of the clipboard</property>
<property name="stock_id">gtk-paste</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_paste1_activate" last_modification_time="Mon, 10 Jul 2006 19:52:02 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_delete">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Delete the current selection</property>
<property name="stock_id">gtk-delete</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_delete1_activate" last_modification_time="Thu, 23 Oct 2008 20:48:07 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem12">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_undo">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Undo the last modification</property>
<property name="stock_id">gtk-undo</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_undo1_activate" last_modification_time="Mon, 10 Jul 2006 19:52:02 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_redo">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Redo the last modification</property>
<property name="stock_id">gtk-redo</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_redo1_activate" last_modification_time="Mon, 10 Jul 2006 19:52:14 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem9">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_back">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="tooltip" translatable="yes">Navigate back a location</property>
<property name="stock_id">gtk-go-back</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_back_activate" last_modification_time="Fri, 25 May 2007 03:53:11 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_forward">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="tooltip" translatable="yes">Navigate forward a location</property>
<property name="stock_id">gtk-go-forward</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_forward_activate" last_modification_time="Fri, 25 May 2007 03:53:16 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem10">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_compile">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Compile the current file</property>
<property name="label" translatable="yes">Compile</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-convert</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_compile_button_clicked" last_modification_time="Sun, 21 Aug 2005 21:30:45 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_run">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Run or view the current file</property>
<property name="stock_id">gtk-execute</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_run_button_clicked" last_modification_time="Mon, 20 Mar 2006 11:00:05 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem6">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_colour">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Open a color chooser dialog, to interactively pick colors from a palette.</property>
<property name="label" translatable="yes">Color</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-select-color</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_show_color_chooser1_activate" last_modification_time="Sun, 20 Nov 2005 00:58:13 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem3">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_zoomin">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Zoom in the text</property>
<property name="stock_id">gtk-zoom-in</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_zoom_in1_activate" last_modification_time="Wed, 08 Jun 2005 13:51:03 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_zoomout">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Zoom out the text</property>
<property name="stock_id">gtk-zoom-out</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_zoom_out1_activate" last_modification_time="Wed, 08 Jun 2005 13:53:11 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem4">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_indent_dec">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Decrease indentation</property>
<property name="stock_id">gtk-unindent</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_menu_decrease_indent1_activate" last_modification_time="Sun, 16 Dec 2007 16:48:25 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_indent_inc">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Increase indentation</property>
<property name="stock_id">gtk-indent</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_menu_increase_indent1_activate" last_modification_time="Sun, 16 Dec 2007 16:48:14 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem11">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolItem" id="toolbutton_search_item">
<property name="visible">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<child>
<widget class="GtkEntry" id="toolbutton_search_entry">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Find the entered text in the current file</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
<signal name="activate" handler="on_toolbar_search_entry_activate" last_modification_time="Mon, 01 Sep 2008 16:02:44 GMT"/>
<signal name="changed" handler="on_toolbar_search_entry_changed" last_modification_time="Mon, 01 Sep 2008 16:02:49 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_search">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Find the entered text in the current file</property>
<property name="stock_id">gtk-find</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_toolbutton_search_clicked" last_modification_time="Mon, 01 Sep 2008 16:05:06 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem5">
<property name="visible">True</property>
<property name="draw">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolItem" id="toolbutton_goto_item">
<property name="visible">True</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<child>
<widget class="GtkSpinButton" id="toolbutton_goto_entry">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Enter a line number and jump to it.</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_IF_VALID</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">True</property>
<property name="adjustment">0 1 100000000 1 10 0</property>
<signal name="activate" handler="on_toolbutton_goto_entry_activate" last_modification_time="Mon, 01 Sep 2008 16:06:59 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_goto">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Jump to the entered line number.</property>
<property name="stock_id">gtk-jump-to</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_toolbutton_goto_clicked" last_modification_time="Sun, 26 Feb 2006 17:06:53 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem8">
<property name="visible">True</property>
<property name="draw">False</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkSeparatorToolItem" id="separatortoolitem1">
<property name="visible">True</property>
<property name="draw">False</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<widget class="GtkToolButton" id="toolbutton_quit">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Quit Geany</property>
<property name="stock_id">gtk-quit</property>
<property name="visible_horizontal">True</property>
<property name="visible_vertical">True</property>
<property name="is_important">False</property>
<signal name="clicked" handler="on_toolbutton_quit_clicked" last_modification_time="Mon, 01 Sep 2008 15:50:30 GMT"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkVPaned" id="vpaned1">
<property name="visible">True</property>
@ -4928,305 +4306,6 @@ Bottom
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame11">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="alignment14">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">1</property>
<property name="yscale">1</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">12</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkVBox" id="vbox16">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="check_toolbar_fileops">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the New, Open, Close, Save and Reload buttons in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show File Operation buttons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_cutdelete">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the Cut and Delete buttons in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Cut and Delete buttons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_copypaste">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the Copy and Paste buttons in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Copy and Paste buttons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_undo">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the Redo and Undo buttons in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Redo and Undo buttons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_navigation">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the Back and Forward buttons in the toolbar used for code navigation</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Back and Forward buttons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_compile">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the Compile and Run buttons in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Compile and Run buttons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_colour">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the Color Chooser button in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Color Chooser button</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_zoom">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the Zoom In and Zoom Out buttons in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Zoom In and Zoom Out buttons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_indent">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the Increase and Decrease Indentation buttons in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Increase and Decrease Indentation buttons</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_search">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the search field and button in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Search field</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_goto">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the line number field and button in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Go to Line field</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="check_toolbar_quit">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Display the quit button in the toolbar</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Show Quit button</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label165">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Items&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame13">
<property name="visible">True</property>

View File

@ -10,6 +10,8 @@ src/editor.c
src/encodings.c
src/filetypes.c
src/geany.h
src/geanymenubuttonaction.c
src/geanyentryaction.c
src/highlighting.c
src/images.c
src/interface.c
@ -30,6 +32,7 @@ src/socket.c
src/support.c
src/symbols.c
src/templates.c
src/toolbar.c
src/tools.c
src/treeviews.c
src/ui_utils.c

View File

@ -16,6 +16,8 @@ SRCS = \
editor.c editor.h \
encodings.c encodings.h \
filetypes.c filetypes.h \
geanyentryaction.c geanyentryaction.h \
geanymenubuttonaction.c geanymenubuttonaction.h \
geanyobject.c geanyobject.h \
geanywraplabel.c geanywraplabel.h \
highlighting.c highlighting.h \
@ -39,6 +41,7 @@ SRCS = \
support.c support.h \
symbols.c symbols.h \
templates.c templates.h \
toolbar.c toolbar.h \
tools.c tools.h \
treeviews.c treeviews.h \
ui_utils.c ui_utils.h \

View File

@ -56,6 +56,7 @@
#include "project.h"
#include "editor.h"
#include "win32.h"
#include "toolbar.h"
GeanyBuildInfo build_info = {GBO_COMPILE, 0, NULL, GEANY_FILETYPES_NONE, NULL};
@ -1664,8 +1665,8 @@ void build_menu_update(GeanyDocument *doc)
{
gtk_widget_set_sensitive(lookup_widget(main_widgets.window, "menu_build1"), FALSE);
gtk_menu_item_remove_submenu(GTK_MENU_ITEM(lookup_widget(main_widgets.window, "menu_build1")));
gtk_widget_set_sensitive(widgets.compile_button, FALSE);
gtk_widget_set_sensitive(widgets.run_button, FALSE);
ui_widget_set_sensitive(widgets.compile_button, FALSE);
ui_widget_set_sensitive(widgets.run_button, FALSE);
return;
}
else
@ -1724,8 +1725,8 @@ void build_menu_update(GeanyDocument *doc)
if (menu_items->item_set_args)
gtk_widget_set_sensitive(menu_items->item_set_args, can_set_args);
gtk_widget_set_sensitive(widgets.compile_button, can_build && ft->actions->can_compile);
gtk_widget_set_sensitive(widgets.run_button, can_run || can_stop);
ui_widget_set_sensitive(widgets.compile_button, can_build && ft->actions->can_compile);
ui_widget_set_sensitive(widgets.run_button, can_run || can_stop);
/* show the stop command if a program is running, otherwise show run command */
set_stop_button(can_stop);
@ -1747,6 +1748,9 @@ static void set_stop_button(gboolean stop)
GtkWidget *menuitem =
build_get_menu_items(run_info.file_type_id)->item_exec;
if (widgets.run_button == NULL)
return;
if (stop && utils_str_equal(
gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(widgets.run_button)), "gtk-stop")) return;
if (! stop && utils_str_equal(
@ -2077,6 +2081,6 @@ on_build_previous_error (GtkMenuItem *menuitem,
void build_init()
{
widgets.compile_button = lookup_widget(main_widgets.window, "toolbutton_compile");
widgets.run_button = lookup_widget(main_widgets.window, "toolbutton_run");
widgets.compile_button = toolbar_get_widget_by_name("Compile");
widgets.run_button = toolbar_get_widget_by_name("Run");
}

View File

@ -65,6 +65,7 @@
#include "printing.h"
#include "plugins.h"
#include "log.h"
#include "toolbar.h"
#include "geanyobject.h"
@ -424,7 +425,7 @@ on_open1_activate (GtkMenuItem *menuitem,
/* quit toolbar button */
void
on_toolbutton_quit_clicked (GtkToolButton *toolbutton,
on_toolbutton_quit_clicked (GtkAction *action,
gpointer user_data)
{
on_exit_clicked(NULL, NULL);
@ -433,7 +434,7 @@ on_toolbutton_quit_clicked (GtkToolButton *toolbutton,
/* reload file */
void
on_toolbutton_reload_clicked (GtkToolButton *toolbutton,
on_toolbutton_reload_clicked (GtkAction *action,
gpointer user_data)
{
on_reload_as_activate(NULL, GINT_TO_POINTER(-1));
@ -514,7 +515,7 @@ on_change_font1_activate (GtkMenuItem *menuitem,
/* new file */
void
on_toolbutton_new_clicked (GtkToolButton *toolbutton,
on_toolbutton_new_clicked (GtkAction *action,
gpointer user_data)
{
document_new_file(NULL, NULL, NULL);
@ -522,7 +523,7 @@ on_toolbutton_new_clicked (GtkToolButton *toolbutton,
/* open file */
void
on_toolbutton_open_clicked (GtkToolButton *toolbutton,
on_toolbutton_open_clicked (GtkAction *action,
gpointer user_data)
{
dialogs_show_open_file();
@ -531,19 +532,21 @@ on_toolbutton_open_clicked (GtkToolButton *toolbutton,
/* save file */
void
on_toolbutton_save_clicked (GtkToolButton *toolbutton,
on_toolbutton_save_clicked (GtkAction *action,
gpointer user_data)
{
on_save1_activate(NULL, user_data);
}
static void set_search_bar_background(gboolean success)
static void set_search_bar_background(GtkWidget *widget, gboolean success)
{
const GdkColor red = {0, 0xffff, 0x6666, 0x6666};
const GdkColor white = {0, 0xffff, 0xffff, 0xffff};
static gboolean old_value = TRUE;
GtkWidget *widget = lookup_widget(main_widgets.window, "toolbutton_search_entry");
if (widget == NULL)
widget = toolbar_get_widget_child_by_name("SearchEntry");
/* only update if really needed */
if (search_data.search_bar && old_value != success)
@ -557,10 +560,9 @@ static void set_search_bar_background(gboolean success)
/* store text, clear search flags so we can use Search->Find Next/Previous */
static void setup_find_next(GtkEditable *editable)
static void setup_find_next(const gchar *text)
{
g_free(search_data.text);
search_data.text = gtk_editable_get_chars(editable, 0, -1);
setptr(search_data.text, g_strdup(text));
search_data.flags = 0;
search_data.backwards = FALSE;
search_data.search_bar = TRUE;
@ -569,44 +571,34 @@ static void setup_find_next(GtkEditable *editable)
/* search text */
void
on_toolbar_search_entry_activate (GtkEntry *entry,
gpointer user_data)
on_toolbar_search_entry_changed(GtkAction *action, const gchar *text, gpointer user_data)
{
GeanyDocument *doc = document_get_current();
gboolean result;
setup_find_next(GTK_EDITABLE(entry));
result = document_search_bar_find(doc, search_data.text, 0, FALSE);
set_search_bar_background(result);
}
/* search text */
void
on_toolbar_search_entry_changed (GtkEditable *editable,
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
gboolean result;
setup_find_next(editable);
setup_find_next(text);
result = document_search_bar_find(doc, search_data.text, 0, TRUE);
set_search_bar_background(result);
set_search_bar_background(NULL, result);
}
/* search text */
void
on_toolbutton_search_clicked (GtkToolButton *toolbutton,
on_toolbutton_search_clicked (GtkAction *action,
gpointer user_data)
{
GeanyDocument *doc = document_get_current();
gboolean result;
GtkWidget *entry = lookup_widget(GTK_WIDGET(main_widgets.window), "toolbutton_search_entry");
GtkWidget *entry = toolbar_get_widget_child_by_name("SearchEntry");
setup_find_next(GTK_EDITABLE(entry));
if (entry != NULL)
{
const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry));
setup_find_next(text);
result = document_search_bar_find(doc, search_data.text, 0, FALSE);
set_search_bar_background(result);
set_search_bar_background(entry, result);
}
}
@ -617,7 +609,7 @@ on_toolbar_large_icons1_activate (GtkMenuItem *menuitem,
if (ignore_toolbar_toggle) return;
toolbar_prefs.icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
ui_update_toolbar_icons(GTK_ICON_SIZE_LARGE_TOOLBAR);
toolbar_update_icons(GTK_ICON_SIZE_LARGE_TOOLBAR);
}
@ -628,7 +620,7 @@ on_toolbar_small_icons1_activate (GtkMenuItem *menuitem,
if (ignore_toolbar_toggle) return;
toolbar_prefs.icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR;
ui_update_toolbar_icons(GTK_ICON_SIZE_SMALL_TOOLBAR);
toolbar_update_icons(GTK_ICON_SIZE_SMALL_TOOLBAR);
}
@ -689,7 +681,7 @@ on_normal_size1_activate (GtkMenuItem *menuitem,
/* close tab */
void
on_toolbutton_close_clicked (GtkToolButton *toolbutton,
on_toolbutton_close_clicked (GtkAction *action,
gpointer user_data)
{
on_close1_activate(NULL, NULL);
@ -1079,7 +1071,7 @@ on_show_color_chooser1_activate (GtkMenuItem *menuitem,
void
on_compile_button_clicked (GtkToolButton *toolbutton,
on_toolbutton_compile_clicked (GtkAction *action,
gpointer user_data)
{
keybindings_send_command(GEANY_KEY_GROUP_BUILD, GEANY_KEYS_BUILD_COMPILE);
@ -1109,7 +1101,7 @@ static void find_again(gboolean change_direction)
if (result > -1)
editor_display_current_line(doc->editor, 0.3F);
set_search_bar_background((result > -1) ? TRUE : FALSE);
set_search_bar_background(NULL, (result > -1) ? TRUE : FALSE);
}
}
@ -1194,10 +1186,10 @@ on_goto_line_dialog_response (GtkDialog *dialog,
if (response == GTK_RESPONSE_ACCEPT)
{
GeanyDocument *doc = document_get_current();
gint line = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(user_data));
if (doc != NULL)
{
gint line = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(user_data));
if (! editor_goto_line(doc->editor, line - 1))
utils_beep();
}
@ -1208,29 +1200,31 @@ on_goto_line_dialog_response (GtkDialog *dialog,
void
on_goto_line_entry_activate (GtkEntry *entry,
gpointer user_data)
on_toolbutton_goto_entry_activate(GtkAction *action, const gchar *text, gpointer user_data)
{
gtk_spin_button_update(GTK_SPIN_BUTTON(entry));
on_goto_line_dialog_response(GTK_DIALOG(user_data), GTK_RESPONSE_ACCEPT, entry);
GeanyDocument *doc = document_get_current();
if (doc != NULL)
{
gint line = atoi(text);
if (! editor_goto_line(doc->editor, line - 1))
utils_beep();
}
}
void
on_toolbutton_goto_entry_activate (GtkEntry *entry,
on_toolbutton_goto_clicked (GtkAction *action,
gpointer user_data)
{
gtk_spin_button_update(GTK_SPIN_BUTTON(entry));
on_goto_line_dialog_response(NULL, GTK_RESPONSE_ACCEPT, entry);
}
GtkWidget *entry = toolbar_get_widget_child_by_name("GotoEntry");
if (entry != NULL)
{
const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry));
void
on_toolbutton_goto_clicked (GtkToolButton *toolbutton,
gpointer user_data)
{
on_goto_line_dialog_response(NULL, GTK_RESPONSE_ACCEPT,
lookup_widget(main_widgets.window, "toolbutton_goto_entry"));
on_toolbutton_goto_entry_activate(NULL, text, NULL);
}
}
@ -1528,7 +1522,7 @@ on_menu_unfold_all1_activate (GtkMenuItem *menuitem,
void
on_run_button_clicked (GtkToolButton *toolbutton,
on_toolbutton_run_clicked (GtkAction *action,
gpointer user_data)
{
keybindings_send_command(GEANY_KEY_GROUP_BUILD, GEANY_KEYS_BUILD_RUN);

View File

@ -65,7 +65,7 @@ on_change_font1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_toolbutton_close_clicked (GtkToolButton *toolbutton,
on_toolbutton_close_clicked (GtkAction *action,
gpointer user_data);
void
@ -103,11 +103,7 @@ on_replace_tabs_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_toolbutton_search_clicked (GtkToolButton *toolbutton,
gpointer user_data);
void
on_toolbar_search_entry_activate (GtkEntry *entry,
on_toolbutton_search_clicked (GtkAction *action,
gpointer user_data);
gboolean
@ -164,7 +160,8 @@ on_zoom_out1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_toolbar_search_entry_changed (GtkEditable *editable,
on_toolbar_search_entry_changed (GtkAction *action,
const gchar *text,
gpointer user_data);
void
@ -254,23 +251,23 @@ on_find_in_files1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_toolbutton_new_clicked (GtkToolButton *toolbutton,
on_toolbutton_new_clicked (GtkAction *action,
gpointer user_data);
void
on_toolbutton_open_clicked (GtkToolButton *toolbutton,
on_toolbutton_open_clicked (GtkAction *action,
gpointer user_data);
void
on_toolbutton_save_clicked (GtkToolButton *toolbutton,
on_toolbutton_save_clicked (GtkAction *action,
gpointer user_data);
void
on_toolbutton_quit_clicked (GtkToolButton *toolbutton,
on_toolbutton_quit_clicked (GtkAction *action,
gpointer user_data);
void
on_toolbutton_reload_clicked (GtkToolButton *toolbutton,
on_toolbutton_reload_clicked (GtkAction *action,
gpointer user_data);
void
@ -282,17 +279,12 @@ on_goto_line_dialog_response (GtkDialog *dialog,
gint response,
gpointer user_data);
void
on_goto_line_entry_activate (GtkEntry *entry,
gpointer user_data);
void
on_help1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_compile_button_clicked (GtkToolButton *toolbutton,
on_toolbutton_compile_clicked (GtkAction *action,
gpointer user_data);
void
@ -386,15 +378,14 @@ on_menu_unfold_all1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_toolbutton_goto_entry_activate (GtkEntry *entry,
on_toolbutton_goto_entry_activate (GtkAction *action, const gchar *text, gpointer user_data);
void
on_toolbutton_goto_clicked (GtkAction *action,
gpointer user_data);
void
on_toolbutton_goto_clicked (GtkToolButton *toolbutton,
gpointer user_data);
void
on_run_button_clicked (GtkToolButton *toolbutton,
on_toolbutton_run_clicked (GtkAction *action,
gpointer user_data);
void

194
src/geanyentryaction.c Normal file
View File

@ -0,0 +1,194 @@
/*
* geanyEntryaction.c - this file is part of Geany, a fast and lightweight IDE
*
* Copyright 2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* Copyright 2008 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either vergeany 2 of the License, or
* (at your option) any later vergeany.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* GtkAction subclass to provide a GtkEntry in a toolbar.
* This class is missing the action_create_menu_item() function and so can't be
* used for creating menu items. */
#include "geany.h"
#include "support.h"
#include "geanyentryaction.h"
#include <ctype.h>
typedef struct _GeanyEntryActionPrivate GeanyEntryActionPrivate;
#define GEANY_ENTRY_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
GEANY_ENTRY_ACTION_TYPE, GeanyEntryActionPrivate))
struct _GeanyEntryActionPrivate
{
GtkWidget *entry;
gboolean numeric;
};
enum
{
ENTRY_ACTIVATE,
ENTRY_CHANGED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL];
static void geany_entry_action_class_init (GeanyEntryActionClass *klass);
static void geany_entry_action_init (GeanyEntryAction *action);
static GtkActionClass *parent_class = NULL;
GType geany_entry_action_get_type(void)
{
static GType self_type = 0;
if (! self_type)
{
static const GTypeInfo self_info =
{
sizeof(GeanyEntryActionClass),
NULL, NULL,
(GClassInitFunc)geany_entry_action_class_init,
NULL, NULL,
sizeof(GeanyEntryAction),
0,
(GInstanceInitFunc)geany_entry_action_init,
NULL
};
self_type = g_type_register_static(GTK_TYPE_ACTION, "GeanyEntryAction", &self_info, 0);
}
return self_type;
}
static GtkWidget *geany_entry_action_create_tool_item(GtkAction *action)
{
GtkWidget *toolitem;
GeanyEntryActionPrivate *priv = GEANY_ENTRY_ACTION_GET_PRIVATE(action);
priv->entry = gtk_entry_new();
if (priv->numeric)
gtk_entry_set_width_chars(GTK_ENTRY(priv->entry), 8);
gtk_widget_show(priv->entry);
toolitem = g_object_new(GTK_TYPE_TOOL_ITEM, NULL);
gtk_container_add(GTK_CONTAINER(toolitem), priv->entry);
return toolitem;
}
static void delegate_entry_activate_cb(GtkEntry *entry, GeanyEntryAction *action)
{
GeanyEntryActionPrivate *priv = GEANY_ENTRY_ACTION_GET_PRIVATE(action);
const gchar *text = gtk_entry_get_text(GTK_ENTRY(priv->entry));
g_signal_emit(action, signals[ENTRY_ACTIVATE], 0, text);
}
static void delegate_entry_changed_cb(GtkEditable *editable, GeanyEntryAction *action)
{
GeanyEntryActionPrivate *priv = GEANY_ENTRY_ACTION_GET_PRIVATE(action);
const gchar *text = gtk_entry_get_text(GTK_ENTRY(priv->entry));
g_signal_emit(action, signals[ENTRY_CHANGED], 0, text);
}
static void entry_insert_text_cb(GtkEditable *editable, gchar *new_text, gint new_text_len,
gint *position, GeanyEntryAction *action)
{
/* don't insert any text when it is not a digit */
if (! isdigit(*new_text))
g_signal_stop_emission_by_name(editable, "insert-text");
}
static void geany_entry_action_connect_proxy(GtkAction *action, GtkWidget *widget)
{
GeanyEntryActionPrivate *priv = GEANY_ENTRY_ACTION_GET_PRIVATE(action);
if (priv->numeric)
g_signal_connect(priv->entry, "insert-text", G_CALLBACK(entry_insert_text_cb), action);
g_signal_connect(priv->entry, "changed", G_CALLBACK(delegate_entry_changed_cb), action);
g_signal_connect(priv->entry, "activate", G_CALLBACK(delegate_entry_activate_cb), action);
GTK_ACTION_CLASS(parent_class)->connect_proxy(action, widget);
}
static void geany_entry_action_class_init(GeanyEntryActionClass *klass)
{
GtkActionClass *action_class = GTK_ACTION_CLASS(klass);
action_class->connect_proxy = geany_entry_action_connect_proxy;
action_class->create_tool_item = geany_entry_action_create_tool_item;
action_class->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON;
parent_class = (GtkActionClass*)g_type_class_peek(GTK_TYPE_ACTION);
g_type_class_add_private((gpointer)klass, sizeof(GeanyEntryActionPrivate));
signals[ENTRY_CHANGED] = g_signal_new("entry-changed",
G_TYPE_FROM_CLASS(klass),
(GSignalFlags) 0,
0,
0,
NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
signals[ENTRY_ACTIVATE] = g_signal_new("entry-activate",
G_TYPE_FROM_CLASS(klass),
(GSignalFlags) 0,
0,
0,
NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
}
static void geany_entry_action_init(GeanyEntryAction *action)
{
GeanyEntryActionPrivate *priv = GEANY_ENTRY_ACTION_GET_PRIVATE(action);
priv->entry = NULL;
priv->numeric = FALSE;
}
GtkAction *geany_entry_action_new(const gchar *name, const gchar *label,
const gchar *tooltip, gboolean numeric)
{
GtkAction *action = g_object_new(GEANY_ENTRY_ACTION_TYPE,
"name", name,
"label", label,
"tooltip", tooltip,
NULL);
GeanyEntryActionPrivate *priv = GEANY_ENTRY_ACTION_GET_PRIVATE(action);
priv->numeric = numeric;
return action;
}

60
src/geanyentryaction.h Normal file
View File

@ -0,0 +1,60 @@
/*
* geanyEntryaction.h - this file is part of Geany, a fast and lightweight IDE
*
* Copyright 2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* Copyright 2008 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either vergeany 2 of the License, or
* (at your option) any later vergeany.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GEANY_ENTRY_ACTION_H__
#define __GEANY_ENTRY_ACTION_H__
G_BEGIN_DECLS
#define GEANY_ENTRY_ACTION_TYPE (geany_entry_action_get_type())
#define GEANY_ENTRY_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
GEANY_ENTRY_ACTION_TYPE, GeanyEntryAction))
#define GEANY_ENTRY_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
GEANY_ENTRY_ACTION_TYPE, GeanyEntryActionClass))
#define IS_GEANY_ENTRY_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
GEANY_ENTRY_ACTION_TYPE))
#define IS_GEANY_ENTRY_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
GEANY_ENTRY_ACTION_TYPE))
typedef struct _GeanyEntryAction GeanyEntryAction;
typedef struct _GeanyEntryActionClass GeanyEntryActionClass;
struct _GeanyEntryAction
{
GtkAction parent;
};
struct _GeanyEntryActionClass
{
GtkActionClass parent_class;
};
GType geany_entry_action_get_type (void);
GtkAction* geany_entry_action_new (const gchar *name,
const gchar *label,
const gchar *tooltip,
gboolean numeric);
GtkWidget* geany_entry_action_get_menu (GeanyEntryAction *action);
G_END_DECLS
#endif /* __GEANY_ENTRY_ACTION_H__ */

197
src/geanymenubuttonaction.c Normal file
View File

@ -0,0 +1,197 @@
/*
* geanymenubuttonaction.c - this file is part of Geany, a fast and lightweight IDE
*
* Copyright 2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* Copyright 2008 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either vergeany 2 of the License, or
* (at your option) any later vergeany.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* GtkAction subclass to provide a GtkMenuToolButton in a toolbar.
* This class is missing the action_create_menu_item() function and so can't be
* used for creating menu items. */
#include "geany.h"
#include "support.h"
#include "geanymenubuttonaction.h"
typedef struct _GeanyMenubuttonActionPrivate GeanyMenubuttonActionPrivate;
#define GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), \
GEANY_MENU_BUTTON_ACTION_TYPE, GeanyMenubuttonActionPrivate))
struct _GeanyMenubuttonActionPrivate
{
GtkWidget *button;
GtkWidget *menu;
gboolean menu_added;
};
enum
{
BUTTON_CLICKED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL];
static void geany_menu_button_action_class_init (GeanyMenubuttonActionClass *klass);
static void geany_menu_button_action_init (GeanyMenubuttonAction *action);
static GtkActionClass *parent_class = NULL;
GType geany_menu_button_action_get_type(void)
{
static GType self_type = 0;
if (! self_type)
{
static const GTypeInfo self_info =
{
sizeof(GeanyMenubuttonActionClass),
NULL, NULL,
(GClassInitFunc)geany_menu_button_action_class_init,
NULL, NULL,
sizeof(GeanyMenubuttonAction),
0,
(GInstanceInitFunc)geany_menu_button_action_init,
NULL
};
self_type = g_type_register_static(GTK_TYPE_ACTION, "GeanyMenubuttonAction", &self_info, 0);
}
return self_type;
}
static void geany_menu_button_action_finalize(GObject *object)
{
GeanyMenubuttonActionPrivate *priv = GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(object);
g_object_unref(priv->menu);
if (G_OBJECT_CLASS(parent_class)->finalize)
(* G_OBJECT_CLASS(parent_class)->finalize)(object);
}
static void menu_filled_cb(GtkContainer *container, GtkWidget *widget, gpointer data)
{
GeanyMenubuttonActionPrivate *priv = GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(data);
if (! priv->menu_added)
{
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(priv->button), priv->menu);
priv->menu_added = TRUE;
}
}
static void geany_menu_button_action_connect_proxy(GtkAction *action, GtkWidget *widget)
{
GeanyMenubuttonActionPrivate *priv = GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(action);
/* add the menu to the menu button once it got items ("add" from GtkContainer) */
g_signal_connect(priv->menu, "add", G_CALLBACK(menu_filled_cb), action);
GTK_ACTION_CLASS(parent_class)->connect_proxy(action, widget);
}
static void delegate_button_activated(GtkAction *action)
{
g_signal_emit(action, signals[BUTTON_CLICKED], 0);
}
static GtkWidget *geany_menu_button_action_create_tool_item(GtkAction *action)
{
GeanyMenubuttonActionPrivate *priv = GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(action);
priv->menu = gtk_menu_new();
g_object_ref(priv->menu);
gtk_widget_show(priv->menu);
priv->button = g_object_new(GTK_TYPE_MENU_TOOL_BUTTON, NULL);
return priv->button;
}
static void geany_menu_button_action_class_init(GeanyMenubuttonActionClass *klass)
{
GtkActionClass *action_class = GTK_ACTION_CLASS(klass);
GObjectClass *g_object_class = G_OBJECT_CLASS(klass);
g_object_class->finalize = geany_menu_button_action_finalize;
action_class->activate = delegate_button_activated;
action_class->connect_proxy = geany_menu_button_action_connect_proxy;
action_class->create_tool_item = geany_menu_button_action_create_tool_item;
action_class->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON;
parent_class = (GtkActionClass*)g_type_class_peek(GTK_TYPE_ACTION);
g_type_class_add_private((gpointer)klass, sizeof(GeanyMenubuttonActionPrivate));
signals[BUTTON_CLICKED] = g_signal_new("button-clicked",
G_TYPE_FROM_CLASS(klass),
(GSignalFlags) 0,
0,
0,
NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void geany_menu_button_action_init(GeanyMenubuttonAction *action)
{
GeanyMenubuttonActionPrivate *priv = GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(action);
priv->menu = NULL;
priv->button = NULL;
priv->menu_added = FALSE;
}
GtkAction *geany_menu_button_action_new(const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *stock_id)
{
GtkAction *action = g_object_new(GEANY_MENU_BUTTON_ACTION_TYPE,
"name", name,
"label", label,
"tooltip", tooltip,
"stock-id", stock_id,
NULL);
return action;
}
GtkWidget *geany_menu_button_action_get_menu(GeanyMenubuttonAction *action)
{
GeanyMenubuttonActionPrivate *priv;
g_return_val_if_fail(action != NULL, NULL);
priv = GEANY_MENU_BUTTON_ACTION_GET_PRIVATE(action);
return priv->menu;
}

View File

@ -0,0 +1,60 @@
/*
* geanymenubuttonaction.h - this file is part of Geany, a fast and lightweight IDE
*
* Copyright 2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* Copyright 2008 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either vergeany 2 of the License, or
* (at your option) any later vergeany.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GEANY_MENU_BUTTON_ACTION_H__
#define __GEANY_MENU_BUTTON_ACTION_H__
G_BEGIN_DECLS
#define GEANY_MENU_BUTTON_ACTION_TYPE (geany_menu_button_action_get_type())
#define GEANY_MENU_BUTTON_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
GEANY_MENU_BUTTON_ACTION_TYPE, GeanyMenubuttonAction))
#define GEANY_MENU_BUTTON_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
GEANY_MENU_BUTTON_ACTION_TYPE, GeanyMenubuttonActionClass))
#define IS_GEANY_MENU_BUTTON_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
GEANY_MENU_BUTTON_ACTION_TYPE))
#define IS_GEANY_MENU_BUTTON_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
GEANY_MENU_BUTTON_ACTION_TYPE))
typedef struct _GeanyMenubuttonAction GeanyMenubuttonAction;
typedef struct _GeanyMenubuttonActionClass GeanyMenubuttonActionClass;
struct _GeanyMenubuttonAction
{
GtkAction parent;
};
struct _GeanyMenubuttonActionClass
{
GtkActionClass parent_class;
};
GType geany_menu_button_action_get_type (void);
GtkAction* geany_menu_button_action_new (const gchar *name,
const gchar *label,
const gchar *tooltip,
const gchar *stock_id);
GtkWidget* geany_menu_button_action_get_menu (GeanyMenubuttonAction *action);
G_END_DECLS
#endif /* __GEANY_MENU_BUTTON_ACTION_H__ */

View File

@ -215,50 +215,6 @@ create_window1 (void)
GtkWidget *debug_messages1;
GtkWidget *separator16;
GtkWidget *menu_info1;
GtkWidget *toolbar1;
GtkIconSize tmp_toolbar_icon_size;
GtkWidget *toolbutton_new;
GtkWidget *toolbutton_open;
GtkWidget *toolbutton_save;
GtkWidget *toolbutton_saveall;
GtkWidget *separatortoolitem7;
GtkWidget *toolbutton_reload;
GtkWidget *toolbutton_close;
GtkWidget *separatortoolitem2;
GtkWidget *toolbutton_cut;
GtkWidget *toolbutton_copy;
GtkWidget *toolbutton_paste;
GtkWidget *toolbutton_delete;
GtkWidget *separatortoolitem12;
GtkWidget *toolbutton_undo;
GtkWidget *toolbutton_redo;
GtkWidget *separatortoolitem9;
GtkWidget *toolbutton_back;
GtkWidget *toolbutton_forward;
GtkWidget *separatortoolitem10;
GtkWidget *tmp_image;
GtkWidget *toolbutton_compile;
GtkWidget *toolbutton_run;
GtkWidget *separatortoolitem6;
GtkWidget *toolbutton_colour;
GtkWidget *separatortoolitem3;
GtkWidget *toolbutton_zoomin;
GtkWidget *toolbutton_zoomout;
GtkWidget *separatortoolitem4;
GtkWidget *toolbutton_indent_dec;
GtkWidget *toolbutton_indent_inc;
GtkWidget *separatortoolitem11;
GtkWidget *toolbutton_search_item;
GtkWidget *toolbutton_search_entry;
GtkWidget *toolbutton_search;
GtkWidget *separatortoolitem5;
GtkWidget *toolbutton_goto_item;
GtkObject *toolbutton_goto_entry_adj;
GtkWidget *toolbutton_goto_entry;
GtkWidget *toolbutton_goto;
GtkWidget *separatortoolitem8;
GtkWidget *separatortoolitem1;
GtkWidget *toolbutton_quit;
GtkWidget *vpaned1;
GtkWidget *hpaned1;
GtkWidget *notebook3;
@ -1071,212 +1027,6 @@ create_window1 (void)
gtk_widget_show (menu_info1);
gtk_container_add (GTK_CONTAINER (menu_help1_menu), menu_info1);
toolbar1 = gtk_toolbar_new ();
gtk_widget_show (toolbar1);
gtk_box_pack_start (GTK_BOX (vbox1), toolbar1, FALSE, FALSE, 0);
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_ICONS);
tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar1));
toolbutton_new = (GtkWidget*) gtk_menu_tool_button_new_from_stock ("gtk-new");
gtk_widget_show (toolbutton_new);
gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (toolbutton_new), FALSE);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_new);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_new), tooltips, _("Create a new file"), NULL);
toolbutton_open = (GtkWidget*) gtk_menu_tool_button_new_from_stock ("gtk-open");
gtk_widget_show (toolbutton_open);
gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (toolbutton_open), FALSE);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_open);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_open), tooltips, _("Open an existing file"), NULL);
toolbutton_save = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-save");
gtk_widget_show (toolbutton_save);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_save);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_save), tooltips, _("Save the current file"), NULL);
toolbutton_saveall = (GtkWidget*) gtk_tool_button_new (NULL, _("Save all"));
gtk_widget_show (toolbutton_saveall);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_saveall);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_saveall), tooltips, _("Save all open files"), NULL);
separatortoolitem7 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem7);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem7);
toolbutton_reload = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-revert-to-saved");
gtk_widget_show (toolbutton_reload);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_reload);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_reload), tooltips, _("Reload the current file from disk"), NULL);
toolbutton_close = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-close");
gtk_widget_show (toolbutton_close);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_close);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_close), tooltips, _("Close the current file"), NULL);
separatortoolitem2 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem2);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem2);
toolbutton_cut = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-cut");
gtk_widget_show (toolbutton_cut);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_cut);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_cut), tooltips, _("Cut the current selection"), NULL);
toolbutton_copy = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-copy");
gtk_widget_show (toolbutton_copy);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_copy);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_copy), tooltips, _("Copy the current selection"), NULL);
toolbutton_paste = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-paste");
gtk_widget_show (toolbutton_paste);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_paste);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_paste), tooltips, _("Paste the contents of the clipboard"), NULL);
toolbutton_delete = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-delete");
gtk_widget_show (toolbutton_delete);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_delete);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_delete), tooltips, _("Delete the current selection"), NULL);
separatortoolitem12 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem12);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem12);
toolbutton_undo = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-undo");
gtk_widget_show (toolbutton_undo);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_undo);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_undo), tooltips, _("Undo the last modification"), NULL);
toolbutton_redo = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-redo");
gtk_widget_show (toolbutton_redo);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_redo);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_redo), tooltips, _("Redo the last modification"), NULL);
separatortoolitem9 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem9);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem9);
toolbutton_back = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-go-back");
gtk_widget_show (toolbutton_back);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_back);
gtk_widget_set_sensitive (toolbutton_back, FALSE);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_back), tooltips, _("Navigate back a location"), NULL);
toolbutton_forward = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-go-forward");
gtk_widget_show (toolbutton_forward);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_forward);
gtk_widget_set_sensitive (toolbutton_forward, FALSE);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_forward), tooltips, _("Navigate forward a location"), NULL);
separatortoolitem10 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem10);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem10);
tmp_image = gtk_image_new_from_stock ("gtk-convert", tmp_toolbar_icon_size);
gtk_widget_show (tmp_image);
toolbutton_compile = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Compile"));
gtk_widget_show (toolbutton_compile);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_compile);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_compile), tooltips, _("Compile the current file"), NULL);
toolbutton_run = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-execute");
gtk_widget_show (toolbutton_run);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_run);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_run), tooltips, _("Run or view the current file"), NULL);
separatortoolitem6 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem6);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem6);
tmp_image = gtk_image_new_from_stock ("gtk-select-color", tmp_toolbar_icon_size);
gtk_widget_show (tmp_image);
toolbutton_colour = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Color"));
gtk_widget_show (toolbutton_colour);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_colour);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_colour), tooltips, _("Open a color chooser dialog, to interactively pick colors from a palette."), NULL);
separatortoolitem3 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem3);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem3);
toolbutton_zoomin = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-zoom-in");
gtk_widget_show (toolbutton_zoomin);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_zoomin);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_zoomin), tooltips, _("Zoom in the text"), NULL);
toolbutton_zoomout = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-zoom-out");
gtk_widget_show (toolbutton_zoomout);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_zoomout);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_zoomout), tooltips, _("Zoom out the text"), NULL);
separatortoolitem4 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem4);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem4);
toolbutton_indent_dec = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-unindent");
gtk_widget_show (toolbutton_indent_dec);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_indent_dec);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_indent_dec), tooltips, _("Decrease indentation"), NULL);
toolbutton_indent_inc = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-indent");
gtk_widget_show (toolbutton_indent_inc);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_indent_inc);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_indent_inc), tooltips, _("Increase indentation"), NULL);
separatortoolitem11 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem11);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem11);
toolbutton_search_item = (GtkWidget*) gtk_tool_item_new ();
gtk_widget_show (toolbutton_search_item);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_search_item);
toolbutton_search_entry = gtk_entry_new ();
gtk_widget_show (toolbutton_search_entry);
gtk_container_add (GTK_CONTAINER (toolbutton_search_item), toolbutton_search_entry);
gtk_tooltips_set_tip (tooltips, toolbutton_search_entry, _("Find the entered text in the current file"), NULL);
toolbutton_search = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-find");
gtk_widget_show (toolbutton_search);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_search);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_search), tooltips, _("Find the entered text in the current file"), NULL);
separatortoolitem5 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem5);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem5);
toolbutton_goto_item = (GtkWidget*) gtk_tool_item_new ();
gtk_widget_show (toolbutton_goto_item);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_goto_item);
toolbutton_goto_entry_adj = gtk_adjustment_new (0, 1, 100000000, 1, 10, 0);
toolbutton_goto_entry = gtk_spin_button_new (GTK_ADJUSTMENT (toolbutton_goto_entry_adj), 1, 0);
gtk_widget_show (toolbutton_goto_entry);
gtk_container_add (GTK_CONTAINER (toolbutton_goto_item), toolbutton_goto_entry);
gtk_tooltips_set_tip (tooltips, toolbutton_goto_entry, _("Enter a line number and jump to it."), NULL);
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (toolbutton_goto_entry), TRUE);
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (toolbutton_goto_entry), GTK_UPDATE_IF_VALID);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (toolbutton_goto_entry), TRUE);
toolbutton_goto = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-jump-to");
gtk_widget_show (toolbutton_goto);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_goto);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_goto), tooltips, _("Jump to the entered line number."), NULL);
separatortoolitem8 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem8);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem8);
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (separatortoolitem8), FALSE);
separatortoolitem1 = (GtkWidget*) gtk_separator_tool_item_new ();
gtk_widget_show (separatortoolitem1);
gtk_container_add (GTK_CONTAINER (toolbar1), separatortoolitem1);
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (separatortoolitem1), FALSE);
toolbutton_quit = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-quit");
gtk_widget_show (toolbutton_quit);
gtk_container_add (GTK_CONTAINER (toolbar1), toolbutton_quit);
gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (toolbutton_quit), tooltips, _("Quit Geany"), NULL);
vpaned1 = gtk_vpaned_new ();
gtk_widget_show (vpaned1);
gtk_box_pack_start (GTK_BOX (vbox1), vpaned1, TRUE, TRUE, 0);
@ -1681,90 +1431,6 @@ create_window1 (void)
g_signal_connect ((gpointer) menu_info1, "activate",
G_CALLBACK (on_info1_activate),
NULL);
g_signal_connect ((gpointer) toolbar1, "key_press_event",
G_CALLBACK (on_escape_key_press_event),
NULL);
g_signal_connect ((gpointer) toolbutton_new, "clicked",
G_CALLBACK (on_toolbutton_new_clicked),
NULL);
g_signal_connect ((gpointer) toolbutton_open, "clicked",
G_CALLBACK (on_toolbutton_open_clicked),
NULL);
g_signal_connect ((gpointer) toolbutton_save, "clicked",
G_CALLBACK (on_toolbutton_save_clicked),
NULL);
g_signal_connect ((gpointer) toolbutton_saveall, "clicked",
G_CALLBACK (on_save_all1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_reload, "clicked",
G_CALLBACK (on_toolbutton_reload_clicked),
NULL);
g_signal_connect ((gpointer) toolbutton_close, "clicked",
G_CALLBACK (on_toolbutton_close_clicked),
NULL);
g_signal_connect ((gpointer) toolbutton_cut, "clicked",
G_CALLBACK (on_cut1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_copy, "clicked",
G_CALLBACK (on_copy1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_paste, "clicked",
G_CALLBACK (on_paste1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_delete, "clicked",
G_CALLBACK (on_delete1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_undo, "clicked",
G_CALLBACK (on_undo1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_redo, "clicked",
G_CALLBACK (on_redo1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_back, "clicked",
G_CALLBACK (on_back_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_forward, "clicked",
G_CALLBACK (on_forward_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_compile, "clicked",
G_CALLBACK (on_compile_button_clicked),
NULL);
g_signal_connect ((gpointer) toolbutton_run, "clicked",
G_CALLBACK (on_run_button_clicked),
NULL);
g_signal_connect ((gpointer) toolbutton_colour, "clicked",
G_CALLBACK (on_show_color_chooser1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_zoomin, "clicked",
G_CALLBACK (on_zoom_in1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_zoomout, "clicked",
G_CALLBACK (on_zoom_out1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_indent_dec, "clicked",
G_CALLBACK (on_menu_decrease_indent1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_indent_inc, "clicked",
G_CALLBACK (on_menu_increase_indent1_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_search_entry, "activate",
G_CALLBACK (on_toolbar_search_entry_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_search_entry, "changed",
G_CALLBACK (on_toolbar_search_entry_changed),
NULL);
g_signal_connect ((gpointer) toolbutton_search, "clicked",
G_CALLBACK (on_toolbutton_search_clicked),
NULL);
g_signal_connect ((gpointer) toolbutton_goto_entry, "activate",
G_CALLBACK (on_toolbutton_goto_entry_activate),
NULL);
g_signal_connect ((gpointer) toolbutton_goto, "clicked",
G_CALLBACK (on_toolbutton_goto_clicked),
NULL);
g_signal_connect ((gpointer) toolbutton_quit, "clicked",
G_CALLBACK (on_toolbutton_quit_clicked),
NULL);
g_signal_connect ((gpointer) notebook3, "switch_page",
G_CALLBACK (on_tv_notebook_switch_page),
NULL);
@ -1969,47 +1635,6 @@ create_window1 (void)
GLADE_HOOKUP_OBJECT (window1, debug_messages1, "debug_messages1");
GLADE_HOOKUP_OBJECT (window1, separator16, "separator16");
GLADE_HOOKUP_OBJECT (window1, menu_info1, "menu_info1");
GLADE_HOOKUP_OBJECT (window1, toolbar1, "toolbar1");
GLADE_HOOKUP_OBJECT (window1, toolbutton_new, "toolbutton_new");
GLADE_HOOKUP_OBJECT (window1, toolbutton_open, "toolbutton_open");
GLADE_HOOKUP_OBJECT (window1, toolbutton_save, "toolbutton_save");
GLADE_HOOKUP_OBJECT (window1, toolbutton_saveall, "toolbutton_saveall");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem7, "separatortoolitem7");
GLADE_HOOKUP_OBJECT (window1, toolbutton_reload, "toolbutton_reload");
GLADE_HOOKUP_OBJECT (window1, toolbutton_close, "toolbutton_close");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem2, "separatortoolitem2");
GLADE_HOOKUP_OBJECT (window1, toolbutton_cut, "toolbutton_cut");
GLADE_HOOKUP_OBJECT (window1, toolbutton_copy, "toolbutton_copy");
GLADE_HOOKUP_OBJECT (window1, toolbutton_paste, "toolbutton_paste");
GLADE_HOOKUP_OBJECT (window1, toolbutton_delete, "toolbutton_delete");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem12, "separatortoolitem12");
GLADE_HOOKUP_OBJECT (window1, toolbutton_undo, "toolbutton_undo");
GLADE_HOOKUP_OBJECT (window1, toolbutton_redo, "toolbutton_redo");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem9, "separatortoolitem9");
GLADE_HOOKUP_OBJECT (window1, toolbutton_back, "toolbutton_back");
GLADE_HOOKUP_OBJECT (window1, toolbutton_forward, "toolbutton_forward");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem10, "separatortoolitem10");
GLADE_HOOKUP_OBJECT (window1, toolbutton_compile, "toolbutton_compile");
GLADE_HOOKUP_OBJECT (window1, toolbutton_run, "toolbutton_run");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem6, "separatortoolitem6");
GLADE_HOOKUP_OBJECT (window1, toolbutton_colour, "toolbutton_colour");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem3, "separatortoolitem3");
GLADE_HOOKUP_OBJECT (window1, toolbutton_zoomin, "toolbutton_zoomin");
GLADE_HOOKUP_OBJECT (window1, toolbutton_zoomout, "toolbutton_zoomout");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem4, "separatortoolitem4");
GLADE_HOOKUP_OBJECT (window1, toolbutton_indent_dec, "toolbutton_indent_dec");
GLADE_HOOKUP_OBJECT (window1, toolbutton_indent_inc, "toolbutton_indent_inc");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem11, "separatortoolitem11");
GLADE_HOOKUP_OBJECT (window1, toolbutton_search_item, "toolbutton_search_item");
GLADE_HOOKUP_OBJECT (window1, toolbutton_search_entry, "toolbutton_search_entry");
GLADE_HOOKUP_OBJECT (window1, toolbutton_search, "toolbutton_search");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem5, "separatortoolitem5");
GLADE_HOOKUP_OBJECT (window1, toolbutton_goto_item, "toolbutton_goto_item");
GLADE_HOOKUP_OBJECT (window1, toolbutton_goto_entry, "toolbutton_goto_entry");
GLADE_HOOKUP_OBJECT (window1, toolbutton_goto, "toolbutton_goto");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem8, "separatortoolitem8");
GLADE_HOOKUP_OBJECT (window1, separatortoolitem1, "separatortoolitem1");
GLADE_HOOKUP_OBJECT (window1, toolbutton_quit, "toolbutton_quit");
GLADE_HOOKUP_OBJECT (window1, vpaned1, "vpaned1");
GLADE_HOOKUP_OBJECT (window1, hpaned1, "hpaned1");
GLADE_HOOKUP_OBJECT (window1, notebook3, "notebook3");
@ -2700,22 +2325,6 @@ create_prefs_dialog (void)
GtkWidget *alignment31;
GtkWidget *check_toolbar_show;
GtkWidget *label196;
GtkWidget *frame11;
GtkWidget *alignment14;
GtkWidget *vbox16;
GtkWidget *check_toolbar_fileops;
GtkWidget *check_toolbar_cutdelete;
GtkWidget *check_toolbar_copypaste;
GtkWidget *check_toolbar_undo;
GtkWidget *check_toolbar_navigation;
GtkWidget *check_toolbar_compile;
GtkWidget *check_toolbar_colour;
GtkWidget *check_toolbar_zoom;
GtkWidget *check_toolbar_indent;
GtkWidget *check_toolbar_search;
GtkWidget *check_toolbar_goto;
GtkWidget *check_toolbar_quit;
GtkWidget *label165;
GtkWidget *frame13;
GtkWidget *alignment16;
GtkWidget *table9;
@ -3481,85 +3090,6 @@ create_prefs_dialog (void)
gtk_frame_set_label_widget (GTK_FRAME (frame28), label196);
gtk_label_set_use_markup (GTK_LABEL (label196), TRUE);
frame11 = gtk_frame_new (NULL);
gtk_widget_show (frame11);
gtk_box_pack_start (GTK_BOX (vbox15), frame11, FALSE, FALSE, 0);
gtk_frame_set_shadow_type (GTK_FRAME (frame11), GTK_SHADOW_NONE);
alignment14 = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_widget_show (alignment14);
gtk_container_add (GTK_CONTAINER (frame11), alignment14);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment14), 0, 0, 12, 0);
vbox16 = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox16);
gtk_container_add (GTK_CONTAINER (alignment14), vbox16);
check_toolbar_fileops = gtk_check_button_new_with_mnemonic (_("Show File Operation buttons"));
gtk_widget_show (check_toolbar_fileops);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_fileops, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_fileops, _("Display the New, Open, Close, Save and Reload buttons in the toolbar"), NULL);
check_toolbar_cutdelete = gtk_check_button_new_with_mnemonic (_("Show Cut and Delete buttons"));
gtk_widget_show (check_toolbar_cutdelete);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_cutdelete, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_cutdelete, _("Display the Cut and Delete buttons in the toolbar"), NULL);
check_toolbar_copypaste = gtk_check_button_new_with_mnemonic (_("Show Copy and Paste buttons"));
gtk_widget_show (check_toolbar_copypaste);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_copypaste, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_copypaste, _("Display the Copy and Paste buttons in the toolbar"), NULL);
check_toolbar_undo = gtk_check_button_new_with_mnemonic (_("Show Redo and Undo buttons"));
gtk_widget_show (check_toolbar_undo);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_undo, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_undo, _("Display the Redo and Undo buttons in the toolbar"), NULL);
check_toolbar_navigation = gtk_check_button_new_with_mnemonic (_("Show Back and Forward buttons"));
gtk_widget_show (check_toolbar_navigation);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_navigation, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_navigation, _("Display the Back and Forward buttons in the toolbar used for code navigation"), NULL);
check_toolbar_compile = gtk_check_button_new_with_mnemonic (_("Show Compile and Run buttons"));
gtk_widget_show (check_toolbar_compile);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_compile, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_compile, _("Display the Compile and Run buttons in the toolbar"), NULL);
check_toolbar_colour = gtk_check_button_new_with_mnemonic (_("Show Color Chooser button"));
gtk_widget_show (check_toolbar_colour);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_colour, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_colour, _("Display the Color Chooser button in the toolbar"), NULL);
check_toolbar_zoom = gtk_check_button_new_with_mnemonic (_("Show Zoom In and Zoom Out buttons"));
gtk_widget_show (check_toolbar_zoom);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_zoom, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_zoom, _("Display the Zoom In and Zoom Out buttons in the toolbar"), NULL);
check_toolbar_indent = gtk_check_button_new_with_mnemonic (_("Show Increase and Decrease Indentation buttons"));
gtk_widget_show (check_toolbar_indent);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_indent, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_indent, _("Display the Increase and Decrease Indentation buttons in the toolbar"), NULL);
check_toolbar_search = gtk_check_button_new_with_mnemonic (_("Show Search field"));
gtk_widget_show (check_toolbar_search);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_search, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_search, _("Display the search field and button in the toolbar"), NULL);
check_toolbar_goto = gtk_check_button_new_with_mnemonic (_("Show Go to Line field"));
gtk_widget_show (check_toolbar_goto);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_goto, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_goto, _("Display the line number field and button in the toolbar"), NULL);
check_toolbar_quit = gtk_check_button_new_with_mnemonic (_("Show Quit button"));
gtk_widget_show (check_toolbar_quit);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_quit, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, check_toolbar_quit, _("Display the quit button in the toolbar"), NULL);
label165 = gtk_label_new (_("<b>Items</b>"));
gtk_widget_show (label165);
gtk_frame_set_label_widget (GTK_FRAME (frame11), label165);
gtk_label_set_use_markup (GTK_LABEL (label165), TRUE);
frame13 = gtk_frame_new (NULL);
gtk_widget_show (frame13);
gtk_box_pack_start (GTK_BOX (vbox15), frame13, FALSE, FALSE, 0);
@ -5014,22 +4544,6 @@ create_prefs_dialog (void)
GLADE_HOOKUP_OBJECT (prefs_dialog, alignment31, "alignment31");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_show, "check_toolbar_show");
GLADE_HOOKUP_OBJECT (prefs_dialog, label196, "label196");
GLADE_HOOKUP_OBJECT (prefs_dialog, frame11, "frame11");
GLADE_HOOKUP_OBJECT (prefs_dialog, alignment14, "alignment14");
GLADE_HOOKUP_OBJECT (prefs_dialog, vbox16, "vbox16");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_fileops, "check_toolbar_fileops");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_cutdelete, "check_toolbar_cutdelete");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_copypaste, "check_toolbar_copypaste");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_undo, "check_toolbar_undo");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_navigation, "check_toolbar_navigation");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_compile, "check_toolbar_compile");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_colour, "check_toolbar_colour");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_zoom, "check_toolbar_zoom");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_indent, "check_toolbar_indent");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_search, "check_toolbar_search");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_goto, "check_toolbar_goto");
GLADE_HOOKUP_OBJECT (prefs_dialog, check_toolbar_quit, "check_toolbar_quit");
GLADE_HOOKUP_OBJECT (prefs_dialog, label165, "label165");
GLADE_HOOKUP_OBJECT (prefs_dialog, frame13, "frame13");
GLADE_HOOKUP_OBJECT (prefs_dialog, alignment16, "alignment16");
GLADE_HOOKUP_OBJECT (prefs_dialog, table9, "table9");

View File

@ -44,6 +44,7 @@
#include "navqueue.h"
#include "symbols.h"
#include "vte.h"
#include "toolbar.h"
GPtrArray *keybinding_groups; /* array of GeanyKeyGroup pointers */
@ -1242,9 +1243,12 @@ static void cb_func_switch_action(guint key_id)
msgwin_switch_tab(MSG_SCRATCH, TRUE);
break;
case GEANY_KEYS_FOCUS_SEARCHBAR:
if (toolbar_prefs.visible && toolbar_prefs.show_search)
gtk_widget_grab_focus(
lookup_widget(main_widgets.window, "toolbutton_search_entry"));
if (toolbar_prefs.visible)
{
GtkWidget *search_entry = toolbar_get_widget_child_by_name("SearchEntry");
if (search_entry != NULL)
gtk_widget_grab_focus(search_entry);
}
break;
case GEANY_KEYS_FOCUS_SIDEBAR:
focus_sidebar();

View File

@ -59,6 +59,7 @@
#include "printing.h"
#include "plugins.h"
#include "templates.h"
#include "toolbar.h"
#include "stash.h"
@ -350,18 +351,6 @@ static void save_dialog_prefs(GKeyFile *config)
/* toolbar */
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show", toolbar_prefs.visible);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_search", toolbar_prefs.show_search);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_goto", toolbar_prefs.show_goto);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_zoom", toolbar_prefs.show_zoom);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_indent", toolbar_prefs.show_indent);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_undo", toolbar_prefs.show_undo);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_navigation", toolbar_prefs.show_navigation);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_compile", toolbar_prefs.show_compile);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_colour", toolbar_prefs.show_colour);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_fileops", toolbar_prefs.show_fileops);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_cutdelete", toolbar_prefs.show_cutdelete);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_copypaste", toolbar_prefs.show_copypaste);
g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_quit", toolbar_prefs.show_quit);
g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_style", toolbar_prefs.icon_style);
g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_size", toolbar_prefs.icon_size);
@ -658,18 +647,6 @@ static void load_dialog_prefs(GKeyFile *config)
/* toolbar */
toolbar_prefs.visible = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show", TRUE);
toolbar_prefs.show_search = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_search", TRUE);
toolbar_prefs.show_goto = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_goto", TRUE);
toolbar_prefs.show_zoom = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_zoom", FALSE);
toolbar_prefs.show_indent = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_indent", FALSE);
toolbar_prefs.show_compile = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_compile", TRUE);
toolbar_prefs.show_undo = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_undo", FALSE);
toolbar_prefs.show_navigation = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_navigation", TRUE);
toolbar_prefs.show_colour = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_colour", TRUE);
toolbar_prefs.show_fileops = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_fileops", TRUE);
toolbar_prefs.show_cutdelete = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_cutdelete", FALSE);
toolbar_prefs.show_copypaste = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_copypaste", FALSE);
toolbar_prefs.show_quit = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_quit", TRUE);
{
GtkIconSize tb_iconsize;
GtkToolbarStyle tb_style;

View File

@ -72,6 +72,7 @@
#include "navqueue.h"
#include "plugins.h"
#include "printing.h"
#include "toolbar.h"
#include "geanyobject.h"
#ifdef HAVE_SOCKET
@ -207,7 +208,7 @@ static void apply_settings(void)
{
gtk_toolbar_set_icon_size(GTK_TOOLBAR(main_widgets.toolbar), toolbar_prefs.icon_size);
}
ui_update_toolbar_icons(toolbar_prefs.icon_size);
toolbar_update_icons(toolbar_prefs.icon_size);
/* line number and markers margin are by default enabled */
if (! editor_prefs.show_markers_margin)
@ -236,17 +237,11 @@ static void apply_settings(void)
gtk_widget_hide(ui_widgets.statusbar);
}
/* connect the toolbar dropdown menu for the new button */
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(
lookup_widget(main_widgets.window, "toolbutton_new")), ui_widgets.new_file_menu);
/* set the tab placements of the notebooks */
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.tab_pos_editor);
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), interface_prefs.tab_pos_msgwin);
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(main_widgets.sidebar_notebook), interface_prefs.tab_pos_sidebar);
ui_update_toolbar_items();
/* whether to show notebook tabs or not */
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs);
}
@ -272,15 +267,13 @@ static void main_init(void)
main_status.opening_session_files = FALSE;
main_widgets.window = create_window1();
ui_widgets.new_file_menu = gtk_menu_new();
ui_widgets.recent_files_toolbar = gtk_menu_new();
ui_widgets.recent_files_menuitem = lookup_widget(main_widgets.window, "recent_files1");
ui_widgets.recent_files_menubar = gtk_menu_new();
ui_widgets.recent_files_menu_menubar = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(ui_widgets.recent_files_menuitem),
ui_widgets.recent_files_menubar);
ui_widgets.recent_files_menu_menubar);
/* store important pointers for later reference */
main_widgets.toolbar = lookup_widget(main_widgets.window, "toolbar1");
main_widgets.toolbar = toolbar_init();
main_widgets.sidebar_notebook = lookup_widget(main_widgets.window, "notebook3");
main_widgets.notebook = lookup_widget(main_widgets.window, "notebook1");
main_widgets.editor_menu = create_edit_menu1();
@ -966,16 +959,22 @@ gint main(gint argc, gchar **argv)
}
/* registering some basic events */
{
GtkWidget *entry;
g_signal_connect(main_widgets.window, "delete-event", G_CALLBACK(on_exit_clicked), NULL);
g_signal_connect(main_widgets.window, "key-press-event", G_CALLBACK(keybindings_got_event), NULL);
g_signal_connect(main_widgets.toolbar, "button-press-event", G_CALLBACK(toolbar_popup_menu), NULL);
g_signal_connect(lookup_widget(main_widgets.window, "textview_scribble"),
"motion-notify-event", G_CALLBACK(on_motion_event), NULL);
g_signal_connect(lookup_widget(main_widgets.window, "toolbutton_search_entry"),
"motion-notify-event", G_CALLBACK(on_motion_event), NULL);
g_signal_connect(lookup_widget(main_widgets.window, "toolbutton_goto_entry"),
"motion-notify-event", G_CALLBACK(on_motion_event), NULL);
entry = toolbar_get_widget_child_by_name("SearchEntry");
if (entry != NULL)
g_signal_connect(entry, "motion-notify-event", G_CALLBACK(on_motion_event), NULL);
entry = toolbar_get_widget_child_by_name("GotoEntry");
if (entry != NULL)
g_signal_connect(entry, "motion-notify-event", G_CALLBACK(on_motion_event), NULL);
}
#ifdef HAVE_VTE
vte_init();
#endif
@ -1064,6 +1063,7 @@ void main_quit()
editor_finalize();
editor_snippets_free();
encodings_finalize();
toolbar_finalize();
log_finalize();
tm_workspace_free(TM_WORK_OBJECT(app->tm_workspace));

View File

@ -61,10 +61,11 @@ CFLAGS=-O2 $(CBASEFLAGS)
endif
OBJS = about.o build.o callbacks.o dialogs.o document.o editor.o encodings.o filetypes.o \
geanyobject.o geanywraplabel.o highlighting.o interface.o keybindings.o keyfile.o \
geanyentryaction.c geanymenubuttonaction.o geanyobject.o geanywraplabel.o highlighting.o \
interface.o keybindings.o keyfile.o \
log.o main.o msgwindow.o navqueue.o notebook.o plugins.o prefs.o printing.o project.o \
sciwrappers.o search.o socket.o stash.o \
support.o symbols.o templates.o treeviews.o tools.o \
support.o symbols.o templates.o toolbar.o tools.o treeviews.o \
ui_utils.o utils.o win32.o
.c.o:

View File

@ -35,6 +35,7 @@
#include "ui_utils.h"
#include "editor.h"
#include "navqueue.h"
#include "toolbar.h"
/* for the navigation history queue */
@ -47,7 +48,7 @@ typedef struct
static GQueue *navigation_queue;
static guint nav_queue_pos;
static GtkWidget *navigation_buttons[2];
static GtkAction *navigation_buttons[2];
@ -56,8 +57,8 @@ void navqueue_init()
navigation_queue = g_queue_new();
nav_queue_pos = 0;
navigation_buttons[0] = lookup_widget(main_widgets.window, "toolbutton_back");
navigation_buttons[1] = lookup_widget(main_widgets.window, "toolbutton_forward");
navigation_buttons[0] = toolbar_get_action_by_name("NavBack");
navigation_buttons[1] = toolbar_get_action_by_name("NavFor");
}
@ -75,23 +76,23 @@ static void adjust_buttons(void)
{
if (g_queue_get_length(navigation_queue) < 2)
{
gtk_widget_set_sensitive(navigation_buttons[0], FALSE);
gtk_widget_set_sensitive(navigation_buttons[1], FALSE);
gtk_action_set_sensitive(navigation_buttons[0], FALSE);
gtk_action_set_sensitive(navigation_buttons[1], FALSE);
return;
}
if (nav_queue_pos == 0)
{
gtk_widget_set_sensitive(navigation_buttons[0], TRUE);
gtk_widget_set_sensitive(navigation_buttons[1], FALSE);
gtk_action_set_sensitive(navigation_buttons[0], TRUE);
gtk_action_set_sensitive(navigation_buttons[1], FALSE);
return;
}
/* forward should be sensitive since where not at the start */
gtk_widget_set_sensitive(navigation_buttons[1], TRUE);
gtk_action_set_sensitive(navigation_buttons[1], TRUE);
/* back should be sensitive if there's a place to go back to */
(nav_queue_pos < g_queue_get_length(navigation_queue) - 1) ?
gtk_widget_set_sensitive(navigation_buttons[0], TRUE) :
gtk_widget_set_sensitive(navigation_buttons[0], FALSE);
gtk_action_set_sensitive(navigation_buttons[0], TRUE) :
gtk_action_set_sensitive(navigation_buttons[0], FALSE);
}

View File

@ -45,13 +45,13 @@
enum {
/** The Application Programming Interface (API) version, incremented
* whenever any plugin data types are modified or appended to. */
GEANY_API_VERSION = 117,
GEANY_API_VERSION = 118,
/** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered. */
/* This should usually stay the same if fields are only appended, assuming only pointers to
* structs and not structs themselves are declared by plugins. */
GEANY_ABI_VERSION = 51
GEANY_ABI_VERSION = 52
};
/** Check the plugin can be loaded by Geany.

View File

@ -58,6 +58,7 @@
#include "keybindings.h"
#include "navqueue.h"
#include "main.h"
#include "toolbar.h"
#ifdef G_OS_WIN32
@ -1253,7 +1254,7 @@ void plugin_add_toolbar_item(GeanyPlugin *plugin, GtkToolItem *item)
{
GtkToolItem *sep;
pos = ui_get_toolbar_insert_position();
pos = toolbar_get_insert_position();
/* pos should be valid even if the quit btn is hidden */
g_return_if_fail(pos >= 0);
gtk_toolbar_insert(toolbar, item, pos);

View File

@ -52,6 +52,7 @@
#include "geanywraplabel.h"
#include "templates.h"
#include "search.h"
#include "toolbar.h"
#ifdef HAVE_VTE
# include "vte.h"
@ -440,43 +441,6 @@ void prefs_init_dialog(void)
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_show");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.visible);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_search");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_search);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_goto");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_goto);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_compile");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_compile);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_zoom");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_zoom);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_indent");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_indent);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_undo");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_undo);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_navigation");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_navigation);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_colour");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_colour);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_fileops");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_fileops);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_cutdelete");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_cutdelete);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_copypaste");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_copypaste);
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_quit");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), toolbar_prefs.show_quit);
switch (toolbar_prefs.icon_style)
{
case 0: widget = lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_image"); break;
@ -869,42 +833,6 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_show");
toolbar_prefs.visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_search");
toolbar_prefs.show_search = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_goto");
toolbar_prefs.show_goto = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_zoom");
toolbar_prefs.show_zoom = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_indent");
toolbar_prefs.show_indent = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_undo");
toolbar_prefs.show_undo = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_navigation");
toolbar_prefs.show_navigation = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_compile");
toolbar_prefs.show_compile = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_colour");
toolbar_prefs.show_colour = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_fileops");
toolbar_prefs.show_fileops = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_cutdelete");
toolbar_prefs.show_cutdelete = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_copypaste");
toolbar_prefs.show_copypaste = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_quit");
toolbar_prefs.show_quit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(ui_widgets.prefs_dialog, "radio_toolbar_imagetext");
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) toolbar_prefs.icon_style = 2;
else
@ -1168,8 +1096,7 @@ on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_data)
/* apply the changes made */
ui_statusbar_showhide(interface_prefs.statusbar_visible);
treeviews_openfiles_update_all(); /* to update if full path setting has changed */
ui_update_toolbar_items();
ui_update_toolbar_icons(toolbar_prefs.icon_size);
toolbar_update_icons(toolbar_prefs.icon_size);
gtk_toolbar_set_style(GTK_TOOLBAR(main_widgets.toolbar), toolbar_prefs.icon_style);
ui_sidebar_show_hide();
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(main_widgets.notebook), interface_prefs.show_notebook_tabs);
@ -1243,9 +1170,10 @@ void on_prefs_font_choosed(GtkFontButton *widget, gpointer user_data)
{
case 1:
{
if (strcmp(fontbtn, interface_prefs.tagbar_font) == 0) break;
g_free(interface_prefs.tagbar_font);
interface_prefs.tagbar_font = g_strdup(fontbtn);
if (strcmp(fontbtn, interface_prefs.tagbar_font) == 0)
break;
setptr(interface_prefs.tagbar_font, g_strdup(fontbtn));
for (i = 0; i < documents_array->len; i++)
{
GeanyDocument *doc = documents[i];
@ -1256,17 +1184,13 @@ void on_prefs_font_choosed(GtkFontButton *widget, gpointer user_data)
}
if (GTK_IS_WIDGET(tv.default_tag_tree))
ui_widget_modify_font_from_string(tv.default_tag_tree, interface_prefs.tagbar_font);
ui_widget_modify_font_from_string(
lookup_widget(main_widgets.window, "toolbutton_search_entry"),
interface_prefs.tagbar_font);
break;
}
case 2:
{
if (strcmp(fontbtn, interface_prefs.msgwin_font) == 0)
break;
g_free(interface_prefs.msgwin_font);
interface_prefs.msgwin_font = g_strdup(fontbtn);
setptr(interface_prefs.msgwin_font, g_strdup(fontbtn));
ui_widget_modify_font_from_string(msgwindow.tree_compiler, interface_prefs.msgwin_font);
ui_widget_modify_font_from_string(msgwindow.tree_msg, interface_prefs.msgwin_font);
ui_widget_modify_font_from_string(msgwindow.tree_status, interface_prefs.msgwin_font);
@ -1281,9 +1205,9 @@ void on_prefs_font_choosed(GtkFontButton *widget, gpointer user_data)
case 4:
{
/* VTE settings */
if (strcmp(fontbtn, vc->font) == 0) break;
g_free(vc->font);
vc->font = g_strdup(gtk_font_button_get_font_name(widget));
if (strcmp(fontbtn, vc->font) == 0)
break;
setptr(vc->font, g_strdup(gtk_font_button_get_font_name(widget)));
vte_apply_user_settings();
break;
}
@ -1541,7 +1465,6 @@ static void on_toolbar_show_toggled(GtkToggleButton *togglebutton, gpointer user
{
gboolean sens = gtk_toggle_button_get_active(togglebutton);
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "frame11"), sens);
gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "frame13"), sens);
}
@ -1631,8 +1554,8 @@ void prefs_show_dialog(void)
gtk_combo_box_append_text(GTK_COMBO_BOX(combo_eol), utils_get_eol_name(SC_EOL_CR));
gtk_combo_box_append_text(GTK_COMBO_BOX(combo_eol), utils_get_eol_name(SC_EOL_LF));
/* add manually GeanyWrapLabels because it can't be added with Glade
* page Tools */
/* add manually GeanyWrapLabels because they can't be added with Glade */
/* page Tools */
label = geany_wrap_label_new(_("Enter tool paths below. Tools you do not need can be left blank."));
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(lookup_widget(ui_widgets.prefs_dialog, "vbox33")),
@ -1658,6 +1581,12 @@ void prefs_show_dialog(void)
gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(lookup_widget(ui_widgets.prefs_dialog, "vbox27")),
label, FALSE, TRUE, 5);
/* page Toolbar */
label = geany_wrap_label_new(_("<i>Notice: To customize the toolbar elements, edit the file 'ui_toolbar.xml'. Please see the documentation for details.</i>"));
gtk_widget_show(label);
gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(lookup_widget(ui_widgets.prefs_dialog, "vbox15")),
label, FALSE, TRUE, 5);
#ifdef HAVE_VTE

View File

@ -374,14 +374,19 @@ static void create_new_menu_items(void)
continue;
if (ft_id == GEANY_FILETYPES_NONE)
label = _("None");
tmp_menu = gtk_menu_item_new_with_label(label);
tmp_button = gtk_menu_item_new_with_label(label);
gtk_widget_show(tmp_menu);
gtk_widget_show(tmp_button);
gtk_container_add(GTK_CONTAINER(new_with_template_menu), tmp_menu);
g_signal_connect(tmp_menu, "activate", G_CALLBACK(on_new_with_template), ft);
if (ui_widgets.new_file_menu != NULL)
{
tmp_button = gtk_menu_item_new_with_label(label);
gtk_widget_show(tmp_button);
gtk_container_add(GTK_CONTAINER(ui_widgets.new_file_menu), tmp_button);
g_signal_connect(tmp_menu, "activate", G_CALLBACK(on_new_with_template), (gpointer) ft);
g_signal_connect(tmp_button, "activate", G_CALLBACK(on_new_with_template), (gpointer) ft);
g_signal_connect(tmp_button, "activate", G_CALLBACK(on_new_with_template), ft);
}
}
}
@ -447,16 +452,18 @@ static void add_file_item(gpointer data, gpointer user_data)
label = utils_get_utf8_from_locale(data);
tmp_menu = gtk_menu_item_new_with_label(label);
tmp_button = gtk_menu_item_new_with_label(label);
g_free(label);
gtk_widget_show(tmp_menu);
gtk_widget_show(tmp_button);
gtk_container_add(GTK_CONTAINER(new_with_template_menu), tmp_menu);
gtk_container_add(GTK_CONTAINER(ui_widgets.new_file_menu), tmp_button);
g_signal_connect(tmp_menu, "activate", G_CALLBACK(on_new_with_file_template), NULL);
if (ui_widgets.new_file_menu != NULL)
{
tmp_button = gtk_menu_item_new_with_label(label);
gtk_widget_show(tmp_button);
gtk_container_add(GTK_CONTAINER(ui_widgets.new_file_menu), tmp_button);
g_signal_connect(tmp_button, "activate", G_CALLBACK(on_new_with_file_template), NULL);
}
g_free(label);
}
@ -509,12 +516,15 @@ static void create_file_template_menus(void)
sep1 = gtk_separator_menu_item_new();
gtk_container_add(GTK_CONTAINER(new_with_template_menu), sep1);
if (ui_widgets.new_file_menu != NULL)
{
sep2 = gtk_separator_menu_item_new();
gtk_container_add(GTK_CONTAINER(ui_widgets.new_file_menu), sep2);
}
if (add_custom_template_items())
{
gtk_widget_show(sep1);
if (ui_widgets.new_file_menu != NULL)
gtk_widget_show(sep2);
}
}
@ -800,11 +810,14 @@ void templates_free_templates(void)
g_free(ft_templates[i]);
}
/* destroy "New with template" sub menu items (in case we want to reload the templates) */
if (ui_widgets.new_file_menu != NULL)
{
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.new_file_menu));
for (item = children; item != NULL; item = g_list_next(item))
{
gtk_widget_destroy(GTK_WIDGET(item->data));
}
}
children = gtk_container_get_children(GTK_CONTAINER(new_with_template_menu));
for (item = children; item != NULL; item = g_list_next(item))
{

343
src/toolbar.c Normal file
View File

@ -0,0 +1,343 @@
/*
* toolbar.c - this file is part of Geany, a fast and lightweight IDE
*
* Copyright 2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* Copyright 2008 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
*/
/** @file toolbar.c
* Utility functions to create the toolbar.
*/
#include "geany.h"
#include "support.h"
#include "ui_utils.h"
#include "toolbar.h"
#include "callbacks.h"
#include "utils.h"
#include "dialogs.h"
#include "geanyobject.h"
#include "geanymenubuttonaction.h"
#include "geanyentryaction.h"
GeanyToolbarPrefs toolbar_prefs;
static GtkUIManager *uim;
static GtkActionGroup *group;
/* Available toolbar actions
* Fields: name, stock_id, label, accelerator, tooltip, callback */
const GtkActionEntry ui_entries[] = {
{ "Save", GTK_STOCK_SAVE, NULL, NULL, N_("Save the current file"), G_CALLBACK(on_toolbutton_save_clicked) },
{ "SaveAll", GTK_STOCK_SAVE, N_("Save All"), NULL, N_("Save all open files"), G_CALLBACK(on_save_all1_activate) },
{ "Reload", GTK_STOCK_REVERT_TO_SAVED, NULL, NULL, N_("Reload the current file from disk"), G_CALLBACK(on_toolbutton_reload_clicked) },
{ "Close", GTK_STOCK_CLOSE, NULL, NULL, N_("Close the current file"), G_CALLBACK(on_toolbutton_close_clicked) },
{ "Cut", GTK_STOCK_CUT, NULL, NULL, N_("Cut the current selection"), G_CALLBACK(on_cut1_activate) },
{ "Copy", GTK_STOCK_COPY, NULL, NULL, N_("Copy the current selection"), G_CALLBACK(on_copy1_activate) },
{ "Paste", GTK_STOCK_PASTE, NULL, NULL, N_("Paste the contents of the clipboard"), G_CALLBACK(on_paste1_activate) },
{ "Delete", GTK_STOCK_DELETE, NULL, NULL, N_("Delete the current selection"), G_CALLBACK(on_delete1_activate) },
{ "Undo", GTK_STOCK_UNDO, NULL, NULL, N_("Undo the last modification"), G_CALLBACK(on_undo1_activate) },
{ "Redo", GTK_STOCK_REDO, NULL, NULL, N_("Redo the last modification"), G_CALLBACK(on_redo1_activate) },
{ "NavBack", GTK_STOCK_GO_BACK, NULL, NULL, N_("Navigate back a location"), G_CALLBACK(on_back_activate) },
{ "NavFor", GTK_STOCK_GO_FORWARD, NULL, NULL, N_("Navigate forward a location"), G_CALLBACK(on_forward_activate) },
{ "Compile", GTK_STOCK_CONVERT, N_("Compile"), NULL, N_("Compile the current file"), G_CALLBACK(on_toolbutton_compile_clicked) },
{ "Run", GTK_STOCK_EXECUTE, NULL, NULL, N_("Run or view the current file"), G_CALLBACK(on_toolbutton_run_clicked) },
{ "Color", GTK_STOCK_SELECT_COLOR, N_("Color Chooser"), NULL, N_("Open a color chooser dialog, to interactively pick colors from a palette"), G_CALLBACK(on_show_color_chooser1_activate) },
{ "ZoomIn", GTK_STOCK_ZOOM_IN, NULL, NULL, N_("Zoom in the text"), G_CALLBACK(on_zoom_in1_activate) },
{ "ZoomOut", GTK_STOCK_ZOOM_OUT, NULL, NULL, N_("Zoom out the text"), G_CALLBACK(on_zoom_out1_activate) },
{ "UnIndent", GTK_STOCK_UNINDENT, NULL, NULL, N_("Decrease indentation"), G_CALLBACK(on_menu_decrease_indent1_activate) },
{ "Indent", GTK_STOCK_INDENT, NULL, NULL, N_("Increase indentation"), G_CALLBACK(on_menu_increase_indent1_activate) },
{ "Search", GTK_STOCK_FIND, NULL, NULL, N_("Find the entered text in the current file"), G_CALLBACK(on_toolbutton_search_clicked) },
{ "Goto", GTK_STOCK_JUMP_TO, NULL, NULL, N_("Jump to the entered line number"), G_CALLBACK(on_toolbutton_goto_clicked) },
{ "Quit", GTK_STOCK_QUIT, NULL, NULL, N_("Quit Geany"), G_CALLBACK(on_toolbutton_quit_clicked) },
};
const guint ui_entries_n = G_N_ELEMENTS(ui_entries);
/* fallback UI definition */
const gchar *toolbar_markup =
"<ui>"
"<toolbar name='GeanyToolbar'>"
"<toolitem action='New'/>"
"<toolitem action='Open'/>"
"<toolitem action='Save'/>"
"<toolitem action='SaveAll'/>"
"<separator/>"
"<toolitem action='Reload'/>"
"<toolitem action='Close'/>"
"<separator/>"
"<toolitem action='NavBack'/>"
"<toolitem action='NavFor'/>"
"<separator/>"
"<toolitem action='Compile'/>"
"<toolitem action='Run'/>"
"<separator/>"
"<toolitem action='Color'/>"
"<separator/>"
"<toolitem action='SearchEntry'/>"
"<toolitem action='Search'/>"
"<separator/>"
"<toolitem action='GotoEntry'/>"
"<toolitem action='Goto'/>"
"<separator/>"
"<toolitem action='Quit'/>"
"</toolbar>"
"</ui>";
GtkWidget *toolbar_get_widget_by_name(const gchar *name)
{
GtkWidget *widget;
gchar *path;
g_return_val_if_fail(name != NULL, NULL);
path = g_strconcat("/ui/GeanyToolbar/", name, NULL);
widget = gtk_ui_manager_get_widget(uim, path);
g_free(path);
return widget;
}
GtkWidget *toolbar_get_widget_child_by_name(const gchar *name)
{
GtkWidget *widget = toolbar_get_widget_by_name(name);
if (widget != NULL)
return gtk_bin_get_child(GTK_BIN(widget));
else
return widget;
}
GtkAction *toolbar_get_action_by_name(const gchar *name)
{
g_return_val_if_fail(name != NULL, NULL);
return gtk_action_group_get_action(group, name);
}
/*
static void on_document_save(G_GNUC_UNUSED GObject *object, G_GNUC_UNUSED gpointer *doc,
G_GNUC_UNUSED gpointer data)
{
dialogs_show_msgbox(GTK_MESSAGE_INFO,
_("For all changes you make in this file to take effect, you need to restart Geany."));
}
*/
void toolbar_add_config_file_menu_item(void)
{
/*
ui_add_config_file_menu_item(
utils_build_path(app->configdir, "ui_toolbar.xml", NULL), NULL, NULL);
g_signal_connect(geany_object, "document-save", G_CALLBACK(on_document_save), NULL);
*/
}
GtkWidget *toolbar_init(void)
{
GtkWidget *toolbar;
GtkBox *box;
GtkAction *action_new;
GtkAction *action_open;
GtkAction *action_searchentry;
GtkAction *action_gotoentry;
GError *error = NULL;
const gchar *filename;
uim = gtk_ui_manager_new();
group = gtk_action_group_new("GeanyToolbar");
gtk_action_group_set_translation_domain(group, GETTEXT_PACKAGE);
gtk_action_group_add_actions(group, ui_entries, ui_entries_n, NULL);
/* Create our custom actions */
action_new = geany_menu_button_action_new("New", NULL, _("Create a new file"), GTK_STOCK_NEW);
g_signal_connect(action_new, "button-clicked", G_CALLBACK(on_toolbutton_new_clicked), NULL);
gtk_action_group_add_action(group, action_new);
action_open = geany_menu_button_action_new(
"Open", NULL, _("Open an existing file"), GTK_STOCK_OPEN);
g_signal_connect(action_open, "button-clicked", G_CALLBACK(on_toolbutton_open_clicked), NULL);
gtk_action_group_add_action(group, action_open);
action_searchentry = geany_entry_action_new(
"SearchEntry", _("Search"), _("Find the entered text in the current file"), FALSE);
g_signal_connect(action_searchentry, "entry-activate",
G_CALLBACK(on_toolbar_search_entry_changed), NULL);
g_signal_connect(action_searchentry, "entry-changed",
G_CALLBACK(on_toolbar_search_entry_changed), NULL);
gtk_action_group_add_action(group, action_searchentry);
action_gotoentry = geany_entry_action_new(
"GotoEntry", _("Goto"), _("Jump to the entered line number."), TRUE);
g_signal_connect(action_gotoentry, "entry-activate",
G_CALLBACK(on_toolbutton_goto_entry_activate), NULL);
gtk_action_group_add_action(group, action_gotoentry);
gtk_ui_manager_insert_action_group(uim, group, 0);
/* Load the toolbar UI XML file from disk (first from config dir, then try data dir) */
filename = utils_build_path(app->configdir, "ui_toolbar.xml", NULL);
if (! gtk_ui_manager_add_ui_from_file(uim, filename, &error))
{
geany_debug("Loading user toolbar UI definition failed (%s).", error->message);
g_error_free(error);
error = NULL;
filename = utils_build_path(app->datadir, "ui_toolbar.xml", NULL);
if (! gtk_ui_manager_add_ui_from_file(uim, filename, &error))
{
geany_debug(
"UI creation failed, using internal fallback definition. Error message: %s",
error->message);
g_error_free(error);
/* finally load the internally defined markup as fallback */
gtk_ui_manager_add_ui_from_string(uim, toolbar_markup, -1, NULL);
}
}
/* Add the toolbar widget to the main UI */
toolbar = gtk_ui_manager_get_widget(uim, "/ui/GeanyToolbar");
box = GTK_BOX(lookup_widget(main_widgets.window, "vbox1"));
gtk_box_pack_start(box, toolbar, FALSE, FALSE, 0);
gtk_box_reorder_child(box, toolbar, 1);
/* Set some pointers */
ui_widgets.new_file_menu = geany_menu_button_action_get_menu(
GEANY_MENU_BUTTON_ACTION(action_new));
ui_widgets.recent_files_menu_toolbar = geany_menu_button_action_get_menu(
GEANY_MENU_BUTTON_ACTION(action_open));
g_signal_connect(toolbar, "key-press-event", G_CALLBACK(on_escape_key_press_event), NULL);
return toolbar;
}
/* TODO: remove this code and use stock icons instead */
void toolbar_update_icons(GtkIconSize size)
{
GtkWidget *button_image = NULL;
GtkWidget *widget = NULL;
GtkWidget *oldwidget = NULL;
/* destroy old widget */
widget = toolbar_get_widget_by_name("SaveAll");
if (widget == NULL)
return;
oldwidget = gtk_tool_button_get_icon_widget(GTK_TOOL_BUTTON(widget));
if (oldwidget && GTK_IS_WIDGET(oldwidget))
gtk_widget_destroy(oldwidget);
/* create new widget */
button_image = ui_new_image_from_inline(GEANY_IMAGE_SAVE_ALL, FALSE);
gtk_widget_show(button_image);
gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(widget), button_image);
gtk_toolbar_set_icon_size(GTK_TOOLBAR(main_widgets.toolbar), size);
}
/* Returns the position for adding new toolbar items. The returned position can be used
* to add new toolbar items with @c gtk_toolbar_insert(). The toolbar object can be accessed
* with @a geany->main_widgets->toolbar.
* The position is always the last one before the Quit button (if it is shown).
*
* @return The position for new toolbar items or @c -1 if an error occurred.
*/
gint toolbar_get_insert_position(void)
{
GtkWidget *quit = toolbar_get_widget_by_name("Quit");
gint pos = gtk_toolbar_get_item_index(GTK_TOOLBAR(main_widgets.toolbar), GTK_TOOL_ITEM(quit));
return pos;
}
static void auto_separator_update(GeanyAutoSeparator *autosep)
{
g_return_if_fail(autosep->ref_count >= 0);
if (autosep->widget)
ui_widget_show_hide(autosep->widget, autosep->ref_count > 0);
}
static void on_auto_separator_item_show_hide(GtkWidget *widget, gpointer user_data)
{
GeanyAutoSeparator *autosep = user_data;
if (GTK_WIDGET_VISIBLE(widget))
autosep->ref_count++;
else
autosep->ref_count--;
auto_separator_update(autosep);
}
static void on_auto_separator_item_destroy(GtkWidget *widget, gpointer user_data)
{
GeanyAutoSeparator *autosep = user_data;
/* GTK_WIDGET_VISIBLE won't work now the widget is being destroyed,
* so assume widget was visible */
autosep->ref_count--;
autosep->ref_count = MAX(autosep->ref_count, 0);
auto_separator_update(autosep);
}
/* Show the separator widget if @a item or another is visible. */
/* Note: This would be neater taking a widget argument, setting a "visible-count"
* property, and using reference counting to keep the widget alive whilst its visible group
* is alive. */
void ui_auto_separator_add_ref(GeanyAutoSeparator *autosep, GtkWidget *item)
{
/* set widget ptr NULL when widget destroyed */
if (autosep->ref_count == 0)
g_signal_connect(autosep->widget, "destroy",
G_CALLBACK(gtk_widget_destroyed), &autosep->widget);
if (GTK_WIDGET_VISIBLE(item))
{
autosep->ref_count++;
auto_separator_update(autosep);
}
g_signal_connect(item, "show", G_CALLBACK(on_auto_separator_item_show_hide), autosep);
g_signal_connect(item, "hide", G_CALLBACK(on_auto_separator_item_show_hide), autosep);
g_signal_connect(item, "destroy", G_CALLBACK(on_auto_separator_item_destroy), autosep);
}
void toolbar_finalize(void)
{
/* unref'ing the GtkUIManager object will destroy all its widgets unless they were ref'ed */
g_object_unref(uim);
g_object_unref(group);
}

55
src/toolbar.h Normal file
View File

@ -0,0 +1,55 @@
/*
* toolbar.h - this file is part of Geany, a fast and lightweight IDE
*
* Copyright 2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* Copyright 2008 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
*/
#ifndef GEANY_TOOLBAR_H
#define GEANY_TOOLBAR_H
typedef struct GeanyToolbarPrefs
{
gboolean visible;
GtkIconSize icon_size;
gint icon_style;
}
GeanyToolbarPrefs;
extern GeanyToolbarPrefs toolbar_prefs;
GtkWidget *toolbar_get_widget_child_by_name(const gchar *name);
GtkWidget *toolbar_get_widget_by_name(const gchar *name);
GtkAction *toolbar_get_action_by_name(const gchar *name);
void toolbar_update_icons(GtkIconSize size);
gint toolbar_get_insert_position(void);
void toolbar_add_config_file_menu_item(void);
GtkWidget *toolbar_init(void);
void toolbar_finalize(void);
#endif

View File

@ -21,7 +21,7 @@
* $Id$
*/
/** @file ui_utils.h
/** @file ui_utils.c
* User Interface general utility functions.
*/
@ -47,10 +47,10 @@
#include "editor.h"
#include "plugins.h"
#include "symbols.h"
#include "toolbar.h"
GeanyInterfacePrefs interface_prefs;
GeanyToolbarPrefs toolbar_prefs;
GeanyMainWidgets main_widgets;
UIPrefs ui_prefs;
@ -74,9 +74,15 @@ widgets;
static void update_recent_menu(void);
static void recent_file_loaded(const gchar *utf8_filename);
static void
recent_file_activate_cb (GtkMenuItem *menuitem,
gpointer user_data);
static void recent_file_activate_cb(GtkMenuItem *menuitem, gpointer user_data);
/* simple wrapper for gtk_widget_set_sensitive() to allow widget being NULL */
void ui_widget_set_sensitive(GtkWidget *widget, gboolean set)
{
if (widget != NULL)
gtk_widget_set_sensitive(widget, set);
}
/* allow_override is TRUE if text can be ignored when another message has been set
@ -312,6 +318,7 @@ void ui_update_popup_reundo_items(GeanyDocument *doc)
{
gboolean enable_undo;
gboolean enable_redo;
guint i, len;
if (doc == NULL)
{
@ -325,44 +332,48 @@ void ui_update_popup_reundo_items(GeanyDocument *doc)
}
/* index 0 is the popup menu, 1 is the menubar, 2 is the toolbar */
gtk_widget_set_sensitive(widgets.undo_items[0], enable_undo);
gtk_widget_set_sensitive(widgets.undo_items[1], enable_undo);
gtk_widget_set_sensitive(widgets.undo_items[2], enable_undo);
gtk_widget_set_sensitive(widgets.redo_items[0], enable_redo);
gtk_widget_set_sensitive(widgets.redo_items[1], enable_redo);
gtk_widget_set_sensitive(widgets.redo_items[2], enable_redo);
len = G_N_ELEMENTS(widgets.undo_items);
for (i = 0; i < len; i++)
{
ui_widget_set_sensitive(widgets.undo_items[i], enable_undo);
}
len = G_N_ELEMENTS(widgets.redo_items);
for (i = 0; i < len; i++)
{
ui_widget_set_sensitive(widgets.redo_items[i], enable_undo);
}
}
void ui_update_popup_copy_items(GeanyDocument *doc)
{
gboolean enable;
guint i;
guint i, len;
if (doc == NULL)
enable = FALSE;
else
enable = sci_has_selection(doc->editor->sci);
for (i = 0; i < G_N_ELEMENTS(widgets.popup_copy_items); i++)
gtk_widget_set_sensitive(widgets.popup_copy_items[i], enable);
len = G_N_ELEMENTS(widgets.popup_copy_items);
for (i = 0; i < len; i++)
ui_widget_set_sensitive(widgets.popup_copy_items[i], enable);
}
void ui_update_popup_goto_items(gboolean enable)
{
gtk_widget_set_sensitive(widgets.popup_goto_items[0], enable);
gtk_widget_set_sensitive(widgets.popup_goto_items[1], enable);
gtk_widget_set_sensitive(widgets.popup_goto_items[2], enable);
gtk_widget_set_sensitive(widgets.popup_goto_items[3], enable);
guint i, len;
len = G_N_ELEMENTS(widgets.popup_goto_items);
for (i = 0; i < len; i++)
ui_widget_set_sensitive(widgets.popup_goto_items[i], enable);
}
void ui_update_menu_copy_items(GeanyDocument *doc)
{
gboolean enable = FALSE;
guint i;
guint i, len;
GtkWidget *focusw = gtk_window_get_focus(GTK_WINDOW(main_widgets.window));
if (IS_SCINTILLA(focusw))
@ -378,8 +389,9 @@ void ui_update_menu_copy_items(GeanyDocument *doc)
enable = gtk_text_buffer_get_selection_bounds(buffer, NULL, NULL);
}
for (i = 0; i < G_N_ELEMENTS(widgets.menu_copy_items); i++)
gtk_widget_set_sensitive(widgets.menu_copy_items[i], enable);
len = G_N_ELEMENTS(widgets.menu_copy_items);
for (i = 0; i < len; i++)
ui_widget_set_sensitive(widgets.menu_copy_items[i], enable);
}
@ -394,7 +406,7 @@ void ui_update_insert_include_item(GeanyDocument *doc, gint item)
{
enable = TRUE;
}
gtk_widget_set_sensitive(widgets.menu_insert_include_items[item], enable);
ui_widget_set_sensitive(widgets.menu_insert_include_items[item], enable);
}
@ -560,8 +572,8 @@ void ui_save_buttons_toggle(gboolean enable)
guint i;
gboolean dirty_tabs = FALSE;
gtk_widget_set_sensitive(widgets.save_buttons[0], enable);
gtk_widget_set_sensitive(widgets.save_buttons[1], enable);
ui_widget_set_sensitive(widgets.save_buttons[0], enable);
ui_widget_set_sensitive(widgets.save_buttons[1], enable);
/* save all menu item and tool button */
for (i = 0; i < documents_array->len; i++)
@ -575,14 +587,17 @@ void ui_save_buttons_toggle(gboolean enable)
}
}
gtk_widget_set_sensitive(widgets.save_buttons[2], dirty_tabs);
gtk_widget_set_sensitive(widgets.save_buttons[3], dirty_tabs);
ui_widget_set_sensitive(widgets.save_buttons[2], dirty_tabs);
ui_widget_set_sensitive(widgets.save_buttons[3], dirty_tabs);
}
#define add_doc_widget(widget_name) \
g_ptr_array_add(widgets.document_buttons, lookup_widget(main_widgets.window, widget_name))
#define add_doc_toolitem(widget_name) \
g_ptr_array_add(widgets.document_buttons, toolbar_get_widget_by_name(widget_name))
static void init_document_widgets(void)
{
widgets.document_buttons = g_ptr_array_new();
@ -591,18 +606,10 @@ static void init_document_widgets(void)
* when using ui_document_buttons_update(). */
add_doc_widget("menu_close1");
add_doc_widget("close_other_documents1");
add_doc_widget("toolbutton_close");
add_doc_widget("menu_change_font1");
add_doc_widget("toolbutton_search_entry");
add_doc_widget("toolbutton_search");
add_doc_widget("toolbutton_zoomin");
add_doc_widget("toolbutton_zoomout");
add_doc_widget("menu_close_all1");
add_doc_widget("menu_save_all1");
add_doc_widget("toolbutton_saveall");
add_doc_widget("toolbutton_compile"); /* compile_button */
add_doc_widget("menu_save_as1");
add_doc_widget("toolbutton_reload");
add_doc_widget("menu_count_words1");
add_doc_widget("menu_build1");
add_doc_widget("add_comments1");
@ -617,9 +624,6 @@ static void init_document_widgets(void)
add_doc_widget("menu_zoom_in1");
add_doc_widget("menu_zoom_out1");
add_doc_widget("normal_size1");
add_doc_widget("toolbutton_colour");
add_doc_widget("toolbutton_goto");
add_doc_widget("toolbutton_goto_entry");
add_doc_widget("treeview6");
add_doc_widget("print1");
add_doc_widget("menu_reload_as1");
@ -635,6 +639,27 @@ static void init_document_widgets(void)
add_doc_widget("find_nextsel1");
add_doc_widget("find_prevsel1");
add_doc_widget("go_to_line1");
add_doc_toolitem("Close");
add_doc_toolitem("Search");
add_doc_toolitem("SearchEntry");
add_doc_toolitem("NavBack");
add_doc_toolitem("NavFor");
add_doc_toolitem("ZoomIn");
add_doc_toolitem("ZoomOut");
add_doc_toolitem("Indent");
add_doc_toolitem("UnIndent");
add_doc_toolitem("Cut");
add_doc_toolitem("Copy");
add_doc_toolitem("Paste");
add_doc_toolitem("Delete");
add_doc_toolitem("SaveAll");
add_doc_toolitem("SaveAll");
add_doc_toolitem("Compile");
add_doc_toolitem("Run");
add_doc_toolitem("Reload");
add_doc_toolitem("Color");
add_doc_toolitem("Goto");
add_doc_toolitem("GotoEntry");
}
@ -646,8 +671,7 @@ void ui_document_buttons_update(void)
for (i = 0; i < widgets.document_buttons->len; i++)
{
GtkWidget *widget = g_ptr_array_index(widgets.document_buttons, i);
gtk_widget_set_sensitive(widget, enable);
ui_widget_set_sensitive(widget, enable);
}
}
@ -666,7 +690,7 @@ void ui_add_document_sensitive(GtkWidget *widget)
{
gboolean enable = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)) ? TRUE : FALSE;
gtk_widget_set_sensitive(widget, enable);
ui_widget_set_sensitive(widget, enable);
g_ptr_array_add(widgets.document_buttons, widget);
g_signal_connect(widget, "destroy", G_CALLBACK(on_doc_sensitive_widget_destroy), NULL);
@ -761,7 +785,7 @@ void ui_document_show_hide(GeanyDocument *doc)
item = lookup_widget(main_widgets.window, "menu_write_unicode_bom1");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), doc->has_bom);
gtk_widget_set_sensitive(item, encodings_is_unicode_charset(doc->encoding));
ui_widget_set_sensitive(item, encodings_is_unicode_charset(doc->encoding));
switch (sci_get_eol_mode(doc->editor->sci))
{
@ -779,92 +803,6 @@ void ui_document_show_hide(GeanyDocument *doc)
}
void ui_update_toolbar_icons(GtkIconSize size)
{
GtkWidget *button_image = NULL;
GtkWidget *widget = NULL;
GtkWidget *oldwidget = NULL;
/* destroy old widget */
widget = lookup_widget(main_widgets.window, "toolbutton_saveall");
oldwidget = gtk_tool_button_get_icon_widget(GTK_TOOL_BUTTON(widget));
if (oldwidget && GTK_IS_WIDGET(oldwidget)) gtk_widget_destroy(oldwidget);
/* create new widget */
button_image = ui_new_image_from_inline(GEANY_IMAGE_SAVE_ALL, FALSE);
gtk_widget_show(button_image);
gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(widget), button_image);
gtk_toolbar_set_icon_size(GTK_TOOLBAR(main_widgets.toolbar), size);
}
void ui_update_toolbar_items(void)
{
/* show toolbar */
GtkWidget *widget = lookup_widget(main_widgets.window, "menu_show_toolbar1");
if (toolbar_prefs.visible && ! gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
{ /* will be changed by the toggled callback */
toolbar_prefs.visible = ! toolbar_prefs.visible;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), TRUE);
}
else if (! toolbar_prefs.visible && gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
{ /* will be changed by the toggled callback */
toolbar_prefs.visible = ! toolbar_prefs.visible;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), FALSE);
}
/* fileops */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_new"), toolbar_prefs.show_fileops);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_open"), toolbar_prefs.show_fileops);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_save"), toolbar_prefs.show_fileops);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_saveall"), toolbar_prefs.show_fileops);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_reload"), toolbar_prefs.show_fileops);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_close"), toolbar_prefs.show_fileops);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem7"), toolbar_prefs.show_fileops);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem2"), toolbar_prefs.show_fileops);
/* search */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_search_entry"), toolbar_prefs.show_search);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_search"), toolbar_prefs.show_search);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem5"), toolbar_prefs.show_search);
/* goto line */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_goto_entry"), toolbar_prefs.show_goto);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_goto"), toolbar_prefs.show_goto);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem8"), toolbar_prefs.show_goto);
/* compile */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_compile"), toolbar_prefs.show_compile);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_run"), toolbar_prefs.show_compile);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem6"), toolbar_prefs.show_compile);
/* colour */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_colour"), toolbar_prefs.show_colour);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem3"), toolbar_prefs.show_colour);
/* zoom */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_zoomin"), toolbar_prefs.show_zoom);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_zoomout"), toolbar_prefs.show_zoom);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem4"), toolbar_prefs.show_zoom);
/* indent */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_indent_dec"), toolbar_prefs.show_indent);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_indent_inc"), toolbar_prefs.show_indent);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem11"), toolbar_prefs.show_indent);
/* undo */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_undo"), toolbar_prefs.show_undo);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_redo"), toolbar_prefs.show_undo);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem9"), toolbar_prefs.show_undo);
/* C&P */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_copy"), toolbar_prefs.show_copypaste);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_paste"), toolbar_prefs.show_copypaste);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_cut"), toolbar_prefs.show_cutdelete);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_delete"), toolbar_prefs.show_cutdelete);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem12"), toolbar_prefs.show_cutdelete || toolbar_prefs.show_copypaste);
/* navigation */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_back"), toolbar_prefs.show_navigation);
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_forward"), toolbar_prefs.show_navigation);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem10"), toolbar_prefs.show_navigation);
/* quit */
ui_widget_show_hide(lookup_widget(main_widgets.window, "toolbutton_quit"), toolbar_prefs.show_quit);
ui_widget_show_hide(lookup_widget(main_widgets.window, "separatortoolitem8"), toolbar_prefs.show_quit);
}
/* Note: remember to unref the pixbuf once an image or window has added a reference. */
GdkPixbuf *ui_new_pixbuf_from_inline(gint img, gboolean small_img)
{
@ -923,26 +861,23 @@ void ui_create_recent_menu(void)
guint i;
gchar *filename;
if (g_queue_get_length(ui_prefs.recent_queue) > 0)
{
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(
lookup_widget(main_widgets.window, "toolbutton_open")), ui_widgets.recent_files_toolbar);
}
for (i = 0; i < MIN(file_prefs.mru_length, g_queue_get_length(ui_prefs.recent_queue)); i++)
{
filename = g_queue_peek_nth(ui_prefs.recent_queue, i);
/* create menu item for the recent files menu in the menu bar */
tmp = gtk_menu_item_new_with_label(filename);
gtk_widget_show(tmp);
gtk_menu_shell_append(GTK_MENU_SHELL(ui_widgets.recent_files_menubar), tmp);
gtk_container_add(GTK_CONTAINER(ui_widgets.recent_files_menu_menubar), tmp);
g_signal_connect(tmp, "activate", G_CALLBACK(recent_file_activate_cb), NULL);
/* create menu item for the recent files menu in the toolbar bar */
/* create menu item for the recent files menu in the toolbar */
if (ui_widgets.recent_files_menu_toolbar != NULL)
{
tmp = gtk_menu_item_new_with_label(filename);
gtk_widget_show(tmp);
gtk_menu_shell_append(GTK_MENU_SHELL(ui_widgets.recent_files_toolbar), tmp);
gtk_container_add(GTK_CONTAINER(ui_widgets.recent_files_menu_toolbar), tmp);
g_signal_connect(tmp, "activate", G_CALLBACK(recent_file_activate_cb), NULL);
}
}
}
@ -1032,78 +967,81 @@ static void recent_file_loaded(const gchar *utf8_filename)
g_queue_push_head(ui_prefs.recent_queue, data);
/* remove the old menuitem for the filename */
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_menubar));
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_menu_menubar));
item = g_list_find_custom(children, utf8_filename, (GCompareFunc) find_recent_file_item);
if (item != NULL) gtk_widget_destroy(GTK_WIDGET(item->data));
if (item != NULL)
gtk_widget_destroy(GTK_WIDGET(item->data));
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_toolbar));
if (ui_widgets.recent_files_menu_toolbar != NULL)
{
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_menu_toolbar));
item = g_list_find_custom(children, utf8_filename, (GCompareFunc) find_recent_file_item);
if (item != NULL) gtk_widget_destroy(GTK_WIDGET(item->data));
if (item != NULL)
gtk_widget_destroy(GTK_WIDGET(item->data));
}
/* now prepend a new menuitem for the filename,
* first for the recent files menu in the menu bar */
tmp = gtk_menu_item_new_with_label(utf8_filename);
gtk_widget_show(tmp);
gtk_menu_shell_prepend(GTK_MENU_SHELL(ui_widgets.recent_files_menubar), tmp);
gtk_container_add(GTK_CONTAINER(ui_widgets.recent_files_menu_menubar), tmp);
g_signal_connect(tmp, "activate", G_CALLBACK(recent_file_activate_cb), NULL);
/* then for the recent files menu in the tool bar */
if (ui_widgets.recent_files_menu_toolbar != NULL)
{
tmp = gtk_menu_item_new_with_label(utf8_filename);
gtk_widget_show(tmp);
gtk_menu_shell_prepend(GTK_MENU_SHELL(ui_widgets.recent_files_toolbar), tmp);
gtk_container_add(GTK_CONTAINER(ui_widgets.recent_files_menu_toolbar), tmp);
g_signal_connect(tmp, "activate", G_CALLBACK(recent_file_activate_cb), NULL);
}
}
static void update_recent_menu(void)
{
GtkWidget *tmp;
static GtkMenuToolButton *menu = NULL;
gchar *filename;
GList *children, *item;
if (menu == NULL)
menu = GTK_MENU_TOOL_BUTTON(lookup_widget(main_widgets.window, "toolbutton_open"));
if (gtk_menu_tool_button_get_menu(menu) == NULL)
{
gtk_menu_tool_button_set_menu(menu, ui_widgets.recent_files_toolbar);
}
filename = g_queue_peek_head(ui_prefs.recent_queue);
/* clean the MRU list before adding an item (menubar) */
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_menubar));
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_menu_menubar));
if (g_list_length(children) > file_prefs.mru_length - 1)
{
item = g_list_nth(children, file_prefs.mru_length - 1);
while (item != NULL)
{
if (GTK_IS_MENU_ITEM(item->data)) gtk_widget_destroy(GTK_WIDGET(item->data));
if (GTK_IS_MENU_ITEM(item->data))
gtk_widget_destroy(GTK_WIDGET(item->data));
item = g_list_next(item);
}
}
/* clean the MRU list before adding an item (toolbar) */
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_toolbar));
if (g_list_length(children) > file_prefs.mru_length - 1)
{
item = g_list_nth(children, file_prefs.mru_length - 1);
while (item != NULL)
{
if (GTK_IS_MENU_ITEM(item->data)) gtk_widget_destroy(GTK_WIDGET(item->data));
item = g_list_next(item);
}
}
filename = g_queue_peek_head(ui_prefs.recent_queue);
/* create item for the menu bar menu */
tmp = gtk_menu_item_new_with_label(filename);
gtk_widget_show(tmp);
gtk_menu_shell_prepend(GTK_MENU_SHELL(ui_widgets.recent_files_menubar), tmp);
gtk_container_add(GTK_CONTAINER(ui_widgets.recent_files_menu_menubar), tmp);
g_signal_connect(tmp, "activate", G_CALLBACK(recent_file_activate_cb), NULL);
/* clean the MRU list before adding an item (toolbar) */
if (ui_widgets.recent_files_menu_toolbar != NULL)
{
children = gtk_container_get_children(GTK_CONTAINER(ui_widgets.recent_files_menu_toolbar));
if (g_list_length(children) > file_prefs.mru_length - 1)
{
item = g_list_nth(children, file_prefs.mru_length - 1);
while (item != NULL)
{
if (GTK_IS_MENU_ITEM(item->data))
gtk_widget_destroy(GTK_WIDGET(item->data));
item = g_list_next(item);
}
}
/* create item for the tool bar menu */
tmp = gtk_menu_item_new_with_label(filename);
gtk_widget_show(tmp);
gtk_menu_shell_prepend(GTK_MENU_SHELL(ui_widgets.recent_files_toolbar), tmp);
gtk_container_add(GTK_CONTAINER(ui_widgets.recent_files_menu_toolbar), tmp);
g_signal_connect(tmp, "activate", G_CALLBACK(recent_file_activate_cb), NULL);
}
}
@ -1583,8 +1521,7 @@ static void on_config_file_clicked(GtkWidget *widget, gpointer user_data)
/* @note You should connect to the "document-save" signal yourself to detect
* if the user has just saved the config file, reloading it. */
void ui_add_config_file_menu_item(const gchar *real_path, const gchar *label,
GtkContainer *parent)
void ui_add_config_file_menu_item(const gchar *real_path, const gchar *label, GtkContainer *parent)
{
GtkWidget *item;
@ -1641,97 +1578,19 @@ void ui_init(void)
widgets.menu_insert_include_items[0] = lookup_widget(main_widgets.editor_menu, "insert_include1");
widgets.menu_insert_include_items[1] = lookup_widget(main_widgets.window, "insert_include2");
widgets.save_buttons[0] = lookup_widget(main_widgets.window, "menu_save1");
widgets.save_buttons[1] = lookup_widget(main_widgets.window, "toolbutton_save");
widgets.save_buttons[1] = toolbar_get_widget_by_name("Save");
widgets.save_buttons[2] = lookup_widget(main_widgets.window, "menu_save_all1");
widgets.save_buttons[3] = lookup_widget(main_widgets.window, "toolbutton_saveall");
widgets.save_buttons[3] = toolbar_get_widget_by_name("SaveAll");
widgets.redo_items[0] = lookup_widget(main_widgets.editor_menu, "redo1");
widgets.redo_items[1] = lookup_widget(main_widgets.window, "menu_redo2");
widgets.redo_items[2] = lookup_widget(main_widgets.window, "toolbutton_redo");
widgets.redo_items[2] = toolbar_get_widget_by_name("Redo");
widgets.undo_items[0] = lookup_widget(main_widgets.editor_menu, "undo1");
widgets.undo_items[1] = lookup_widget(main_widgets.window, "menu_undo2");
widgets.undo_items[2] = lookup_widget(main_widgets.window, "toolbutton_undo");
widgets.undo_items[2] = toolbar_get_widget_by_name("Undo");
init_document_widgets();
create_config_files_menu();
}
/* Returns the position for adding new toolbar items. The returned position can be used
* to add new toolbar items with @c gtk_toolbar_insert(). The toolbar object can be accessed
* with @a geany->main_widgets->toolbar.
* The position is always the last one before the Quit button (if it is shown).
*
* @return The position for new toolbar items or @c -1 if an error occurred.
*/
gint ui_get_toolbar_insert_position(void)
{
GtkWidget *quit = lookup_widget(main_widgets.window, "toolbutton_quit");
gint pos = gtk_toolbar_get_item_index(GTK_TOOLBAR(main_widgets.toolbar), GTK_TOOL_ITEM(quit));
/* use one position before the real position of the quit button to place new
* items between the last 2 separators and the quit button */
if (pos > 0)
pos--;
if (pos > 0)
pos--;
return pos;
}
static void auto_separator_update(GeanyAutoSeparator *autosep)
{
g_return_if_fail(autosep->ref_count >= 0);
if (autosep->widget)
ui_widget_show_hide(autosep->widget, autosep->ref_count > 0);
}
static void on_auto_separator_item_show_hide(GtkWidget *widget, gpointer user_data)
{
GeanyAutoSeparator *autosep = user_data;
if (GTK_WIDGET_VISIBLE(widget))
autosep->ref_count++;
else
autosep->ref_count--;
auto_separator_update(autosep);
}
static void on_auto_separator_item_destroy(GtkWidget *widget, gpointer user_data)
{
GeanyAutoSeparator *autosep = user_data;
/* GTK_WIDGET_VISIBLE won't work now the widget is being destroyed,
* so assume widget was visible */
autosep->ref_count--;
autosep->ref_count = MAX(autosep->ref_count, 0);
auto_separator_update(autosep);
}
/* Show the separator widget if @a item or another is visible. */
/* Note: This would be neater taking a widget argument, setting a "visible-count"
* property, and using reference counting to keep the widget alive whilst its visible group
* is alive. */
void ui_auto_separator_add_ref(GeanyAutoSeparator *autosep, GtkWidget *item)
{
/* set widget ptr NULL when widget destroyed */
if (autosep->ref_count == 0)
g_signal_connect(autosep->widget, "destroy",
G_CALLBACK(gtk_widget_destroyed), &autosep->widget);
if (GTK_WIDGET_VISIBLE(item))
{
autosep->ref_count++;
auto_separator_update(autosep);
}
g_signal_connect(item, "show", G_CALLBACK(on_auto_separator_item_show_hide), autosep);
g_signal_connect(item, "hide", G_CALLBACK(on_auto_separator_item_show_hide), autosep);
g_signal_connect(item, "destroy", G_CALLBACK(on_auto_separator_item_destroy), autosep);
toolbar_add_config_file_menu_item();
}

View File

@ -44,29 +44,6 @@ GeanyInterfacePrefs;
extern GeanyInterfacePrefs interface_prefs;
typedef struct GeanyToolbarPrefs
{
gboolean visible;
gboolean show_search;
gboolean show_goto;
gboolean show_undo;
gboolean show_navigation;
gboolean show_compile;
gboolean show_zoom;
gboolean show_indent;
gboolean show_colour;
gboolean show_fileops;
gboolean show_quit;
GtkIconSize icon_size;
gint icon_style;
gboolean show_cutdelete;
gboolean show_copypaste;
}
GeanyToolbarPrefs;
extern GeanyToolbarPrefs toolbar_prefs;
/** Important widgets in the main window. */
typedef struct GeanyMainWidgets
{
@ -108,8 +85,8 @@ typedef struct UIWidgets
GtkWidget *toolbar_menu;
GtkWidget *new_file_menu;
GtkWidget *recent_files_menuitem;
GtkWidget *recent_files_menubar;
GtkWidget *recent_files_toolbar;
GtkWidget *recent_files_menu_menubar;
GtkWidget *recent_files_menu_toolbar;
GtkWidget *print_page_setup;
/* dialogs */
@ -171,6 +148,8 @@ void ui_widget_set_tooltip_text(GtkWidget *widget, const gchar *text);
GtkWidget *ui_lookup_widget(GtkWidget *widget, const gchar *widget_name);
void ui_widget_set_sensitive(GtkWidget *widget, gboolean set);
/* End of 'generic' functions */
@ -222,10 +201,6 @@ void ui_sidebar_show_hide(void);
void ui_document_show_hide(GeanyDocument *doc);
void ui_update_toolbar_icons(GtkIconSize size);
void ui_update_toolbar_items(void);
GdkPixbuf *ui_new_pixbuf_from_inline(gint img, gboolean small_img);
@ -254,8 +229,6 @@ gboolean ui_tree_view_find_previous(GtkTreeView *treeview, TVMatchCallback cb);
void ui_statusbar_showhide(gboolean state);
gint ui_get_toolbar_insert_position(void);
void ui_add_document_sensitive(GtkWidget *widget);
#endif

View File

@ -87,13 +87,15 @@ scintilla_sources = [
geany_sources = [
'src/about.c', 'src/build.c', 'src/callbacks.c', 'src/dialogs.c', 'src/document.c',
'src/editor.c', 'src/encodings.c', 'src/filetypes.c', 'src/geanyobject.c',
'src/geanywraplabel.c', 'src/highlighting.c', 'src/interface.c', 'src/keybindings.c',
'src/editor.c', 'src/encodings.c', 'src/filetypes.c', 'src/geanyentryaction.c',
'src/geanymenubuttonaction.c', 'src/geanyobject.c', 'src/geanywraplabel.c',
'src/highlighting.c', 'src/interface.c', 'src/keybindings.c',
'src/keyfile.c', 'src/log.c', 'src/main.c', 'src/msgwindow.c', 'src/navqueue.c', 'src/notebook.c',
'src/plugins.c', 'src/prefix.c', 'src/prefs.c', 'src/printing.c', 'src/project.c',
'src/sciwrappers.c', 'src/search.c', 'src/socket.c', 'src/stash.c',
'src/support.c', 'src/symbols.c',
'src/templates.c', 'src/tools.c', 'src/treeviews.c', 'src/ui_utils.c', 'src/utils.c' ]
'src/templates.c', 'src/toolbar.c', 'src/tools.c', 'src/treeviews.c',
'src/ui_utils.c', 'src/utils.c' ]