[glib/wip/gapplication: 4/5] application: Add get_action_enabled()



commit 654c84a3d888a3cbf1e6c835a84f8e2957d13f13
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Tue May 18 10:03:53 2010 +0100

    application: Add get_action_enabled()
    
    Since we have a setter for enabling an action we should also
    have the respective getter.

 gio/gapplication.c |   19 +++++++++++++++++--
 gio/gapplication.h |    2 ++
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index 7879e0e..57665a0 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -278,9 +278,9 @@ g_application_set_action_enabled (GApplication *app,
 
   g_return_if_fail (G_IS_APPLICATION (app));
   g_return_if_fail (name != NULL);
-  
+
   enabled = !!enabled;
-  
+
   action = g_hash_table_lookup (app->priv->actions, name);
   g_return_if_fail (action != NULL);
   if (action->enabled == enabled)
@@ -291,6 +291,21 @@ g_application_set_action_enabled (GApplication *app,
   queue_actions_change_notification (app);
 }
 
+gboolean
+g_application_get_action_enabled (GApplication *app,
+                                  const char   *name)
+{
+  GApplicationAction *action;
+
+  g_return_val_if_fail (G_IS_APPLICATION (app), FALSE);
+  g_return_val_if_fail (name != NULL, FALSE);
+
+  action = g_hash_table_lookup (app->priv->actions, name);
+  g_return_val_if_fail (action != NULL, FALSE);
+
+  return action->enabled;
+}
+
 /**
  * g_application_run:
  * @app: a #GApplication
diff --git a/gio/gapplication.h b/gio/gapplication.h
index bd7a98c..8213c73 100644
--- a/gio/gapplication.h
+++ b/gio/gapplication.h
@@ -143,6 +143,8 @@ void                    g_application_add_action                (GApplication
 void                    g_application_set_action_enabled        (GApplication      *app,
                                                                  const char        *name,
                                                                  gboolean           enabled);
+gboolean                g_application_get_action_enabled        (GApplication      *app,
+                                                                 const char        *name);
 void                    g_application_invoke_action             (GApplication      *app,
                                                                  const char        *name,
                                                                  guint              timestamp);



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