FMAIContext

FMAIContext — The Contextual Interface

Functions

Types and Values

Includes

#include <filemanager-actions/fma-icontext.h>

Description

This interface is implemented by all FMAObject -derived objects whose the display in the file manager context menu is subject to some conditions.

Implementors, typically FMAObjectAction, FMAObjectProfile and FMAObjectMenu, host the required data as FMADataBoxed in a dedicated FMA_FACTORY_CONDITIONS_GROUP data group.

Functions

FMA_ICONTEXT_GET_INTERFACE()

#define FMA_ICONTEXT_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), FMA_TYPE_ICONTEXT, FMAIContextInterface ))

fma_icontext_are_equal ()

gboolean
fma_icontext_are_equal (const FMAIContext *a,
                        const FMAIContext *b);

Parameters

a

the (original) FMAIContext context.

 

b

the (duplicated) FMAIContext context to be checked.

 

Returns

TRUE if this a and b are equal, FALSE else.

Since: 3.1


fma_icontext_check_mimetypes ()

void
fma_icontext_check_mimetypes (const FMAIContext *context);

Check the current list of mimetypes to see if it covers all mimetypes, or all regular files, or something else.

Parameters

context

the FMAIContext object to be checked.

 

Since: 2.30


fma_icontext_copy ()

void
fma_icontext_copy (FMAIContext *context,
                   const FMAIContext *source);

Copy specific data from source to context .

Parameters

context

the target FMAIContext context.

 

source

the source FMAIContext context.

 

Since: 3.1


fma_icontext_is_candidate ()

gboolean
fma_icontext_is_candidate (const FMAIContext *context,
                           guint target,
                           GList *selection);

Determines if the given object may be candidate to be displayed in the file manager context menu, depending of the list of currently selected items.

This function is called by build_nautilus_menus plugin function for each item found in FMAPivot items list, and, when this an action, for each profile of this action.

Parameters

context

a FMAIContext to be checked.

 

target

the current target.

 

selection

the currently selected items, as a GList of FMASelectedInfo items.

 

Returns

TRUE if this context succeeds to all tests and is so a valid candidate to be displayed in the file manager context menu, FALSE else.

Since: 2.30


fma_icontext_is_valid ()

gboolean
fma_icontext_is_valid (const FMAIContext *context);

Parameters

context

the FMAIContext to be checked.

 

Returns

TRUE if this context is valid, FALSE else.

This function is part of FMAIDuplicable::check_status and is called by FMAIDuplicable objects which also implement FMAIContext interface. It so doesn't make sense of asking the object for its validity status as it has already been checked before calling the function.

Since: 2.30


fma_icontext_read_done ()

void
fma_icontext_read_done (FMAIContext *context);

Prepares the specified FMAIContext just after it has been read.

  • This setup an internal flag when mimetypes is like 'all/all' in order to optimize computation time;

Parameters

context

the FMAIContext to be prepared.

 

Since: 2.30


fma_icontext_set_scheme ()

void
fma_icontext_set_scheme (FMAIContext *context,
                         const gchar *scheme,
                         gboolean selected);

Sets the status of a scheme relative to this context .

Parameters

context

the FMAIContext to be updated.

 

scheme

name of the scheme.

 

selected

whether this scheme is candidate to this context .

 

Since: 2.30


fma_icontext_set_only_desktop ()

void
fma_icontext_set_only_desktop (FMAIContext *context,
                               const gchar *desktop,
                               gboolean selected);

Sets the status of the desktop relative to this context for the NotShowIn list.

Parameters

context

the FMAIContext to be updated.

 

desktop

name of the desktop environment.

 

selected

whether this desktop is candidate to this context .

 

Since: 2.30


fma_icontext_set_not_desktop ()

void
fma_icontext_set_not_desktop (FMAIContext *context,
                              const gchar *desktop,
                              gboolean selected);

fma_icontext_replace_folder ()

void
fma_icontext_replace_folder (FMAIContext *context,
                             const gchar *old,
                             const gchar *new);

Replaces the old URI by the new one.

Parameters

context

the FMAIContext to be updated.

 

old

the old uri.

 

new

the new uri.

 

Since: 2.30

Types and Values

FMA_TYPE_ICONTEXT

#define FMA_TYPE_ICONTEXT                      ( fma_icontext_get_type())

FMAIContext

typedef struct _FMAIContext FMAIContext;

FMAIContextInterfacePrivate

typedef struct _FMAIContextInterfacePrivate FMAIContextInterfacePrivate;

FMAIContextInterface

typedef struct {
	/**
	 * is_candidate:
	 * @object: this FMAIContext object.
	 * @target: the initial target which triggered this function's stack.
	 *  This target is defined in fma-object-item.h.
	 * @selection: the current selection as a GList of FileManagerFileInfo
	 *  (see fma-fm-defines.h for these definitions).
	 *
	 * The FMAIContext implementor may take advantage of this
	 * virtual function to check for its own specific data. Only if the
	 * implementor does return %TRUE (or just doesn't implement this
	 * virtual), the conditions themselves will be checked.
	 *
	 * Returns: %TRUE if the @object may be a potential candidate, %FALSE
	 * else.
	 *
	 * Since: 2.30
	 */
	gboolean ( *is_candidate )( FMAIContext *object, guint target, GList *selection );
} FMAIContextInterface;

This interface manages all conditions relevant to a displayable status in the file manager.

Members

is_candidate ()

determines if the given FMAObject-derived object is candidate to display in the file manager.