[recipes] Hide the import menuitem if import is not available



commit a0554be04f8db9f0342e792c8f7b21bccdc8e090
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Dec 29 13:20:32 2016 -0500

    Hide the import menuitem if import is not available
    
    Same reason as for export.

 src/gr-app.c |   10 ++++++++++
 src/menus.ui |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/gr-app.c b/src/gr-app.c
index 1b9d507..23f753d 100644
--- a/src/gr-app.c
+++ b/src/gr-app.c
@@ -299,6 +299,16 @@ gr_app_startup (GApplication *app)
         g_action_map_add_action_entries (G_ACTION_MAP (app),
                                          app_entries, G_N_ELEMENTS (app_entries),
                                          app);
+
+#ifndef ENABLE_AUTOAR
+        {
+                GAction *action;
+
+                action = g_action_map_lookup_action (G_ACTION_MAP (app), "import");
+                g_object_set (action, "enabled", FALSE, NULL);
+        }
+#endif
+
         gtk_application_set_accels_for_action (GTK_APPLICATION (app),
                                                "app.quit",
                                                quit_accels);
diff --git a/src/menus.ui b/src/menus.ui
index f09ff72..b86ff8b 100644
--- a/src/menus.ui
+++ b/src/menus.ui
@@ -6,6 +6,7 @@
       <item>
         <attribute name="label" translatable="yes">_Import</attribute>
         <attribute name="action">app.import</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
       </item>
       <item>
         <attribute name="label" translatable="yes">_Preferences</attribute>


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