[gedit/wip/menupopover: 2/2] Search also in submenus



commit 05d09cee78e2a322d5e401229becf0f27f91edbf
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 ed09fb0..ff58e2f 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -1527,6 +1527,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]