[gedit] Search also in submenus



commit 3bc1cba2cd5a8782071d4adb56d235ec355aa338
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri Mar 28 23:17:12 2014 +0100

    Search also in submenus
    
    We check recursively in the sections that do not have an id
    and that they contain submenus

 gedit/gedit-app.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index d23fb5f..ed08a75 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -1523,6 +1523,26 @@ find_extension_point_section (GMenuModel  *model,
                {
                        section = g_menu_model_get_item_link (model, i, G_MENU_LINK_SECTION);
                }
+               /* unamed sections are to be checked recursively */
+               else if (id == NULL)
+               {
+                       GMenuModel *subsection;
+                       GMenuModel *submenu;
+                       gint j, j_items;
+
+                       subsection = g_menu_model_get_item_link (model, i, G_MENU_LINK_SECTION);
+
+                       j_items = g_menu_model_get_n_items (subsection);
+
+                       for (j = 0; j < j_items && !section; j++)
+                       {
+                               submenu = g_menu_model_get_item_link (subsection, j, G_MENU_LINK_SUBMENU);
+                               if (submenu)
+                               {
+                                       section = find_extension_point_section (submenu, extension_point);
+                               }
+                       }
+               }
 
                g_free (id);
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]