SF.net SVN: geany:[2802] branches/dynamic-editor-menu

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Jul 22 16:54:04 UTC 2008


Revision: 2802
          http://geany.svn.sourceforge.net/geany/?rev=2802&view=rev
Author:   eht16
Date:     2008-07-22 16:54:02 +0000 (Tue, 22 Jul 2008)

Log Message:
-----------
Build the editor popup menu with GtkUIManager instead of Glade. This makes it configurable for users by editing an XML file.

Modified Paths:
--------------
    branches/dynamic-editor-menu/Makefile.am
    branches/dynamic-editor-menu/geany.glade
    branches/dynamic-editor-menu/src/Makefile.am
    branches/dynamic-editor-menu/src/callbacks.c
    branches/dynamic-editor-menu/src/callbacks.h
    branches/dynamic-editor-menu/src/dialogs.c
    branches/dynamic-editor-menu/src/editor.c
    branches/dynamic-editor-menu/src/interface.c
    branches/dynamic-editor-menu/src/interface.h
    branches/dynamic-editor-menu/src/keybindings.c
    branches/dynamic-editor-menu/src/main.c
    branches/dynamic-editor-menu/src/tools.c
    branches/dynamic-editor-menu/src/ui_utils.c
    branches/dynamic-editor-menu/src/ui_utils.h
    branches/dynamic-editor-menu/wscript

Added Paths:
-----------
    branches/dynamic-editor-menu/src/ui_manager.c
    branches/dynamic-editor-menu/src/ui_manager.h

Modified: branches/dynamic-editor-menu/Makefile.am
===================================================================
--- branches/dynamic-editor-menu/Makefile.am	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/Makefile.am	2008-07-22 16:54:02 UTC (rev 2802)
@@ -19,6 +19,7 @@
 	data/html_entities.tags \
 	$(srcdir)/data/filetypes.* \
 	data/filetype_extensions.conf \
+	data/ui_editor_menu.xml \
 	data/snippets.conf
 
 EXTRA_DIST = \
@@ -63,6 +64,7 @@
 	$(INSTALL_DATA) $(srcdir)/data/pascal.tags $(DESTDIR)$(pkgdatadir); \
 	$(INSTALL_DATA) $(srcdir)/data/latex.tags $(DESTDIR)$(pkgdatadir); \
 	$(INSTALL_DATA) $(srcdir)/data/html_entities.tags $(DESTDIR)$(pkgdatadir); \
+	$(INSTALL_DATA) $(srcdir)/data/ui_editor_menu.xml $(DESTDIR)$(pkgdatadir); \
 	$(INSTALL_DATA) $(srcdir)/COPYING $(DESTDIR)$(pkgdatadir)/GPL-2; \
 	for file in $(srcdir)/data/*; do \
 	  if test -f $$file; then \

Modified: branches/dynamic-editor-menu/geany.glade
===================================================================
--- branches/dynamic-editor-menu/geany.glade	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/geany.glade	2008-07-22 16:54:02 UTC (rev 2802)
@@ -2641,527 +2641,6 @@
   </child>
 </widget>
 
-<widget class="GtkMenu" id="edit_menu1">
-  <property name="visible">True</property>
-
-  <child>
-    <widget class="GtkImageMenuItem" id="undo1">
-      <property name="visible">True</property>
-      <property name="label">gtk-undo</property>
-      <property name="use_stock">True</property>
-      <signal name="activate" handler="on_undo1_activate" last_modification_time="Sat, 30 Apr 2005 21:47:27 GMT"/>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkImageMenuItem" id="redo1">
-      <property name="visible">True</property>
-      <property name="label">gtk-redo</property>
-      <property name="use_stock">True</property>
-      <signal name="activate" handler="on_redo1_activate" last_modification_time="Sat, 30 Apr 2005 21:47:27 GMT"/>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkSeparatorMenuItem" id="separator2">
-      <property name="visible">True</property>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkImageMenuItem" id="cut1">
-      <property name="visible">True</property>
-      <property name="label">gtk-cut</property>
-      <property name="use_stock">True</property>
-      <signal name="activate" handler="on_cut1_activate" last_modification_time="Sat, 30 Apr 2005 21:47:27 GMT"/>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkImageMenuItem" id="copy1">
-      <property name="visible">True</property>
-      <property name="label">gtk-copy</property>
-      <property name="use_stock">True</property>
-      <signal name="activate" handler="on_copy1_activate" last_modification_time="Sat, 30 Apr 2005 21:47:27 GMT"/>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkImageMenuItem" id="paste1">
-      <property name="visible">True</property>
-      <property name="label">gtk-paste</property>
-      <property name="use_stock">True</property>
-      <signal name="activate" handler="on_paste1_activate" last_modification_time="Sat, 30 Apr 2005 21:47:27 GMT"/>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkImageMenuItem" id="delete1">
-      <property name="visible">True</property>
-      <property name="label">gtk-delete</property>
-      <property name="use_stock">True</property>
-      <signal name="activate" handler="on_delete1_activate" last_modification_time="Sat, 30 Apr 2005 21:47:27 GMT"/>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkSeparatorMenuItem" id="separator3">
-      <property name="visible">True</property>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkMenuItem" id="menu_select_all2">
-      <property name="visible">True</property>
-      <property name="label" translatable="yes">Select _All</property>
-      <property name="use_underline">True</property>
-      <signal name="activate" handler="on_menu_select_all1_activate" last_modification_time="Fri, 30 Jun 2006 13:35:07 GMT"/>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkSeparatorMenuItem" id="separator26">
-      <property name="visible">True</property>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkMenuItem" id="menu_open_selected_file2">
-      <property name="visible">True</property>
-      <property name="label" translatable="yes">Open Selected F_ile</property>
-      <property name="use_underline">True</property>
-      <signal name="activate" handler="on_menu_open_selected_file1_activate" last_modification_time="Wed, 24 Jan 2007 18:48:44 GMT"/>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkSeparatorMenuItem" id="separator36">
-      <property name="visible">True</property>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkMenuItem" id="menu_format2">
-      <property name="visible">True</property>
-      <property name="label" translatable="yes">_Format</property>
-      <property name="use_underline">True</property>
-
-      <child>
-	<widget class="GtkMenu" id="menu_format2_menu">
-
-	  <child>
-	    <widget class="GtkMenuItem" id="toggle_case1">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">T_oggle Case of Selection</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_toggle_case1_activate" last_modification_time="Thu, 06 Sep 2007 18:17:18 GMT"/>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkSeparatorMenuItem" id="separator30">
-	      <property name="visible">True</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="menu_comment_line2">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">_Comment Line(s)</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_menu_comment_line1_activate" last_modification_time="Tue, 01 Aug 2006 10:31:38 GMT"/>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="menu_uncomment_line2">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">U_ncomment Line(s)</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_menu_uncomment_line1_activate" last_modification_time="Tue, 01 Aug 2006 10:31:38 GMT"/>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="menu_toggle_line_commentation2">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">_Toggle Line Commentation</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_menu_toggle_line_commentation1_activate" last_modification_time="Tue, 12 Sep 2006 08:07:58 GMT"/>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="menu_duplicate_line2">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Du_plicate Line or Selection</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_menu_duplicate_line1_activate" last_modification_time="Tue, 01 Aug 2006 10:31:38 GMT"/>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkSeparatorMenuItem" id="separator31">
-	      <property name="visible">True</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkImageMenuItem" id="menu_increase_indent2">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">_Increase Indent</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_menu_increase_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:31:38 GMT"/>
-
-	      <child internal-child="image">
-		<widget class="GtkImage" id="image2589">
-		  <property name="visible">True</property>
-		  <property name="stock">gtk-indent</property>
-		  <property name="icon_size">1</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		</widget>
-	      </child>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkImageMenuItem" id="menu_decrease_indent2">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">_Decrease Indent</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_menu_decrease_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:31:38 GMT"/>
-
-	      <child internal-child="image">
-		<widget class="GtkImage" id="image2590">
-		  <property name="visible">True</property>
-		  <property name="stock">gtk-unindent</property>
-		  <property name="icon_size">1</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		</widget>
-	      </child>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkSeparatorMenuItem" id="separator38">
-	      <property name="visible">True</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="send_selection_to1">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">_Send Selection to</property>
-	      <property name="use_underline">True</property>
-
-	      <child>
-		<widget class="GtkMenu" id="send_selection_to1_menu">
-
-		  <child>
-		    <widget class="GtkMenuItem" id="invisible12">
-		      <property name="label" translatable="yes">invisible</property>
-		      <property name="use_underline">True</property>
-		    </widget>
-		  </child>
-		</widget>
-	      </child>
-	    </widget>
-	  </child>
-	</widget>
-      </child>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkSeparatorMenuItem" id="separator17">
-      <property name="visible">True</property>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkImageMenuItem" id="comments">
-      <property name="visible">True</property>
-      <property name="label" translatable="yes">I_nsert Comments</property>
-      <property name="use_underline">True</property>
-
-      <child internal-child="image">
-	<widget class="GtkImage" id="image2591">
-	  <property name="visible">True</property>
-	  <property name="stock">gtk-add</property>
-	  <property name="icon_size">1</property>
-	  <property name="xalign">0.5</property>
-	  <property name="yalign">0.5</property>
-	  <property name="xpad">0</property>
-	  <property name="ypad">0</property>
-	</widget>
-      </child>
-
-      <child>
-	<widget class="GtkMenu" id="comments_menu">
-
-	  <child>
-	    <widget class="GtkMenuItem" id="add_changelog_entry2">
-	      <property name="visible">True</property>
-	      <property name="tooltip" translatable="yes">Inserts a typical ChangeLog entry in the current file</property>
-	      <property name="label" translatable="yes">Insert _ChangeLog Entry</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_comments_changelog_activate" last_modification_time="Sun, 02 Oct 2005 17:30:10 GMT"/>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="insert_file_header2">
-	      <property name="visible">True</property>
-	      <property name="tooltip" translatable="yes">Inserts a file header at the beginning of the file</property>
-	      <property name="label" translatable="yes">Insert File _Header</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_comments_fileheader_activate" last_modification_time="Mon, 03 Oct 2005 17:33:08 GMT"/>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="insert_function_description1">
-	      <property name="visible">True</property>
-	      <property name="tooltip" translatable="yes">Inserts a description before the current function</property>
-	      <property name="label" translatable="yes">Insert _Function Description</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_comments_function_activate" last_modification_time="Sat, 01 Oct 2005 17:28:26 GMT"/>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="insert_multiline_comment1">
-	      <property name="visible">True</property>
-	      <property name="tooltip" translatable="yes">Inserts a multiline comment</property>
-	      <property name="label" translatable="yes">Insert _Multiline Comment</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_comments_multiline_activate" last_modification_time="Sat, 01 Oct 2005 17:28:26 GMT"/>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="insert_gpl_notice1">
-	      <property name="visible">True</property>
-	      <property name="tooltip" translatable="yes">Inserts a GPL notice (should be done at the beginning of the file)</property>
-	      <property name="label" translatable="yes">Insert _GPL Notice</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_comments_gpl_activate" last_modification_time="Sun, 02 Oct 2005 17:37:31 GMT"/>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="insert_bsd_license_notice1">
-	      <property name="visible">True</property>
-	      <property name="tooltip" translatable="yes">Inserts a BSD license notice (should be done at the beginning of the file)</property>
-	      <property name="label" translatable="yes">Insert _BSD License Notice</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_comments_bsd_activate" last_modification_time="Fri, 05 Jan 2007 13:32:16 GMT"/>
-	    </widget>
-	  </child>
-	</widget>
-      </child>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkImageMenuItem" id="insert_date2">
-      <property name="visible">True</property>
-      <property name="label" translatable="yes">Insert Dat_e</property>
-      <property name="use_underline">True</property>
-
-      <child internal-child="image">
-	<widget class="GtkImage" id="image2592">
-	  <property name="visible">True</property>
-	  <property name="stock">gtk-add</property>
-	  <property name="icon_size">1</property>
-	  <property name="xalign">0.5</property>
-	  <property name="yalign">0.5</property>
-	  <property name="xpad">0</property>
-	  <property name="ypad">0</property>
-	</widget>
-      </child>
-
-      <child>
-	<widget class="GtkMenu" id="insert_date2_menu">
-
-	  <child>
-	    <widget class="GtkMenuItem" id="invisible10">
-	      <property name="label" translatable="yes">invisible</property>
-	      <property name="use_underline">True</property>
-	    </widget>
-	  </child>
-	</widget>
-      </child>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkImageMenuItem" id="insert_include1">
-      <property name="visible">True</property>
-      <property name="label" translatable="yes">_Insert "include <...>"</property>
-      <property name="use_underline">True</property>
-
-      <child internal-child="image">
-	<widget class="GtkImage" id="image2593">
-	  <property name="visible">True</property>
-	  <property name="stock">gtk-add</property>
-	  <property name="icon_size">1</property>
-	  <property name="xalign">0.5</property>
-	  <property name="yalign">0.5</property>
-	  <property name="xpad">0</property>
-	  <property name="ypad">0</property>
-	</widget>
-      </child>
-
-      <child>
-	<widget class="GtkMenu" id="insert_include1_menu">
-
-	  <child>
-	    <widget class="GtkMenuItem" id="invisible3">
-	      <property name="label" translatable="yes">invisible</property>
-	      <property name="use_underline">True</property>
-	    </widget>
-	  </child>
-	</widget>
-      </child>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkSeparatorMenuItem" id="separator7">
-      <property name="visible">True</property>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkMenuItem" id="current_word1">
-      <property name="visible">True</property>
-      <property name="label" translatable="yes">Current _Word</property>
-      <property name="use_underline">True</property>
-
-      <child>
-	<widget class="GtkMenu" id="current_word1_menu">
-
-	  <child>
-	    <widget class="GtkImageMenuItem" id="find_usage1">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Find _Usage</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_find_usage1_activate" last_modification_time="Fri, 27 May 2005 21:55:12 GMT"/>
-
-	      <child internal-child="image">
-		<widget class="GtkImage" id="image2594">
-		  <property name="visible">True</property>
-		  <property name="stock">gtk-find</property>
-		  <property name="icon_size">1</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		</widget>
-	      </child>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkImageMenuItem" id="find_document_usage1">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Find _Document Usage</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_find_document_usage1_activate" last_modification_time="Thu, 17 Jul 2008 13:42:25 GMT"/>
-
-	      <child internal-child="image">
-		<widget class="GtkImage" id="image2595">
-		  <property name="visible">True</property>
-		  <property name="stock">gtk-find</property>
-		  <property name="icon_size">1</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		</widget>
-	      </child>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkSeparatorMenuItem" id="separator47">
-	      <property name="visible">True</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="goto_tag_definition1">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Go to _Tag Definition</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_goto_tag_activate" last_modification_time="Sun, 29 May 2005 22:08:28 GMT"/>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="goto_tag_declaration1">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Go to T_ag Declaration</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_goto_tag_activate" last_modification_time="Sun, 29 May 2005 22:08:28 GMT"/>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkSeparatorMenuItem" id="separator48">
-	      <property name="visible">True</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkMenuItem" id="context_action1">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Conte_xt Action</property>
-	      <property name="use_underline">True</property>
-	      <signal name="activate" handler="on_context_action1_activate" last_modification_time="Fri, 13 Apr 2007 18:37:55 GMT"/>
-	    </widget>
-	  </child>
-	</widget>
-      </child>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkSeparatorMenuItem" id="separator15">
-      <property name="visible">True</property>
-    </widget>
-  </child>
-
-  <child>
-    <widget class="GtkImageMenuItem" id="go_to_line">
-      <property name="visible">True</property>
-      <property name="tooltip" translatable="yes">Go to the entered line</property>
-      <property name="label" translatable="yes">_Go to Line</property>
-      <property name="use_underline">True</property>
-      <signal name="activate" handler="on_go_to_line_activate" last_modification_time="Sat, 16 Jul 2005 11:20:32 GMT"/>
-
-      <child internal-child="image">
-	<widget class="GtkImage" id="image2596">
-	  <property name="visible">True</property>
-	  <property name="stock">gtk-jump-to</property>
-	  <property name="icon_size">1</property>
-	  <property name="xalign">0.5</property>
-	  <property name="yalign">0.5</property>
-	  <property name="xpad">0</property>
-	  <property name="ypad">0</property>
-	</widget>
-      </child>
-    </widget>
-  </child>
-</widget>
-
 <widget class="GtkDialog" id="prefs_dialog">
   <property name="visible">True</property>
   <property name="title" translatable="yes">Preferences</property>

Modified: branches/dynamic-editor-menu/src/Makefile.am
===================================================================
--- branches/dynamic-editor-menu/src/Makefile.am	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/src/Makefile.am	2008-07-22 16:54:02 UTC (rev 2802)
@@ -40,6 +40,7 @@
 	tools.c tools.h \
 	treeviews.c treeviews.h \
 	ui_utils.c ui_utils.h \
+	ui_manager.c ui_manager.h \
 	utils.c utils.h
 
 

Modified: branches/dynamic-editor-menu/src/callbacks.c
===================================================================
--- branches/dynamic-editor-menu/src/callbacks.c	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/src/callbacks.c	2008-07-22 16:54:02 UTC (rev 2802)
@@ -270,7 +270,7 @@
 {
 	GeanyDocument *doc = document_get_current();
 	ui_update_menu_copy_items(doc);
-	ui_update_insert_include_item(doc, 1);
+	ui_update_insert_include_item(doc, UI_INSERT_INCLUDE_ITEM_MENU);
 }
 
 
@@ -1047,21 +1047,32 @@
 
 
 void
-on_goto_tag_activate                   (GtkMenuItem     *menuitem,
+on_goto_tag_definition_activate        (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
-	gboolean definition = (menuitem ==
-		GTK_MENU_ITEM(lookup_widget(main_widgets.editor_menu, "goto_tag_definition1")));
 	GeanyDocument *doc = document_get_current();
 
 	g_return_if_fail(doc != NULL);
 
 	sci_set_current_position(doc->editor->sci, editor_info.click_pos, FALSE);
-	symbols_goto_tag(editor_info.current_word, definition);
+	symbols_goto_tag(editor_info.current_word, TRUE);
 }
 
 
 void
+on_goto_tag_declaration_activate       (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+	GeanyDocument *doc = document_get_current();
+
+	g_return_if_fail(doc != NULL);
+
+	sci_set_current_position(doc->editor->sci, editor_info.click_pos, FALSE);
+	symbols_goto_tag(editor_info.current_word, FALSE);
+}
+
+
+void
 on_count_words1_activate               (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {

Modified: branches/dynamic-editor-menu/src/callbacks.h
===================================================================
--- branches/dynamic-editor-menu/src/callbacks.h	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/src/callbacks.h	2008-07-22 16:54:02 UTC (rev 2802)
@@ -236,10 +236,14 @@
                                         gpointer         user_data);
 
 void
-on_goto_tag_activate                   (GtkMenuItem     *menuitem,
+on_goto_tag_definition_activate        (GtkMenuItem     *menuitem,
                                         gpointer         user_data);
 
 void
+on_goto_tag_declaration_activate       (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
 on_construct_completion1_activate      (GtkMenuItem     *menuitem,
                                         gpointer         user_data);
 

Modified: branches/dynamic-editor-menu/src/dialogs.c
===================================================================
--- branches/dynamic-editor-menu/src/dialogs.c	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/src/dialogs.c	2008-07-22 16:54:02 UTC (rev 2802)
@@ -196,6 +196,7 @@
 	gtk_window_set_type_hint(GTK_WINDOW(ui_widgets.open_filesel), GDK_WINDOW_TYPE_HINT_DIALOG);
 	gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.open_filesel), GTK_WINDOW(main_widgets.window));
 	gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(ui_widgets.open_filesel), TRUE);
+	gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(ui_widgets.open_filesel), FALSE);
 
 	/* add checkboxes and filename entry */
 	gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(ui_widgets.open_filesel),

Modified: branches/dynamic-editor-menu/src/editor.c
===================================================================
--- branches/dynamic-editor-menu/src/editor.c	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/src/editor.c	2008-07-22 16:54:02 UTC (rev 2802)
@@ -199,7 +199,7 @@
 
 		ui_update_popup_goto_items((current_word[0] != '\0') ? TRUE : FALSE);
 		ui_update_popup_copy_items(doc);
-		ui_update_insert_include_item(doc, 0);
+		ui_update_insert_include_item(doc, UI_INSERT_INCLUDE_ITEM_POPUP);
 
 		if (geany_object)
 		{

Modified: branches/dynamic-editor-menu/src/interface.c
===================================================================
--- branches/dynamic-editor-menu/src/interface.c	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/src/interface.c	2008-07-22 16:54:02 UTC (rev 2802)
@@ -2077,492 +2077,6 @@
 }
 
 GtkWidget*
-create_edit_menu1 (void)
-{
-  GtkWidget *edit_menu1;
-  GtkWidget *undo1;
-  GtkWidget *redo1;
-  GtkWidget *separator2;
-  GtkWidget *cut1;
-  GtkWidget *copy1;
-  GtkWidget *paste1;
-  GtkWidget *delete1;
-  GtkWidget *separator3;
-  GtkWidget *menu_select_all2;
-  GtkWidget *separator26;
-  GtkWidget *menu_open_selected_file2;
-  GtkWidget *separator36;
-  GtkWidget *menu_format2;
-  GtkWidget *menu_format2_menu;
-  GtkWidget *toggle_case1;
-  GtkWidget *separator30;
-  GtkWidget *menu_comment_line2;
-  GtkWidget *menu_uncomment_line2;
-  GtkWidget *menu_toggle_line_commentation2;
-  GtkWidget *menu_duplicate_line2;
-  GtkWidget *separator31;
-  GtkWidget *menu_increase_indent2;
-  GtkWidget *image2589;
-  GtkWidget *menu_decrease_indent2;
-  GtkWidget *image2590;
-  GtkWidget *separator38;
-  GtkWidget *send_selection_to1;
-  GtkWidget *send_selection_to1_menu;
-  GtkWidget *invisible12;
-  GtkWidget *separator17;
-  GtkWidget *comments;
-  GtkWidget *image2591;
-  GtkWidget *comments_menu;
-  GtkWidget *add_changelog_entry2;
-  GtkWidget *insert_file_header2;
-  GtkWidget *insert_function_description1;
-  GtkWidget *insert_multiline_comment1;
-  GtkWidget *insert_gpl_notice1;
-  GtkWidget *insert_bsd_license_notice1;
-  GtkWidget *insert_date2;
-  GtkWidget *image2592;
-  GtkWidget *insert_date2_menu;
-  GtkWidget *invisible10;
-  GtkWidget *insert_include1;
-  GtkWidget *image2593;
-  GtkWidget *insert_include1_menu;
-  GtkWidget *invisible3;
-  GtkWidget *separator7;
-  GtkWidget *current_word1;
-  GtkWidget *current_word1_menu;
-  GtkWidget *find_usage1;
-  GtkWidget *image2594;
-  GtkWidget *find_document_usage1;
-  GtkWidget *image2595;
-  GtkWidget *separator47;
-  GtkWidget *goto_tag_definition1;
-  GtkWidget *goto_tag_declaration1;
-  GtkWidget *separator48;
-  GtkWidget *context_action1;
-  GtkWidget *separator15;
-  GtkWidget *go_to_line;
-  GtkWidget *image2596;
-  GtkAccelGroup *accel_group;
-  GtkTooltips *tooltips;
-
-  tooltips = gtk_tooltips_new ();
-
-  accel_group = gtk_accel_group_new ();
-
-  edit_menu1 = gtk_menu_new ();
-
-  undo1 = gtk_image_menu_item_new_from_stock ("gtk-undo", accel_group);
-  gtk_widget_show (undo1);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), undo1);
-
-  redo1 = gtk_image_menu_item_new_from_stock ("gtk-redo", accel_group);
-  gtk_widget_show (redo1);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), redo1);
-
-  separator2 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator2);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), separator2);
-  gtk_widget_set_sensitive (separator2, FALSE);
-
-  cut1 = gtk_image_menu_item_new_from_stock ("gtk-cut", accel_group);
-  gtk_widget_show (cut1);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), cut1);
-
-  copy1 = gtk_image_menu_item_new_from_stock ("gtk-copy", accel_group);
-  gtk_widget_show (copy1);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), copy1);
-
-  paste1 = gtk_image_menu_item_new_from_stock ("gtk-paste", accel_group);
-  gtk_widget_show (paste1);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), paste1);
-
-  delete1 = gtk_image_menu_item_new_from_stock ("gtk-delete", accel_group);
-  gtk_widget_show (delete1);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), delete1);
-
-  separator3 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator3);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), separator3);
-  gtk_widget_set_sensitive (separator3, FALSE);
-
-  menu_select_all2 = gtk_menu_item_new_with_mnemonic (_("Select _All"));
-  gtk_widget_show (menu_select_all2);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), menu_select_all2);
-
-  separator26 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator26);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), separator26);
-  gtk_widget_set_sensitive (separator26, FALSE);
-
-  menu_open_selected_file2 = gtk_menu_item_new_with_mnemonic (_("Open Selected F_ile"));
-  gtk_widget_show (menu_open_selected_file2);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), menu_open_selected_file2);
-
-  separator36 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator36);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), separator36);
-  gtk_widget_set_sensitive (separator36, FALSE);
-
-  menu_format2 = gtk_menu_item_new_with_mnemonic (_("_Format"));
-  gtk_widget_show (menu_format2);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), menu_format2);
-
-  menu_format2_menu = gtk_menu_new ();
-  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_format2), menu_format2_menu);
-
-  toggle_case1 = gtk_menu_item_new_with_mnemonic (_("T_oggle Case of Selection"));
-  gtk_widget_show (toggle_case1);
-  gtk_container_add (GTK_CONTAINER (menu_format2_menu), toggle_case1);
-
-  separator30 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator30);
-  gtk_container_add (GTK_CONTAINER (menu_format2_menu), separator30);
-  gtk_widget_set_sensitive (separator30, FALSE);
-
-  menu_comment_line2 = gtk_menu_item_new_with_mnemonic (_("_Comment Line(s)"));
-  gtk_widget_show (menu_comment_line2);
-  gtk_container_add (GTK_CONTAINER (menu_format2_menu), menu_comment_line2);
-
-  menu_uncomment_line2 = gtk_menu_item_new_with_mnemonic (_("U_ncomment Line(s)"));
-  gtk_widget_show (menu_uncomment_line2);
-  gtk_container_add (GTK_CONTAINER (menu_format2_menu), menu_uncomment_line2);
-
-  menu_toggle_line_commentation2 = gtk_menu_item_new_with_mnemonic (_("_Toggle Line Commentation"));
-  gtk_widget_show (menu_toggle_line_commentation2);
-  gtk_container_add (GTK_CONTAINER (menu_format2_menu), menu_toggle_line_commentation2);
-
-  menu_duplicate_line2 = gtk_menu_item_new_with_mnemonic (_("Du_plicate Line or Selection"));
-  gtk_widget_show (menu_duplicate_line2);
-  gtk_container_add (GTK_CONTAINER (menu_format2_menu), menu_duplicate_line2);
-
-  separator31 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator31);
-  gtk_container_add (GTK_CONTAINER (menu_format2_menu), separator31);
-  gtk_widget_set_sensitive (separator31, FALSE);
-
-  menu_increase_indent2 = gtk_image_menu_item_new_with_mnemonic (_("_Increase Indent"));
-  gtk_widget_show (menu_increase_indent2);
-  gtk_container_add (GTK_CONTAINER (menu_format2_menu), menu_increase_indent2);
-
-  image2589 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2589);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent2), image2589);
-
-  menu_decrease_indent2 = gtk_image_menu_item_new_with_mnemonic (_("_Decrease Indent"));
-  gtk_widget_show (menu_decrease_indent2);
-  gtk_container_add (GTK_CONTAINER (menu_format2_menu), menu_decrease_indent2);
-
-  image2590 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2590);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent2), image2590);
-
-  separator38 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator38);
-  gtk_container_add (GTK_CONTAINER (menu_format2_menu), separator38);
-  gtk_widget_set_sensitive (separator38, FALSE);
-
-  send_selection_to1 = gtk_menu_item_new_with_mnemonic (_("_Send Selection to"));
-  gtk_widget_show (send_selection_to1);
-  gtk_container_add (GTK_CONTAINER (menu_format2_menu), send_selection_to1);
-
-  send_selection_to1_menu = gtk_menu_new ();
-  gtk_menu_item_set_submenu (GTK_MENU_ITEM (send_selection_to1), send_selection_to1_menu);
-
-  invisible12 = gtk_menu_item_new_with_mnemonic (_("invisible"));
-  gtk_container_add (GTK_CONTAINER (send_selection_to1_menu), invisible12);
-
-  separator17 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator17);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), separator17);
-  gtk_widget_set_sensitive (separator17, FALSE);
-
-  comments = gtk_image_menu_item_new_with_mnemonic (_("I_nsert Comments"));
-  gtk_widget_show (comments);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), comments);
-
-  image2591 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2591);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (comments), image2591);
-
-  comments_menu = gtk_menu_new ();
-  gtk_menu_item_set_submenu (GTK_MENU_ITEM (comments), comments_menu);
-
-  add_changelog_entry2 = gtk_menu_item_new_with_mnemonic (_("Insert _ChangeLog Entry"));
-  gtk_widget_show (add_changelog_entry2);
-  gtk_container_add (GTK_CONTAINER (comments_menu), add_changelog_entry2);
-  gtk_tooltips_set_tip (tooltips, add_changelog_entry2, _("Inserts a typical ChangeLog entry in the current file"), NULL);
-
-  insert_file_header2 = gtk_menu_item_new_with_mnemonic (_("Insert File _Header"));
-  gtk_widget_show (insert_file_header2);
-  gtk_container_add (GTK_CONTAINER (comments_menu), insert_file_header2);
-  gtk_tooltips_set_tip (tooltips, insert_file_header2, _("Inserts a file header at the beginning of the file"), NULL);
-
-  insert_function_description1 = gtk_menu_item_new_with_mnemonic (_("Insert _Function Description"));
-  gtk_widget_show (insert_function_description1);
-  gtk_container_add (GTK_CONTAINER (comments_menu), insert_function_description1);
-  gtk_tooltips_set_tip (tooltips, insert_function_description1, _("Inserts a description before the current function"), NULL);
-
-  insert_multiline_comment1 = gtk_menu_item_new_with_mnemonic (_("Insert _Multiline Comment"));
-  gtk_widget_show (insert_multiline_comment1);
-  gtk_container_add (GTK_CONTAINER (comments_menu), insert_multiline_comment1);
-  gtk_tooltips_set_tip (tooltips, insert_multiline_comment1, _("Inserts a multiline comment"), NULL);
-
-  insert_gpl_notice1 = gtk_menu_item_new_with_mnemonic (_("Insert _GPL Notice"));
-  gtk_widget_show (insert_gpl_notice1);
-  gtk_container_add (GTK_CONTAINER (comments_menu), insert_gpl_notice1);
-  gtk_tooltips_set_tip (tooltips, insert_gpl_notice1, _("Inserts a GPL notice (should be done at the beginning of the file)"), NULL);
-
-  insert_bsd_license_notice1 = gtk_menu_item_new_with_mnemonic (_("Insert _BSD License Notice"));
-  gtk_widget_show (insert_bsd_license_notice1);
-  gtk_container_add (GTK_CONTAINER (comments_menu), insert_bsd_license_notice1);
-  gtk_tooltips_set_tip (tooltips, insert_bsd_license_notice1, _("Inserts a BSD license notice (should be done at the beginning of the file)"), NULL);
-
-  insert_date2 = gtk_image_menu_item_new_with_mnemonic (_("Insert Dat_e"));
-  gtk_widget_show (insert_date2);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), insert_date2);
-
-  image2592 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2592);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date2), image2592);
-
-  insert_date2_menu = gtk_menu_new ();
-  gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_date2), insert_date2_menu);
-
-  invisible10 = gtk_menu_item_new_with_mnemonic (_("invisible"));
-  gtk_container_add (GTK_CONTAINER (insert_date2_menu), invisible10);
-
-  insert_include1 = gtk_image_menu_item_new_with_mnemonic (_("_Insert \"include <...>\""));
-  gtk_widget_show (insert_include1);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), insert_include1);
-
-  image2593 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2593);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include1), image2593);
-
-  insert_include1_menu = gtk_menu_new ();
-  gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include1), insert_include1_menu);
-
-  invisible3 = gtk_menu_item_new_with_mnemonic (_("invisible"));
-  gtk_container_add (GTK_CONTAINER (insert_include1_menu), invisible3);
-
-  separator7 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator7);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), separator7);
-  gtk_widget_set_sensitive (separator7, FALSE);
-
-  current_word1 = gtk_menu_item_new_with_mnemonic (_("Current _Word"));
-  gtk_widget_show (current_word1);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), current_word1);
-
-  current_word1_menu = gtk_menu_new ();
-  gtk_menu_item_set_submenu (GTK_MENU_ITEM (current_word1), current_word1_menu);
-
-  find_usage1 = gtk_image_menu_item_new_with_mnemonic (_("Find _Usage"));
-  gtk_widget_show (find_usage1);
-  gtk_container_add (GTK_CONTAINER (current_word1_menu), find_usage1);
-
-  image2594 = gtk_image_new_from_stock ("gtk-find", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2594);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (find_usage1), image2594);
-
-  find_document_usage1 = gtk_image_menu_item_new_with_mnemonic (_("Find _Document Usage"));
-  gtk_widget_show (find_document_usage1);
-  gtk_container_add (GTK_CONTAINER (current_word1_menu), find_document_usage1);
-
-  image2595 = gtk_image_new_from_stock ("gtk-find", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2595);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (find_document_usage1), image2595);
-
-  separator47 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator47);
-  gtk_container_add (GTK_CONTAINER (current_word1_menu), separator47);
-  gtk_widget_set_sensitive (separator47, FALSE);
-
-  goto_tag_definition1 = gtk_menu_item_new_with_mnemonic (_("Go to _Tag Definition"));
-  gtk_widget_show (goto_tag_definition1);
-  gtk_container_add (GTK_CONTAINER (current_word1_menu), goto_tag_definition1);
-
-  goto_tag_declaration1 = gtk_menu_item_new_with_mnemonic (_("Go to T_ag Declaration"));
-  gtk_widget_show (goto_tag_declaration1);
-  gtk_container_add (GTK_CONTAINER (current_word1_menu), goto_tag_declaration1);
-
-  separator48 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator48);
-  gtk_container_add (GTK_CONTAINER (current_word1_menu), separator48);
-  gtk_widget_set_sensitive (separator48, FALSE);
-
-  context_action1 = gtk_menu_item_new_with_mnemonic (_("Conte_xt Action"));
-  gtk_widget_show (context_action1);
-  gtk_container_add (GTK_CONTAINER (current_word1_menu), context_action1);
-
-  separator15 = gtk_separator_menu_item_new ();
-  gtk_widget_show (separator15);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), separator15);
-  gtk_widget_set_sensitive (separator15, FALSE);
-
-  go_to_line = gtk_image_menu_item_new_with_mnemonic (_("_Go to Line"));
-  gtk_widget_show (go_to_line);
-  gtk_container_add (GTK_CONTAINER (edit_menu1), go_to_line);
-  gtk_tooltips_set_tip (tooltips, go_to_line, _("Go to the entered line"), NULL);
-
-  image2596 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2596);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line), image2596);
-
-  g_signal_connect ((gpointer) undo1, "activate",
-                    G_CALLBACK (on_undo1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) redo1, "activate",
-                    G_CALLBACK (on_redo1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) cut1, "activate",
-                    G_CALLBACK (on_cut1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) copy1, "activate",
-                    G_CALLBACK (on_copy1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) paste1, "activate",
-                    G_CALLBACK (on_paste1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) delete1, "activate",
-                    G_CALLBACK (on_delete1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) menu_select_all2, "activate",
-                    G_CALLBACK (on_menu_select_all1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) menu_open_selected_file2, "activate",
-                    G_CALLBACK (on_menu_open_selected_file1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) toggle_case1, "activate",
-                    G_CALLBACK (on_toggle_case1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) menu_comment_line2, "activate",
-                    G_CALLBACK (on_menu_comment_line1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) menu_uncomment_line2, "activate",
-                    G_CALLBACK (on_menu_uncomment_line1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) menu_toggle_line_commentation2, "activate",
-                    G_CALLBACK (on_menu_toggle_line_commentation1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) menu_duplicate_line2, "activate",
-                    G_CALLBACK (on_menu_duplicate_line1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) menu_increase_indent2, "activate",
-                    G_CALLBACK (on_menu_increase_indent1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) menu_decrease_indent2, "activate",
-                    G_CALLBACK (on_menu_decrease_indent1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) add_changelog_entry2, "activate",
-                    G_CALLBACK (on_comments_changelog_activate),
-                    NULL);
-  g_signal_connect ((gpointer) insert_file_header2, "activate",
-                    G_CALLBACK (on_comments_fileheader_activate),
-                    NULL);
-  g_signal_connect ((gpointer) insert_function_description1, "activate",
-                    G_CALLBACK (on_comments_function_activate),
-                    NULL);
-  g_signal_connect ((gpointer) insert_multiline_comment1, "activate",
-                    G_CALLBACK (on_comments_multiline_activate),
-                    NULL);
-  g_signal_connect ((gpointer) insert_gpl_notice1, "activate",
-                    G_CALLBACK (on_comments_gpl_activate),
-                    NULL);
-  g_signal_connect ((gpointer) insert_bsd_license_notice1, "activate",
-                    G_CALLBACK (on_comments_bsd_activate),
-                    NULL);
-  g_signal_connect ((gpointer) find_usage1, "activate",
-                    G_CALLBACK (on_find_usage1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) find_document_usage1, "activate",
-                    G_CALLBACK (on_find_document_usage1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) goto_tag_definition1, "activate",
-                    G_CALLBACK (on_goto_tag_activate),
-                    NULL);
-  g_signal_connect ((gpointer) goto_tag_declaration1, "activate",
-                    G_CALLBACK (on_goto_tag_activate),
-                    NULL);
-  g_signal_connect ((gpointer) context_action1, "activate",
-                    G_CALLBACK (on_context_action1_activate),
-                    NULL);
-  g_signal_connect ((gpointer) go_to_line, "activate",
-                    G_CALLBACK (on_go_to_line_activate),
-                    NULL);
-
-  /* Store pointers to all widgets, for use by lookup_widget(). */
-  GLADE_HOOKUP_OBJECT_NO_REF (edit_menu1, edit_menu1, "edit_menu1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, undo1, "undo1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, redo1, "redo1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, separator2, "separator2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, cut1, "cut1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, copy1, "copy1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, paste1, "paste1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, delete1, "delete1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, separator3, "separator3");
-  GLADE_HOOKUP_OBJECT (edit_menu1, menu_select_all2, "menu_select_all2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, separator26, "separator26");
-  GLADE_HOOKUP_OBJECT (edit_menu1, menu_open_selected_file2, "menu_open_selected_file2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, separator36, "separator36");
-  GLADE_HOOKUP_OBJECT (edit_menu1, menu_format2, "menu_format2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, menu_format2_menu, "menu_format2_menu");
-  GLADE_HOOKUP_OBJECT (edit_menu1, toggle_case1, "toggle_case1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, separator30, "separator30");
-  GLADE_HOOKUP_OBJECT (edit_menu1, menu_comment_line2, "menu_comment_line2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, menu_uncomment_line2, "menu_uncomment_line2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, menu_toggle_line_commentation2, "menu_toggle_line_commentation2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, menu_duplicate_line2, "menu_duplicate_line2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, separator31, "separator31");
-  GLADE_HOOKUP_OBJECT (edit_menu1, menu_increase_indent2, "menu_increase_indent2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, image2589, "image2589");
-  GLADE_HOOKUP_OBJECT (edit_menu1, menu_decrease_indent2, "menu_decrease_indent2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, image2590, "image2590");
-  GLADE_HOOKUP_OBJECT (edit_menu1, separator38, "separator38");
-  GLADE_HOOKUP_OBJECT (edit_menu1, send_selection_to1, "send_selection_to1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, send_selection_to1_menu, "send_selection_to1_menu");
-  GLADE_HOOKUP_OBJECT (edit_menu1, invisible12, "invisible12");
-  GLADE_HOOKUP_OBJECT (edit_menu1, separator17, "separator17");
-  GLADE_HOOKUP_OBJECT (edit_menu1, comments, "comments");
-  GLADE_HOOKUP_OBJECT (edit_menu1, image2591, "image2591");
-  GLADE_HOOKUP_OBJECT (edit_menu1, comments_menu, "comments_menu");
-  GLADE_HOOKUP_OBJECT (edit_menu1, add_changelog_entry2, "add_changelog_entry2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, insert_file_header2, "insert_file_header2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, insert_function_description1, "insert_function_description1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, insert_multiline_comment1, "insert_multiline_comment1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, insert_gpl_notice1, "insert_gpl_notice1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, insert_bsd_license_notice1, "insert_bsd_license_notice1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, insert_date2, "insert_date2");
-  GLADE_HOOKUP_OBJECT (edit_menu1, image2592, "image2592");
-  GLADE_HOOKUP_OBJECT (edit_menu1, insert_date2_menu, "insert_date2_menu");
-  GLADE_HOOKUP_OBJECT (edit_menu1, invisible10, "invisible10");
-  GLADE_HOOKUP_OBJECT (edit_menu1, insert_include1, "insert_include1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, image2593, "image2593");
-  GLADE_HOOKUP_OBJECT (edit_menu1, insert_include1_menu, "insert_include1_menu");
-  GLADE_HOOKUP_OBJECT (edit_menu1, invisible3, "invisible3");
-  GLADE_HOOKUP_OBJECT (edit_menu1, separator7, "separator7");
-  GLADE_HOOKUP_OBJECT (edit_menu1, current_word1, "current_word1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, current_word1_menu, "current_word1_menu");
-  GLADE_HOOKUP_OBJECT (edit_menu1, find_usage1, "find_usage1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, image2594, "image2594");
-  GLADE_HOOKUP_OBJECT (edit_menu1, find_document_usage1, "find_document_usage1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, image2595, "image2595");
-  GLADE_HOOKUP_OBJECT (edit_menu1, separator47, "separator47");
-  GLADE_HOOKUP_OBJECT (edit_menu1, goto_tag_definition1, "goto_tag_definition1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, goto_tag_declaration1, "goto_tag_declaration1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, separator48, "separator48");
-  GLADE_HOOKUP_OBJECT (edit_menu1, context_action1, "context_action1");
-  GLADE_HOOKUP_OBJECT (edit_menu1, separator15, "separator15");
-  GLADE_HOOKUP_OBJECT (edit_menu1, go_to_line, "go_to_line");
-  GLADE_HOOKUP_OBJECT (edit_menu1, image2596, "image2596");
-  GLADE_HOOKUP_OBJECT_NO_REF (edit_menu1, tooltips, "tooltips");
-
-  gtk_menu_set_accel_group (GTK_MENU (edit_menu1), accel_group);
-
-  return edit_menu1;
-}
-
-GtkWidget*
 create_prefs_dialog (void)
 {
   GtkWidget *prefs_dialog;

Modified: branches/dynamic-editor-menu/src/interface.h
===================================================================
--- branches/dynamic-editor-menu/src/interface.h	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/src/interface.h	2008-07-22 16:54:02 UTC (rev 2802)
@@ -4,5 +4,4 @@
 
 GtkWidget* create_window1 (void);
 GtkWidget* create_toolbar_popup_menu1 (void);
-GtkWidget* create_edit_menu1 (void);
 GtkWidget* create_prefs_dialog (void);

Modified: branches/dynamic-editor-menu/src/keybindings.c
===================================================================
--- branches/dynamic-editor-menu/src/keybindings.c	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/src/keybindings.c	2008-07-22 16:54:02 UTC (rev 2802)
@@ -90,7 +90,6 @@
 static void cb_func_move_tab(guint key_id);
 static void cb_func_toggle_sidebar(guint key_id);
 
-static void add_popup_menu_accels(void);
 static void apply_kb_accel(KeyBindingGroup *group, KeyBinding *kb, gpointer user_data);
 
 
@@ -161,8 +160,7 @@
 		GEANY_KEYS_ ## group_id ## _COUNT, group_id ## _keys)
 
 /* Init all fields of keys with default values.
- * The menu_item field is always the main menu item, popup menu accelerators are
- * set in add_popup_menu_accels(). */
+ * The menu_item field is always the main menu item. */
 static void init_default_kb(void)
 {
 	static KeyBindingGroup groups[GEANY_KEY_GROUP_COUNT];
@@ -557,7 +555,6 @@
 void keybindings_load_keyfile(void)
 {
 	load_user_kb();
-	add_popup_menu_accels();
 
 	/* set menu accels now, after user keybindings have been read and processed
 	 * if we would set it before, user keybindings could not override menu item's default
@@ -566,64 +563,6 @@
 }
 
 
-static void add_menu_accel(KeyBindingGroup *group, guint kb_id,
-	GtkAccelGroup *accel_group, GtkWidget *menuitem)
-{
-	KeyBinding *kb = &group->keys[kb_id];
-
-	if (kb->key != 0)
-		gtk_widget_add_accelerator(menuitem, "activate", accel_group,
-			kb->key, kb->mods, GTK_ACCEL_VISIBLE);
-}
-
-
-#define GEANY_ADD_POPUP_ACCEL(kb_id, wid) \
-	add_menu_accel(group, kb_id, accel_group, lookup_widget(main_widgets.editor_menu, G_STRINGIFY(wid)))
-
-/* set the menu item accelerator shortcuts (just for visibility, they are handled anyway) */
-static void add_popup_menu_accels(void)
-{
-	GtkAccelGroup *accel_group = gtk_accel_group_new();
-	KeyBindingGroup *group;
-
-	group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_EDITOR);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_EDITOR_UNDO, undo1);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_EDITOR_REDO, redo1);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_EDITOR_DUPLICATELINE, menu_duplicate_line2);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_EDITOR_CONTEXTACTION, context_action1);
-
-	group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_SELECT);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_SELECT_ALL, menu_select_all2);
-
-	group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_INSERT);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_INSERT_DATE, insert_date_custom2);
-
-	group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_FILE);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FILE_OPENSELECTED, menu_open_selected_file2);
-
-	group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_SEARCH);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_SEARCH_FINDUSAGE, find_usage1);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_SEARCH_FINDDOCUMENTUSAGE, find_document_usage1);
-
-	group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_GOTO);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_GOTO_LINE, go_to_line);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_GOTO_TAGDEFINITION, goto_tag_definition1);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_GOTO_TAGDECLARATION, goto_tag_declaration1);
-
-	group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_FORMAT);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_TOGGLECASE, toggle_case1);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_COMMENTLINE, menu_comment_line2);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_UNCOMMENTLINE, menu_uncomment_line2);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_COMMENTLINETOGGLE, menu_toggle_line_commentation2);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_INCREASEINDENT, menu_increase_indent2);
-	GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_FORMAT_DECREASEINDENT, menu_decrease_indent2);
-
-	/* the build menu items are set if the build menus are created */
-
-	gtk_window_add_accel_group(GTK_WINDOW(main_widgets.window), accel_group);
-}
-
-
 static void set_keyfile_kb(KeyBindingGroup *group, KeyBinding *kb, gpointer user_data)
 {
 	GKeyFile *config = user_data;

Modified: branches/dynamic-editor-menu/src/main.c
===================================================================
--- branches/dynamic-editor-menu/src/main.c	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/src/main.c	2008-07-22 16:54:02 UTC (rev 2802)
@@ -47,6 +47,7 @@
 #include "callbacks.h"
 
 #include "ui_utils.h"
+#include "ui_manager.h"
 #include "utils.h"
 #include "document.h"
 #include "filetypes.h"
@@ -305,7 +306,7 @@
 	main_widgets.toolbar = lookup_widget(main_widgets.window, "toolbar1");
 	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();
+	main_widgets.editor_menu = ui_manager_get_edit_menu();
 	main_widgets.tools_menu = lookup_widget(main_widgets.window, "tools1_menu");
 
 	ui_widgets.toolbar_menu = create_toolbar_popup_menu1();
@@ -790,6 +791,7 @@
 		glib_major_version, glib_minor_version, glib_micro_version);
 
 	/* inits */
+	ui_manager_init();
 	main_init();
 	gtk_widget_set_size_request(main_widgets.window, GEANY_WINDOW_MINIMAL_WIDTH, GEANY_WINDOW_MINIMAL_HEIGHT);
 	gtk_window_set_default_size(GTK_WINDOW(main_widgets.window), GEANY_WINDOW_DEFAULT_WIDTH, GEANY_WINDOW_DEFAULT_HEIGHT);
@@ -987,6 +989,7 @@
 	g_free(vte_info.dir);
 #endif
 	gtk_widget_destroy(main_widgets.window);
+	ui_manager_finalize();
 
 	/* destroy popup menus */
 	if (main_widgets.editor_menu && GTK_IS_WIDGET(main_widgets.editor_menu))

Modified: branches/dynamic-editor-menu/src/tools.c
===================================================================
--- branches/dynamic-editor-menu/src/tools.c	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/src/tools.c	2008-07-22 16:54:02 UTC (rev 2802)
@@ -46,6 +46,7 @@
 #include "sciwrappers.h"
 #include "utils.h"
 #include "ui_utils.h"
+#include "ui_manager.h"
 #include "msgwindow.h"
 #include "keybindings.h"
 #include "templates.h"
@@ -482,7 +483,8 @@
 void tools_create_insert_custom_command_menu_items(void)
 {
 	GtkMenu *menu_edit = GTK_MENU(lookup_widget(main_widgets.window, "send_selection_to2_menu"));
-	GtkMenu *menu_popup = GTK_MENU(lookup_widget(main_widgets.editor_menu, "send_selection_to1_menu"));
+	GtkMenu *menu_popup = GTK_MENU(gtk_menu_item_get_submenu(
+		GTK_MENU_ITEM(gtk_ui_manager_get_widget(ui_manager.uim, "/EditorMenu/Format/SendSelectionTo"))));
 	GtkWidget *item;
 	GList *me_children;
 	GList *mp_children;
@@ -538,12 +540,14 @@
 
 	if (! signal_set)
 	{
-		g_signal_connect(lookup_widget(main_widgets.editor_menu, "send_selection_to1"),
+		g_signal_connect(gtk_ui_manager_get_widget(ui_manager.uim, "/EditorMenu/Format/SendSelectionTo"),
 					"activate", G_CALLBACK(cc_on_custom_command_menu_activate), menu_popup);
 		g_signal_connect(lookup_widget(main_widgets.window, "send_selection_to2"),
 					"activate", G_CALLBACK(cc_on_custom_command_menu_activate), menu_edit);
 		signal_set = TRUE;
 	}
+
+	gtk_widget_hide(gtk_ui_manager_get_widget(ui_manager.uim, "/EditorMenu/Format/SendSelectionTo/DummySST"));
 }
 
 

Added: branches/dynamic-editor-menu/src/ui_manager.c
===================================================================
--- branches/dynamic-editor-menu/src/ui_manager.c	                        (rev 0)
+++ branches/dynamic-editor-menu/src/ui_manager.c	2008-07-22 16:54:02 UTC (rev 2802)
@@ -0,0 +1,141 @@
+/*
+ *      ui_manager.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Id$
+ */
+
+/*
+ * UI Manager code for creating the editor menu (popup menu).
+ */
+
+#include "geany.h"
+
+#include "ui_manager.h"
+#include "ui_utils.h"
+#include "support.h"
+#include "callbacks.h"
+#include "utils.h"
+
+
+
+UIManager ui_manager;
+
+
+/* Global list of available actions, might be shared with toolbar actions.
+ * Fields: name, stock_id, label, acceletator, tooltip, callback */
+const GtkActionEntry ui_entries[] = {
+ { "DummySST", NULL, "Dummy", NULL, NULL, NULL },
+ { "DummyDate", NULL, "Dummy", NULL, NULL, NULL },
+ { "DummyInclude", NULL, "Dummy", NULL, NULL, NULL },
+
+ { "Undo", GTK_STOCK_UNDO, NULL, NULL, NULL, G_CALLBACK(on_undo1_activate) },
+ { "Redo", GTK_STOCK_REDO, NULL, NULL, NULL, G_CALLBACK(on_redo1_activate) },
+ { "Cut", GTK_STOCK_CUT, NULL, NULL, NULL, G_CALLBACK(on_cut1_activate) },
+ { "Copy", GTK_STOCK_COPY, NULL, NULL, NULL, G_CALLBACK(on_copy1_activate) },
+ { "Paste", GTK_STOCK_PASTE, NULL, NULL, NULL, G_CALLBACK(on_paste1_activate) },
+ { "Delete", GTK_STOCK_DELETE, NULL, NULL, NULL, G_CALLBACK(on_delete1_activate) },
+ { "SelectAll", NULL, N_("Select _All"), NULL, NULL, G_CALLBACK(on_menu_select_all1_activate) },
+ { "OpenSelectedFile", NULL, N_("Open Selected F_ile"), NULL, NULL, G_CALLBACK(on_menu_open_selected_file1_activate) },
+ /* Format submenu */
+ { "Format", NULL, N_("_Format"), NULL, NULL,  NULL },
+ { "ToggleCase", NULL, N_("T_oggle Case of Selection"), NULL, NULL, G_CALLBACK(on_toggle_case1_activate) },
+ { "CommentLines", NULL, N_("_Comment Line(s)"), NULL, NULL, G_CALLBACK(on_menu_comment_line1_activate) },
+ { "UnCommentLines", NULL, N_("U_ncomment Line(s)"), NULL, NULL, G_CALLBACK(on_menu_uncomment_line1_activate) },
+ { "ToggleLineCommentation", NULL, N_("_Toggle Line Commentation"), NULL, NULL, G_CALLBACK(on_menu_toggle_line_commentation1_activate) },
+ { "DuplicateLine", NULL, N_("Du_plicate Line or Selection"), NULL, NULL, G_CALLBACK(on_menu_duplicate_line1_activate) },
+ { "IncreaseIndent", GTK_STOCK_INDENT, N_("_Increase Indent"), NULL, NULL, G_CALLBACK(on_menu_increase_indent1_activate) },
+ { "DecreaseIndent", GTK_STOCK_UNINDENT, N_("_Decrease Indent"), NULL, NULL, G_CALLBACK(on_menu_decrease_indent1_activate) },
+ /* Format submenu */
+ { "SendSelectionTo", NULL, N_("_Send Selection to"), NULL, NULL,  NULL },
+ /* SendSelectionTo submenu */
+ { "InsertComments", GTK_STOCK_ADD, N_("I_nsert Comments"), NULL, NULL,  NULL },
+ { "InsertChangeLog", NULL, N_("Insert _ChangeLog Entry"), NULL, N_("Inserts a typical ChangeLog entry in the current file"), G_CALLBACK(on_comments_changelog_activate) },
+ { "InsertFileHeader", NULL, N_("Insert File _Header"), NULL, N_("Inserts a file header at the beginning of the file"), G_CALLBACK(on_comments_fileheader_activate) },
+ { "InsertFunctionDescription", NULL, N_("Insert _Function Description"), NULL, N_("Inserts a description before the current function"), G_CALLBACK(on_comments_function_activate) },
+ { "InsertMultilineComment", NULL, N_("Insert _Multiline Comment"), NULL, N_("Inserts a multiline comment"), G_CALLBACK(on_comments_multiline_activate) },
+ { "InsertGPLNotice", NULL, N_("Insert _GPL Notice"), NULL, N_("Inserts a GPL notice (should be done at the beginning of the file)"), G_CALLBACK(on_comments_gpl_activate) },
+ { "InsertBSDNotice", NULL, N_("Insert _BSD License Notice"), NULL, N_("Inserts a BSD license notice (should be done at the beginning of the file)"), G_CALLBACK(on_comments_bsd_activate) },
+ /* InsertDate submenu */
+ { "InsertDate", GTK_STOCK_ADD, N_("Insert Dat_e"), NULL, NULL,  NULL },
+ /* InsertIncludes submenu */
+ { "InsertIncludes", GTK_STOCK_ADD, N_("_Insert \"include <...>\""), NULL, NULL,  NULL },
+ /* CurrentWord submenu */
+ { "CurrentWord", NULL, N_("Current _Word"), NULL, NULL,  NULL },
+ { "FindUsage", NULL, N_("Find _Usage"), NULL, NULL, G_CALLBACK(on_find_usage1_activate) },
+ { "FindDocumentUsage", GTK_STOCK_FIND, N_("Find _Document Usage"), NULL, NULL, G_CALLBACK(on_find_document_usage1_activate) },
+ { "GotoTagDefinition", GTK_STOCK_FIND, N_("Go to _Tag Definition"), NULL, NULL, G_CALLBACK(on_goto_tag_definition_activate) },
+ { "GotoTagDeclaration", GTK_STOCK_FIND, N_("Go to _Tag Declaration"), NULL, NULL, G_CALLBACK(on_goto_tag_declaration_activate) },
+ { "ContextAction", NULL, N_("Conte_xt Action"), NULL, NULL, G_CALLBACK(on_context_action1_activate) },
+ { "GotoLine", GTK_STOCK_JUMP_TO, N_("_Go to Line"), NULL, NULL, G_CALLBACK(on_go_to_line_activate) }
+};
+const guint ui_entries_n = G_N_ELEMENTS(ui_entries);
+
+
+
+GtkWidget *ui_manager_get_edit_menu(void)
+{
+	return gtk_ui_manager_get_widget(ui_manager.uim, "/EditorMenu");
+}
+
+
+GtkAction *ui_manager_get_action(const gchar *name)
+{
+	return gtk_action_group_get_action(ui_manager.group, name);
+}
+
+
+void ui_manager_init(void)
+{
+	GtkUIManager *uim;
+	GtkAction *action;
+	gchar *filename;
+
+	ui_manager.uim = uim = gtk_ui_manager_new();
+	ui_manager.group = gtk_action_group_new("GeanyUI");
+
+	gtk_action_group_set_translation_domain(ui_manager.group, GETTEXT_PACKAGE);
+	gtk_action_group_add_actions(ui_manager.group, ui_entries, ui_entries_n, NULL);
+
+	gtk_ui_manager_insert_action_group(uim, ui_manager.group, 0);
+
+	/* load UI XML file(s) from disk */
+	filename = g_build_filename(app->configdir, "ui_editor_menu.xml", NULL);
+	if (! gtk_ui_manager_add_ui_from_file(uim, filename, NULL))
+	{
+		GError *error= NULL;
+
+		setptr(filename, g_build_filename(app->datadir, "ui_editor_menu.xml", NULL));
+		if (! gtk_ui_manager_add_ui_from_file(uim, filename, &error))
+		{
+			geany_debug("UI creation failed: %s", error->message);
+			g_error_free(error);
+			/** TODO at this point Geany crashes because of troubles in
+			 * tools_create_insert_custom_command_menu_items() */
+		}
+	}
+	g_free(filename);
+}
+
+
+void ui_manager_finalize(void)
+{
+    g_object_unref(ui_manager.uim);
+    g_object_unref(ui_manager.group);
+}


Property changes on: branches/dynamic-editor-menu/src/ui_manager.c
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Added: branches/dynamic-editor-menu/src/ui_manager.h
===================================================================
--- branches/dynamic-editor-menu/src/ui_manager.h	                        (rev 0)
+++ branches/dynamic-editor-menu/src/ui_manager.h	2008-07-22 16:54:02 UTC (rev 2802)
@@ -0,0 +1,46 @@
+/*
+ *      ui_manager.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Id$
+ */
+
+#ifndef GEANY_UI_MANAGER_H
+#define GEANY_UI_MANAGER_H 1
+
+typedef struct UIManager
+{
+	GtkUIManager *uim;
+	GtkActionGroup *group;
+}
+UIManager;
+
+extern UIManager ui_manager;
+
+
+
+void ui_manager_init(void);
+
+void ui_manager_finalize(void);
+
+GtkWidget *ui_manager_get_edit_menu(void);
+
+GtkAction *ui_manager_get_action(const gchar *name);
+
+#endif


Property changes on: branches/dynamic-editor-menu/src/ui_manager.h
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Modified: branches/dynamic-editor-menu/src/ui_utils.c
===================================================================
--- branches/dynamic-editor-menu/src/ui_utils.c	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/src/ui_utils.c	2008-07-22 16:54:02 UTC (rev 2802)
@@ -30,6 +30,7 @@
 #include <string.h>
 
 #include "ui_utils.h"
+#include "ui_manager.h"
 #include "prefs.h"
 #include "sciwrappers.h"
 #include "document.h"
@@ -60,12 +61,13 @@
 {
 	/* pointers to widgets only sensitive when there is at least one document */
 	GPtrArray	*document_buttons;
-	GtkWidget	*menu_insert_include_items[2];
-	GtkWidget	*current_word_item;
-	GtkWidget	*popup_copy_items[3];
+	gpointer	 menu_insert_include_items[2]; /* contains GtkWidgets and GtkActions */
+	GtkAction	*current_word_items[5];
+	GtkAction	*popup_copy_items[3];
 	GtkWidget	*menu_copy_items[3];
-	GtkWidget	*redo_items[3];
-	GtkWidget	*undo_items[3];
+	GtkWidget	*redo_items[2];
+	GtkWidget	*undo_items[2];
+	GtkAction	*popup_undo_items[2];
 	GtkWidget	*save_buttons[4];
 }
 widgets;
@@ -73,9 +75,7 @@
 
 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);
 
 
 /* allow_override is TRUE if text can be ignored when another message has been set
@@ -309,14 +309,15 @@
 		enable_redo = document_can_redo(doc);
 	}
 
-	/* index 0 is the popup menu, 1 is the menubar, 2 is the toolbar */
+	/* index 0 is the menubar, 1 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);
+
+	gtk_action_set_sensitive(widgets.popup_undo_items[0], enable_undo);
+	gtk_action_set_sensitive(widgets.popup_undo_items[1], enable_redo);
 }
 
 
@@ -331,13 +332,16 @@
 		enable = sci_can_copy(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);
+		gtk_action_set_sensitive(widgets.popup_copy_items[i], enable);
 }
 
 
 void ui_update_popup_goto_items(gboolean enable)
 {
-	gtk_widget_set_sensitive(widgets.current_word_item, enable);
+	guint i;
+
+	for (i = 0; i < G_N_ELEMENTS(widgets.current_word_items); i++)
+		gtk_action_set_sensitive(widgets.current_word_items[i], enable);
 }
 
 
@@ -376,7 +380,10 @@
 	{
 		enable = TRUE;
 	}
-	gtk_widget_set_sensitive(widgets.menu_insert_include_items[item], enable);
+	if (item == UI_INSERT_INCLUDE_ITEM_POPUP)
+		gtk_action_set_sensitive(GTK_ACTION(widgets.menu_insert_include_items[item]), enable);
+	else
+		gtk_widget_set_sensitive(GTK_WIDGET(widgets.menu_insert_include_items[item]), enable);
 }
 
 
@@ -425,7 +432,8 @@
 void ui_create_insert_menu_items(void)
 {
 	GtkMenu *menu_edit = GTK_MENU(lookup_widget(main_widgets.window, "insert_include2_menu"));
-	GtkMenu *menu_popup = GTK_MENU(lookup_widget(main_widgets.editor_menu, "insert_include1_menu"));
+	GtkMenu *menu_popup = GTK_MENU(gtk_menu_item_get_submenu(
+		GTK_MENU_ITEM(gtk_ui_manager_get_widget(ui_manager.uim, "/EditorMenu/InsertIncludes"))));
 	GtkWidget *blank;
 	const gchar *c_includes_stdlib[] = {
 		"assert.h", "ctype.h", "errno.h", "float.h", "limits.h", "locale.h", "math.h", "setjmp.h",
@@ -470,6 +478,8 @@
 	insert_include_items(menu_edit, menu_popup, (gchar**) c_includes_cpp, _("C++ (C Standard Library)"));
 	insert_include_items(menu_edit, menu_popup, (gchar**) c_includes_cppstdlib, _("C++ Standard Library"));
 	insert_include_items(menu_edit, menu_popup, (gchar**) c_includes_stl, _("C++ STL"));
+
+	gtk_widget_hide(gtk_ui_manager_get_widget(ui_manager.uim, "/EditorMenu/InsertIncludes/DummyInclude"));
 }
 
 
@@ -492,7 +502,8 @@
 void ui_create_insert_date_menu_items(void)
 {
 	GtkMenu *menu_edit = GTK_MENU(lookup_widget(main_widgets.window, "insert_date1_menu"));
-	GtkMenu *menu_popup = GTK_MENU(lookup_widget(main_widgets.editor_menu, "insert_date2_menu"));
+	GtkMenu *menu_popup = GTK_MENU(gtk_menu_item_get_submenu(
+		GTK_MENU_ITEM(gtk_ui_manager_get_widget(ui_manager.uim, "/EditorMenu/InsertDate"))));
 	GtkWidget *item;
 	gchar *str;
 
@@ -534,6 +545,8 @@
 		"insert_date_custom2", gtk_widget_ref(item), (GDestroyNotify)gtk_widget_unref);
 
 	insert_date_items(menu_edit, menu_popup, _("_Set Custom Date Format"));
+
+	gtk_widget_hide(gtk_ui_manager_get_widget(ui_manager.uim, "/EditorMenu/InsertDate/DummyDate"));
 }
 
 
@@ -1460,25 +1473,29 @@
 	ui_widgets.statusbar = lookup_widget(main_widgets.window, "statusbar");
 	ui_widgets.print_page_setup = lookup_widget(main_widgets.window, "page_setup1");
 
-	widgets.current_word_item = lookup_widget(main_widgets.editor_menu, "current_word1");
-	widgets.popup_copy_items[0] = lookup_widget(main_widgets.editor_menu, "cut1");
-	widgets.popup_copy_items[1] = lookup_widget(main_widgets.editor_menu, "copy1");
-	widgets.popup_copy_items[2] = lookup_widget(main_widgets.editor_menu, "delete1");
+	widgets.current_word_items[0] = ui_manager_get_action("FindUsage");
+	widgets.current_word_items[1] = ui_manager_get_action("FindDocumentUsage");
+	widgets.current_word_items[2] = ui_manager_get_action("GotoTagDefinition");
+	widgets.current_word_items[3] = ui_manager_get_action("GotoTagDeclaration");
+	widgets.current_word_items[4] = ui_manager_get_action("ContextAction");
+	widgets.popup_copy_items[0] = ui_manager_get_action("Copy");
+	widgets.popup_copy_items[1] = ui_manager_get_action("Cut");
+	widgets.popup_copy_items[2] = ui_manager_get_action("Delete");
 	widgets.menu_copy_items[0] = lookup_widget(main_widgets.window, "menu_cut1");
 	widgets.menu_copy_items[1] = lookup_widget(main_widgets.window, "menu_copy1");
 	widgets.menu_copy_items[2] = lookup_widget(main_widgets.window, "menu_delete1");
-	widgets.menu_insert_include_items[0] = lookup_widget(main_widgets.editor_menu, "insert_include1");
+	widgets.menu_insert_include_items[0] = ui_manager_get_action("InsertIncludes");
 	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, "toolbutton10");
 	widgets.save_buttons[2] = lookup_widget(main_widgets.window, "menu_save_all1");
 	widgets.save_buttons[3] = lookup_widget(main_widgets.window, "toolbutton22");
-	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.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.redo_items[0] = lookup_widget(main_widgets.window, "menu_redo2");
+	widgets.redo_items[1] = lookup_widget(main_widgets.window, "toolbutton_redo");
+	widgets.undo_items[0] = lookup_widget(main_widgets.window, "menu_undo2");
+	widgets.undo_items[1] = lookup_widget(main_widgets.window, "toolbutton_undo");
+	widgets.popup_undo_items[0] = ui_manager_get_action("Undo");
+	widgets.popup_undo_items[1] = ui_manager_get_action("Redo");
 
 	init_document_widgets();
 }

Modified: branches/dynamic-editor-menu/src/ui_utils.h
===================================================================
--- branches/dynamic-editor-menu/src/ui_utils.h	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/src/ui_utils.h	2008-07-22 16:54:02 UTC (rev 2802)
@@ -124,6 +124,11 @@
 
 extern UIWidgets ui_widgets;
 
+enum
+{
+	UI_INSERT_INCLUDE_ITEM_POPUP = 0,
+	UI_INSERT_INCLUDE_ITEM_MENU
+};
 
 /* The following block of functions are more generic functions and closely related to
  * certain GTK+ widgets. */

Modified: branches/dynamic-editor-menu/wscript
===================================================================
--- branches/dynamic-editor-menu/wscript	2008-07-22 16:38:45 UTC (rev 2801)
+++ branches/dynamic-editor-menu/wscript	2008-07-22 16:54:02 UTC (rev 2802)
@@ -89,7 +89,8 @@
     'src/keyfile.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/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/tools.c', 'src/treeviews.c', 'src/ui_utils.c', 'src/ui_manager.c',
+    'src/utils.c' ]
 
 
 
@@ -386,6 +387,7 @@
     bld.install_files('DATADIR', 'geany', 'data/filetype*')
     bld.install_files('DATADIR', 'geany', 'data/*.tags')
     bld.install_files('DATADIR', 'geany', 'data/snippets.conf')
+    bld.install_files('DATADIR', 'geany', 'data/ui_editor_menu.xml')
     bld.install_as('DATADIR', 'geany/GPL-2', 'COPYING')
     # Icons
     bld.install_files('DATADIR', 'pixmaps', 'pixmaps/geany.png')


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list