[Xfce4-commits] [apps/mousepad] 33/45: Re-organize the main menu a bit

noreply at xfce.org noreply at xfce.org
Fri Jul 11 13:03:38 CEST 2014


This is an automated email from the git hooks/post-receive script.

mbrush pushed a commit to branch master
in repository apps/mousepad.

commit 349b8477a5461ddb1d02ae36d741db17da9bfde3
Author: Matthew Brush <mbrush at codebrainz.ca>
Date:   Thu Jul 10 00:30:13 2014 -0700

    Re-organize the main menu a bit
    
    * Remove Text and Navigation main menus
    * Add Search main menu
    * Put items from Text item into Edit menu
    * Move Find-related items from Edit menu to search menu
    * Move Go To from Navigation menu to Search menu
    * Move Filetype item to top of Document menu instead of in own group
    * Move the Previous/Next tab items in to the Document menu
    * Move the dynamic open documents/tabs list items to Document menu
      - TODO: the document/tab list might be better as a GtkNotebook menu?
    * Update order of actions functions to match menu changes
---
 mousepad/mousepad-window-ui.xml |   55 ++--
 mousepad/mousepad-window.c      |  564 +++++++++++++++++++--------------------
 2 files changed, 306 insertions(+), 313 deletions(-)

diff --git a/mousepad/mousepad-window-ui.xml b/mousepad/mousepad-window-ui.xml
index 07a8d2f..eabfe38 100644
--- a/mousepad/mousepad-window-ui.xml
+++ b/mousepad/mousepad-window-ui.xml
@@ -58,26 +58,6 @@
       <menuitem action="select-all" />
       <menuitem action="change-selection" />
       <separator />
-      <menuitem action="find" />
-      <menuitem action="find-next" />
-      <menuitem action="find-previous" />
-      <menuitem action="replace" />
-      <separator />
-      <menuitem action="preferences" />
-    </menu>
-
-    <menu action="view-menu">
-      <menuitem action="font" />
-      <separator />
-      <menu action="color-scheme-menu">
-        <placeholder name="placeholder-color-scheme-items" />
-      </menu>
-      <menuitem action="line-numbers" />
-      <separator />
-      <menuitem action="statusbar" />
-    </menu>
-
-    <menu action="text-menu">
       <menu action="convert-menu">
         <menuitem action="lowercase" />
         <menuitem action="uppercase" />
@@ -95,14 +75,37 @@
         <menuitem action="line-up" />
         <menuitem action="line-down" />
       </menu>
-      <separator />
       <menuitem action="duplicate" />
-      <separator />
       <menuitem action="increase-indent" />
       <menuitem action="decrease-indent" />
+      <separator />
+      <menuitem action="preferences" />
+    </menu>
+
+    <menu action="search-menu">
+      <menuitem action="find" />
+      <menuitem action="find-next" />
+      <menuitem action="find-previous" />
+      <menuitem action="replace" />
+      <separator />
+      <menuitem action="go-to" />
+    </menu>
+
+    <menu action="view-menu">
+      <menuitem action="font" />
+      <separator />
+      <menu action="color-scheme-menu">
+        <placeholder name="placeholder-color-scheme-items" />
+      </menu>
+      <menuitem action="line-numbers" />
+      <separator />
+      <menuitem action="statusbar" />
     </menu>
 
     <menu action="document-menu">
+      <menu action="language-menu">
+        <placeholder name="placeholder-language-section-items" />
+      </menu>
       <menuitem action="auto-indent" />
       <menu action="eol-menu">
         <menuitem action="unix" />
@@ -118,18 +121,10 @@
       <separator />
       <menuitem action="write-bom" />
       <separator />
-      <menu action="language-menu">
-        <placeholder name="placeholder-language-section-items" />
-      </menu>
-    </menu>
-
-    <menu action="navigation-menu">
       <menuitem action="back" />
       <menuitem action="forward" />
       <separator />
       <placeholder name="placeholder-file-items" />
-      <separator />
-      <menuitem action="go-to" />
     </menu>
 
     <menu action="help-menu">
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 8e9df26..d9793e2 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -279,27 +279,8 @@ static void              mousepad_window_action_select_all            (GtkAction
                                                                        MousepadWindow         *window);
 static void              mousepad_window_action_change_selection      (GtkAction              *action,
                                                                        MousepadWindow         *window);
-static void              mousepad_window_action_find                  (GtkAction              *action,
-                                                                       MousepadWindow         *window);
-static void              mousepad_window_action_find_next             (GtkAction              *action,
-                                                                       MousepadWindow         *window);
-static void              mousepad_window_action_find_previous         (GtkAction              *action,
-                                                                       MousepadWindow         *window);
-static void              mousepad_window_action_replace_destroy       (MousepadWindow         *window);
-static void              mousepad_window_action_replace               (GtkAction              *action,
-                                                                       MousepadWindow         *window);
 static void              mousepad_window_action_preferences           (GtkAction              *action,
                                                                        MousepadWindow         *window);
-static void              mousepad_window_action_select_font           (GtkAction              *action,
-                                                                       MousepadWindow         *window);
-static void              mousepad_window_action_color_scheme          (GtkToggleAction        *action,
-                                                                       MousepadWindow         *window);
-static void              mousepad_window_action_line_numbers          (GtkToggleAction        *action,
-                                                                       MousepadWindow         *window);
-static void              mousepad_window_action_statusbar_overwrite   (MousepadWindow         *window,
-                                                                       gboolean                overwrite);
-static void              mousepad_window_action_statusbar             (GtkToggleAction        *action,
-                                                                       MousepadWindow         *window);
 static void              mousepad_window_action_lowercase             (GtkAction              *action,
                                                                        MousepadWindow         *window);
 static void              mousepad_window_action_uppercase             (GtkAction              *action,
@@ -326,6 +307,29 @@ static void              mousepad_window_action_increase_indent       (GtkAction
                                                                        MousepadWindow         *window);
 static void              mousepad_window_action_decrease_indent       (GtkAction              *action,
                                                                        MousepadWindow         *window);
+static void              mousepad_window_action_find                  (GtkAction              *action,
+                                                                       MousepadWindow         *window);
+static void              mousepad_window_action_find_next             (GtkAction              *action,
+                                                                       MousepadWindow         *window);
+static void              mousepad_window_action_find_previous         (GtkAction              *action,
+                                                                       MousepadWindow         *window);
+static void              mousepad_window_action_replace_destroy       (MousepadWindow         *window);
+static void              mousepad_window_action_replace               (GtkAction              *action,
+                                                                       MousepadWindow         *window);
+static void              mousepad_window_action_go_to_position        (GtkAction              *action,
+                                                                       MousepadWindow         *window);
+static void              mousepad_window_action_select_font           (GtkAction              *action,
+                                                                       MousepadWindow         *window);
+static void              mousepad_window_action_color_scheme          (GtkToggleAction        *action,
+                                                                       MousepadWindow         *window);
+static void              mousepad_window_action_line_numbers          (GtkToggleAction        *action,
+                                                                       MousepadWindow         *window);
+static void              mousepad_window_action_statusbar_overwrite   (MousepadWindow         *window,
+                                                                       gboolean                overwrite);
+static void              mousepad_window_action_statusbar             (GtkToggleAction        *action,
+                                                                       MousepadWindow         *window);
+static void              mousepad_window_action_language              (GtkToggleAction        *action,
+                                                                       MousepadWindow         *window);
 static void              mousepad_window_action_auto_indent           (GtkToggleAction        *action,
                                                                        MousepadWindow         *window);
 static void              mousepad_window_action_line_ending           (GtkRadioAction         *action,
@@ -333,22 +337,18 @@ static void              mousepad_window_action_line_ending           (GtkRadioA
                                                                        MousepadWindow         *window);
 static void              mousepad_window_action_tab_size              (GtkToggleAction        *action,
                                                                        MousepadWindow         *window);
+static void              mousepad_window_action_insert_spaces         (GtkToggleAction        *action,
+                                                                       MousepadWindow         *window);
 static void              mousepad_window_action_word_wrap             (GtkToggleAction        *action,
                                                                        MousepadWindow         *window);
 static void              mousepad_window_action_write_bom             (GtkToggleAction        *action,
                                                                        MousepadWindow         *window);
-static void              mousepad_window_action_language              (GtkToggleAction        *action,
-                                                                       MousepadWindow         *window);
-static void              mousepad_window_action_insert_spaces         (GtkToggleAction        *action,
-                                                                       MousepadWindow         *window);
 static void              mousepad_window_action_prev_tab              (GtkAction              *action,
                                                                        MousepadWindow         *window);
 static void              mousepad_window_action_next_tab              (GtkAction              *action,
                                                                        MousepadWindow         *window);
 static void              mousepad_window_action_go_to_tab             (GtkRadioAction         *action,
                                                                        GtkNotebook            *notebook);
-static void              mousepad_window_action_go_to_position        (GtkAction              *action,
-                                                                       MousepadWindow         *window);
 static void              mousepad_window_action_contents              (GtkAction              *action,
                                                                        MousepadWindow         *window);
 static void              mousepad_window_action_about                 (GtkAction              *action,
@@ -431,22 +431,11 @@ static const GtkActionEntry action_entries[] =
     { "delete", GTK_STOCK_DELETE, NULL, NULL, N_("Delete the current selection"), G_CALLBACK (mousepad_window_action_delete), },
     { "select-all", GTK_STOCK_SELECT_ALL, NULL, NULL, N_("Select the text in the entire document"), G_CALLBACK (mousepad_window_action_select_all), },
     { "change-selection", NULL, N_("Change the selection"), NULL, N_("Change a normal selection into a column selection and vice versa"), G_CALLBACK (mousepad_window_action_change_selection), },
-    { "find", GTK_STOCK_FIND, NULL, NULL, N_("Search for text"), G_CALLBACK (mousepad_window_action_find), },
-    { "find-next", NULL, N_("Find _Next"), "F3", N_("Search forwards for the same text"), G_CALLBACK (mousepad_window_action_find_next), },
-    { "find-previous", NULL, N_("Find _Previous"), "<shift>F3", N_("Search backwards for the same text"), G_CALLBACK (mousepad_window_action_find_previous), },
-    { "replace", GTK_STOCK_FIND_AND_REPLACE, N_("Find and Rep_lace..."), NULL, N_("Search for and replace text"), G_CALLBACK (mousepad_window_action_replace), },
-    { "preferences", GTK_STOCK_PREFERENCES, N_("Preferences"), NULL, N_("Show the preferences dialog"), G_CALLBACK (mousepad_window_action_preferences), },
-
-  { "view-menu", NULL, N_("_View"), NULL, NULL, NULL, },
-    { "font", GTK_STOCK_SELECT_FONT, N_("Select F_ont..."), NULL, N_("Change the editor font"), G_CALLBACK (mousepad_window_action_select_font), },
-    { "color-scheme-menu", NULL, N_("_Color Scheme"), NULL, NULL, NULL, },
-
-  { "text-menu", NULL, N_("_Text"), NULL, NULL, NULL, },
-    { "convert-menu", NULL, N_("_Convert"), NULL, NULL, NULL, },
-      { "uppercase", NULL, N_("to _Uppercase"), NULL, N_("Change the case of the selection to uppercase"), G_CALLBACK (mousepad_window_action_uppercase), },
-      { "lowercase", NULL, N_("to _Lowercase"), NULL, N_("Change the case of the selection to lowercase"), G_CALLBACK (mousepad_window_action_lowercase), },
-      { "titlecase", NULL, N_("to _Title Case"), NULL, N_("Change the case of the selection to title case"), G_CALLBACK (mousepad_window_action_titlecase), },
-      { "opposite-case", NULL, N_("to _Opposite Case"), NULL, N_("Change the case of the selection opposite case"), G_CALLBACK (mousepad_window_action_opposite_case), },
+    { "convert-menu", NULL, N_("Conve_rt"), NULL, NULL, NULL, },
+      { "uppercase", NULL, N_("To _Uppercase"), NULL, N_("Change the case of the selection to uppercase"), G_CALLBACK (mousepad_window_action_uppercase), },
+      { "lowercase", NULL, N_("To _Lowercase"), NULL, N_("Change the case of the selection to lowercase"), G_CALLBACK (mousepad_window_action_lowercase), },
+      { "titlecase", NULL, N_("To _Title Case"), NULL, N_("Change the case of the selection to title case"), G_CALLBACK (mousepad_window_action_titlecase), },
+      { "opposite-case", NULL, N_("To _Opposite Case"), NULL, N_("Change the case of the selection opposite case"), G_CALLBACK (mousepad_window_action_opposite_case), },
       { "tabs-to-spaces", NULL, N_("_Tabs to Spaces"), NULL, N_("Convert all tabs to spaces in the selection or document"), G_CALLBACK (mousepad_window_action_tabs_to_spaces), },
       { "spaces-to-tabs", NULL, N_("_Spaces to Tabs"), NULL, N_("Convert all the leading spaces to tabs in the selected line(s) or document"), G_CALLBACK (mousepad_window_action_spaces_to_tabs), },
       { "strip-trailing", NULL, N_("St_rip Trailing Spaces"), NULL, N_("Remove all the trailing spaces from the selected line(s) or document"), G_CALLBACK (mousepad_window_action_strip_trailing_spaces), },
@@ -454,19 +443,28 @@ static const GtkActionEntry action_entries[] =
     { "move-menu", NULL, N_("_Move Selection"), NULL, NULL, NULL, },
       { "line-up", NULL, N_("Line _Up"), NULL, N_("Move the selection one line up"), G_CALLBACK (mousepad_window_action_move_line_up), },
       { "line-down", NULL, N_("Line _Down"), NULL, N_("Move the selection one line down"), G_CALLBACK (mousepad_window_action_move_line_down), },
-    { "duplicate", NULL, N_("D_uplicate Line / Selection"), NULL, N_("Duplicate the current line or selection"), G_CALLBACK (mousepad_window_action_duplicate), },
+    { "duplicate", NULL, N_("Dup_licate Line / Selection"), NULL, N_("Duplicate the current line or selection"), G_CALLBACK (mousepad_window_action_duplicate), },
     { "increase-indent", GTK_STOCK_INDENT, N_("_Increase Indent"), NULL, N_("Increase the indentation of the selection or current line"), G_CALLBACK (mousepad_window_action_increase_indent), },
     { "decrease-indent", GTK_STOCK_UNINDENT, N_("_Decrease Indent"), NULL, N_("Decrease the indentation of the selection or current line"), G_CALLBACK (mousepad_window_action_decrease_indent), },
+    { "preferences", GTK_STOCK_PREFERENCES, N_("Preferences"), NULL, N_("Show the preferences dialog"), G_CALLBACK (mousepad_window_action_preferences), },
+
+  { "search-menu", NULL, N_("_Search"), NULL, NULL, NULL, },
+    { "find", GTK_STOCK_FIND, NULL, NULL, N_("Search for text"), G_CALLBACK (mousepad_window_action_find), },
+    { "find-next", NULL, N_("Find _Next"), "F3", N_("Search forwards for the same text"), G_CALLBACK (mousepad_window_action_find_next), },
+    { "find-previous", NULL, N_("Find _Previous"), "<shift>F3", N_("Search backwards for the same text"), G_CALLBACK (mousepad_window_action_find_previous), },
+    { "replace", GTK_STOCK_FIND_AND_REPLACE, N_("Find and Rep_lace..."), NULL, N_("Search for and replace text"), G_CALLBACK (mousepad_window_action_replace), },
+    { "go-to", GTK_STOCK_JUMP_TO, N_("_Go to..."), "<control>G", N_("Go to a specific location in the document"), G_CALLBACK (mousepad_window_action_go_to_position), },
+
+  { "view-menu", NULL, N_("_View"), NULL, NULL, NULL, },
+    { "font", GTK_STOCK_SELECT_FONT, N_("Select F_ont..."), NULL, N_("Change the editor font"), G_CALLBACK (mousepad_window_action_select_font), },
+    { "color-scheme-menu", NULL, N_("_Color Scheme"), NULL, NULL, NULL, },
 
   { "document-menu", NULL, N_("_Document"), NULL, NULL, NULL, },
     { "eol-menu", NULL, N_("Line E_nding"), NULL, NULL, NULL, },
     { "tab-size-menu", NULL, N_("Tab _Size"), NULL, NULL, NULL, },
     { "language-menu", NULL, N_("_Filetype"), NULL, NULL, NULL, },
-
-  { "navigation-menu", NULL, N_("_Navigation"), NULL, NULL, NULL, },
     { "back", GTK_STOCK_GO_BACK, N_("_Previous Tab"), "<control>Page_Up", N_("Select the previous tab"), G_CALLBACK (mousepad_window_action_prev_tab), },
     { "forward", GTK_STOCK_GO_FORWARD, N_("_Next Tab"), "<control>Page_Down", N_("Select the next tab"), G_CALLBACK (mousepad_window_action_next_tab), },
-    { "go-to", GTK_STOCK_JUMP_TO, N_("_Go to..."), "<control>G", N_("Go to a specific location in the document"), G_CALLBACK (mousepad_window_action_go_to_position), },
 
   { "help-menu", NULL, N_("_Help"), NULL, NULL, NULL },
     { "contents", GTK_STOCK_HELP, N_ ("_Contents"), "F1", N_("Display the Mousepad user manual"), G_CALLBACK (mousepad_window_action_contents), },
@@ -1575,7 +1573,7 @@ mousepad_window_notebook_removed (GtkNotebook     *notebook,
   g_signal_handlers_disconnect_by_func (G_OBJECT (document->textview), mousepad_window_menu_textview_popup, window);
 
   /* unset the go menu item (part of the old window) */
-  mousepad_object_set_data (G_OBJECT (page), "navigation-menu-action", NULL);
+  mousepad_object_set_data (G_OBJECT (page), "document-menu-action", NULL);
 
   /* get the number of pages in this notebook */
   npages = gtk_notebook_get_n_pages (notebook);
@@ -2343,7 +2341,7 @@ mousepad_window_update_actions (MousepadWindow *window)
       mousepad_window_can_redo (window, NULL, G_OBJECT (document->buffer));
 
       /* active this tab in the go menu */
-      action = mousepad_object_get_data (G_OBJECT (document), "navigation-menu-action");
+      action = mousepad_object_get_data (G_OBJECT (document), "document-menu-action");
       if (G_LIKELY (action != NULL))
         gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
 
@@ -2419,7 +2417,7 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
       g_signal_connect (G_OBJECT (radio_action), "activate", G_CALLBACK (mousepad_window_action_go_to_tab), window->notebook);
 
       /* connect the action to the document to we can easily active it when the user switched from tab */
-      mousepad_object_set_data (G_OBJECT (document), "navigation-menu-action", radio_action);
+      mousepad_object_set_data (G_OBJECT (document), "document-menu-action", radio_action);
 
       if (G_LIKELY (n < 9))
         {
@@ -2440,7 +2438,7 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
 
       /* add the action to the go menu */
       gtk_ui_manager_add_ui (window->ui_manager, window->gomenu_merge_id,
-                             "/main-menu/navigation-menu/placeholder-file-items",
+                             "/main-menu/document-menu/placeholder-file-items",
                              name, name, GTK_UI_MANAGER_MENUITEM, FALSE);
     }
 
@@ -4388,6 +4386,184 @@ mousepad_window_action_change_selection (GtkAction      *action,
 
 
 static void
+mousepad_window_action_preferences (GtkAction      *action,
+                                    MousepadWindow *window)
+{
+  mousepad_window_show_preferences (window);
+}
+
+
+
+static void
+mousepad_window_action_lowercase (GtkAction      *action,
+                                  MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* convert selection to lowercase */
+  mousepad_view_convert_selection_case (window->active->textview, LOWERCASE);
+}
+
+
+
+static void
+mousepad_window_action_uppercase (GtkAction      *action,
+                                  MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* convert selection to uppercase */
+  mousepad_view_convert_selection_case (window->active->textview, UPPERCASE);
+}
+
+
+
+static void
+mousepad_window_action_titlecase (GtkAction      *action,
+                                  MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* convert selection to titlecase */
+  mousepad_view_convert_selection_case (window->active->textview, TITLECASE);
+}
+
+
+
+static void
+mousepad_window_action_opposite_case (GtkAction      *action,
+                                      MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* convert selection to opposite case */
+  mousepad_view_convert_selection_case (window->active->textview, OPPOSITE_CASE);
+}
+
+
+
+static void
+mousepad_window_action_tabs_to_spaces (GtkAction      *action,
+                                       MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* convert tabs to spaces */
+  mousepad_view_convert_spaces_and_tabs (window->active->textview, TABS_TO_SPACES);
+}
+
+
+
+static void
+mousepad_window_action_spaces_to_tabs (GtkAction      *action,
+                                       MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* convert spaces to tabs */
+  mousepad_view_convert_spaces_and_tabs (window->active->textview, SPACES_TO_TABS);
+}
+
+
+
+static void
+mousepad_window_action_strip_trailing_spaces (GtkAction      *action,
+                                              MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* convert spaces to tabs */
+  mousepad_view_strip_trailing_spaces (window->active->textview);
+}
+
+
+
+static void
+mousepad_window_action_transpose (GtkAction      *action,
+                                  MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* transpose */
+  mousepad_view_transpose (window->active->textview);
+}
+
+
+
+static void
+mousepad_window_action_move_line_up (GtkAction      *action,
+                                     MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* move the selection on line up */
+  mousepad_view_move_selection (window->active->textview, MOVE_LINE_UP);
+}
+
+
+
+static void
+mousepad_window_action_move_line_down (GtkAction      *action,
+                                       MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* move the selection on line down */
+  mousepad_view_move_selection (window->active->textview, MOVE_LINE_DOWN);
+}
+
+
+
+static void
+mousepad_window_action_duplicate (GtkAction      *action,
+                                  MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* dupplicate */
+  mousepad_view_duplicate (window->active->textview);
+}
+
+
+
+static void
+mousepad_window_action_increase_indent (GtkAction      *action,
+                                        MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* increase the indent */
+  mousepad_view_indent (window->active->textview, INCREASE_INDENT);
+}
+
+
+
+static void
+mousepad_window_action_decrease_indent (GtkAction      *action,
+                                        MousepadWindow *window)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+
+  /* decrease the indent */
+  mousepad_view_indent (window->active->textview, DECREASE_INDENT);
+}
+
+
+
+static void
 mousepad_window_action_find (GtkAction      *action,
                              MousepadWindow *window)
 {
@@ -4499,10 +4675,19 @@ mousepad_window_action_replace (GtkAction      *action,
 
 
 static void
-mousepad_window_action_preferences (GtkAction      *action,
-                                    MousepadWindow *window)
+mousepad_window_action_go_to_position (GtkAction      *action,
+                                       MousepadWindow *window)
 {
-  mousepad_window_show_preferences (window);
+  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+  mousepad_return_if_fail (GTK_IS_TEXT_BUFFER (window->active->buffer));
+
+  /* run jump dialog */
+  if (mousepad_dialogs_go_to (GTK_WINDOW (window), window->active->buffer))
+    {
+      /* put the cursor on screen */
+      mousepad_view_scroll_to_cursor (window->active->textview);
+    }
 }
 
 
@@ -4640,170 +4825,37 @@ mousepad_window_action_statusbar (GtkToggleAction *action,
 
 
 static void
-mousepad_window_action_lowercase (GtkAction      *action,
-                                  MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-
-  /* convert selection to lowercase */
-  mousepad_view_convert_selection_case (window->active->textview, LOWERCASE);
-}
-
-
-
-static void
-mousepad_window_action_uppercase (GtkAction      *action,
-                                  MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-
-  /* convert selection to uppercase */
-  mousepad_view_convert_selection_case (window->active->textview, UPPERCASE);
-}
-
-
-
-static void
-mousepad_window_action_titlecase (GtkAction      *action,
-                                  MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-
-  /* convert selection to titlecase */
-  mousepad_view_convert_selection_case (window->active->textview, TITLECASE);
-}
-
-
-
-static void
-mousepad_window_action_opposite_case (GtkAction      *action,
-                                      MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-
-  /* convert selection to opposite case */
-  mousepad_view_convert_selection_case (window->active->textview, OPPOSITE_CASE);
-}
-
-
-
-static void
-mousepad_window_action_tabs_to_spaces (GtkAction      *action,
-                                       MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-
-  /* convert tabs to spaces */
-  mousepad_view_convert_spaces_and_tabs (window->active->textview, TABS_TO_SPACES);
-}
-
-
-
-static void
-mousepad_window_action_spaces_to_tabs (GtkAction      *action,
-                                       MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-
-  /* convert spaces to tabs */
-  mousepad_view_convert_spaces_and_tabs (window->active->textview, SPACES_TO_TABS);
-}
-
-
-
-static void
-mousepad_window_action_strip_trailing_spaces (GtkAction      *action,
-                                              MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-
-  /* convert spaces to tabs */
-  mousepad_view_strip_trailing_spaces (window->active->textview);
-}
-
-
-
-static void
-mousepad_window_action_transpose (GtkAction      *action,
-                                  MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-
-  /* transpose */
-  mousepad_view_transpose (window->active->textview);
-}
-
-
-
-static void
-mousepad_window_action_move_line_up (GtkAction      *action,
-                                     MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-
-  /* move the selection on line up */
-  mousepad_view_move_selection (window->active->textview, MOVE_LINE_UP);
-}
-
-
-
-static void
-mousepad_window_action_move_line_down (GtkAction      *action,
-                                       MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-
-  /* move the selection on line down */
-  mousepad_view_move_selection (window->active->textview, MOVE_LINE_DOWN);
-}
-
-
-
-static void
-mousepad_window_action_duplicate (GtkAction      *action,
-                                  MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-
-  /* dupplicate */
-  mousepad_view_duplicate (window->active->textview);
-}
-
-
-
-static void
-mousepad_window_action_increase_indent (GtkAction      *action,
-                                        MousepadWindow *window)
+mousepad_window_action_language (GtkToggleAction *action,
+                                 MousepadWindow  *window)
 {
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-
-  /* increase the indent */
-  mousepad_view_indent (window->active->textview, INCREASE_INDENT);
-}
+  guint                     lang_hash;
+  const gchar *const       *lang_id;
+  GtkSourceLanguage        *language;
+  GtkSourceLanguageManager *manager;
+  GtkSourceBuffer          *buffer;
 
+  lang_hash = (guint) gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
+  buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (window->active->textview)));
 
+  if (lang_hash == g_str_hash ("none"))
+    {
+      gtk_source_buffer_set_language (buffer, NULL);
+      return;
+    }
 
-static void
-mousepad_window_action_decrease_indent (GtkAction      *action,
-                                        MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
+  manager = gtk_source_language_manager_get_default ();
+  lang_id = gtk_source_language_manager_get_language_ids (manager);
 
-  /* decrease the indent */
-  mousepad_view_indent (window->active->textview, DECREASE_INDENT);
+  while (*lang_id)
+    {
+      if (g_str_hash (*lang_id) == lang_hash)
+        {
+          language = gtk_source_language_manager_get_language (manager, *lang_id);
+          gtk_source_buffer_set_language (buffer, language);
+          break;
+        }
+      lang_id++;
+    }
 }
 
 
@@ -4891,10 +4943,10 @@ mousepad_window_action_tab_size (GtkToggleAction *action,
 
 
 static void
-mousepad_window_action_word_wrap (GtkToggleAction *action,
-                                  MousepadWindow  *window)
+mousepad_window_action_insert_spaces (GtkToggleAction *action,
+                                      MousepadWindow  *window)
 {
-  gboolean active;
+  gboolean insert_spaces;
 
   mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
   mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
@@ -4903,17 +4955,17 @@ mousepad_window_action_word_wrap (GtkToggleAction *action,
   if (lock_menu_updates == 0)
     {
       /* get the current state */
-      active = gtk_toggle_action_get_active (action);
+      insert_spaces = gtk_toggle_action_get_active (action);
 
-      /* store this as the last used wrap mode */
-      MOUSEPAD_SETTING_SET_BOOLEAN (WORD_WRAP, active);
+      /* save as the last auto indent mode */
+      MOUSEPAD_SETTING_SET_BOOLEAN (INSERT_SPACES, insert_spaces);
     }
 }
 
 
 
 static void
-mousepad_window_action_write_bom (GtkToggleAction *action,
+mousepad_window_action_word_wrap (GtkToggleAction *action,
                                   MousepadWindow  *window)
 {
   gboolean active;
@@ -4927,57 +4979,18 @@ mousepad_window_action_write_bom (GtkToggleAction *action,
       /* get the current state */
       active = gtk_toggle_action_get_active (action);
 
-      /* set new value */
-      mousepad_file_set_write_bom (window->active->file, active);
-
-      /* make buffer as modified to show the user the change is not saved */
-      gtk_text_buffer_set_modified (window->active->buffer, TRUE);
-    }
-}
-
-
-
-static void
-mousepad_window_action_language (GtkToggleAction *action,
-                                 MousepadWindow  *window)
-{
-  guint                     lang_hash;
-  const gchar *const       *lang_id;
-  GtkSourceLanguage        *language;
-  GtkSourceLanguageManager *manager;
-  GtkSourceBuffer          *buffer;
-
-  lang_hash = (guint) gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
-  buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (window->active->textview)));
-
-  if (lang_hash == g_str_hash ("none"))
-    {
-      gtk_source_buffer_set_language (buffer, NULL);
-      return;
-    }
-
-  manager = gtk_source_language_manager_get_default ();
-  lang_id = gtk_source_language_manager_get_language_ids (manager);
-
-  while (*lang_id)
-    {
-      if (g_str_hash (*lang_id) == lang_hash)
-        {
-          language = gtk_source_language_manager_get_language (manager, *lang_id);
-          gtk_source_buffer_set_language (buffer, language);
-          break;
-        }
-      lang_id++;
+      /* store this as the last used wrap mode */
+      MOUSEPAD_SETTING_SET_BOOLEAN (WORD_WRAP, active);
     }
 }
 
 
 
 static void
-mousepad_window_action_insert_spaces (GtkToggleAction *action,
-                                      MousepadWindow  *window)
+mousepad_window_action_write_bom (GtkToggleAction *action,
+                                  MousepadWindow  *window)
 {
-  gboolean insert_spaces;
+  gboolean active;
 
   mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
   mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
@@ -4986,10 +4999,13 @@ mousepad_window_action_insert_spaces (GtkToggleAction *action,
   if (lock_menu_updates == 0)
     {
       /* get the current state */
-      insert_spaces = gtk_toggle_action_get_active (action);
+      active = gtk_toggle_action_get_active (action);
 
-      /* save as the last auto indent mode */
-      MOUSEPAD_SETTING_SET_BOOLEAN (INSERT_SPACES, insert_spaces);
+      /* set new value */
+      mousepad_file_set_write_bom (window->active->file, active);
+
+      /* make buffer as modified to show the user the change is not saved */
+      gtk_text_buffer_set_modified (window->active->buffer, TRUE);
     }
 }
 
@@ -5058,24 +5074,6 @@ mousepad_window_action_go_to_tab (GtkRadioAction *action,
 
 
 static void
-mousepad_window_action_go_to_position (GtkAction      *action,
-                                       MousepadWindow *window)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
-  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
-  mousepad_return_if_fail (GTK_IS_TEXT_BUFFER (window->active->buffer));
-
-  /* run jump dialog */
-  if (mousepad_dialogs_go_to (GTK_WINDOW (window), window->active->buffer))
-    {
-      /* put the cursor on screen */
-      mousepad_view_scroll_to_cursor (window->active->textview);
-    }
-}
-
-
-
-static void
 mousepad_window_action_contents (GtkAction      *action,
                                  MousepadWindow *window)
 {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list