[nautilus-actions] Define new nact_main_tab_get_context() function
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Define new nact_main_tab_get_context() function
- Date: Wed, 16 Jun 2010 22:06:35 +0000 (UTC)
commit e1c0813c3a5a9ddbeb64bf29ce23490415767e18
Author: Pierre Wieser <pwieser trychlos org>
Date: Tue Jun 15 23:54:09 2010 +0200
Define new nact_main_tab_get_context() function
ChangeLog | 4 ++++
src/nact/nact-main-tab.c | 34 ++++++++++++++++++++++++++++++++++
src/nact/nact-main-tab.h | 8 ++++++--
3 files changed, 44 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 65d383e..f9706f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2010-06-15 Pierre Wieser <pwieser trychlos org>
+ * src/nact/nact-main-tab.c:
+ * src/nact/nact-main-tab.h (nact_main_tab_get_context):
+ New function.
+
* src/nact/nact-iaction-tab.c:
* src/nact/nact-ibasenames-tab.c:
* src/nact/nact-icapabilities-tab.c:
diff --git a/src/nact/nact-main-tab.c b/src/nact/nact-main-tab.c
index 5d527d5..40e3eb0 100644
--- a/src/nact/nact-main-tab.c
+++ b/src/nact/nact-main-tab.c
@@ -83,3 +83,37 @@ nact_main_tab_is_page_enabled( NactMainWindow *window, gint num_page )
return( is_sensitive );
}
+
+/**
+ * nact_main_tab_get_context:
+ * @window: the #NactMainWindow.
+ * @editable: if not %NULL, will be set with the current editability
+ * status of the returned #NAIContext (or of its parent).
+ *
+ * Returns: the current relevant #NAIContext, or %NULL.
+ */
+NAIContext *
+nact_main_tab_get_context( NactMainWindow *window, gboolean *editable )
+{
+ NAObjectItem *item;
+ NAObjectProfile *profile;
+ NAIContext *context;
+ gboolean status;
+
+ g_return_val_if_fail( NACT_IS_MAIN_WINDOW( window ), NULL );
+
+ g_object_get(
+ G_OBJECT( window ),
+ TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
+ TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
+ TAB_UPDATABLE_PROP_EDITABLE, &status,
+ NULL );
+
+ context = profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item;
+
+ if( editable ){
+ *editable = status;
+ }
+
+ return( context );
+}
diff --git a/src/nact/nact-main-tab.h b/src/nact/nact-main-tab.h
index d21c207..fd47d7c 100644
--- a/src/nact/nact-main-tab.h
+++ b/src/nact/nact-main-tab.h
@@ -31,6 +31,8 @@
#ifndef __NACT_MAIN_TAB_H__
#define __NACT_MAIN_TAB_H__
+#include <api/na-icontext.h>
+
#include "nact-main-window.h"
/**
@@ -69,8 +71,10 @@ enum {
TAB_PROPERTIES
};
-void nact_main_tab_enable_page( NactMainWindow *window, gint page, gboolean enabled );
-gboolean nact_main_tab_is_page_enabled( NactMainWindow *window, gint page );
+void nact_main_tab_enable_page ( NactMainWindow *window, gint page, gboolean enabled );
+gboolean nact_main_tab_is_page_enabled( NactMainWindow *window, gint page );
+
+NAIContext *nact_main_tab_get_context ( NactMainWindow *window, gboolean *editable );
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]