Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

misc.c File Reference

#include <hiker/bundlemgr.h>
#include <hiker/prv/bundlemgr_prv.h>
#include <hiker/ipc.h>
#include <hiker/notifymgr.h>
#include <pthread.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <sqlite3.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <unistd.h>
#include <hiker/global_settings.h>
#include "pm_traces.h"
#include "pm_globals.h"
#include "pm_ipc.h"
#include "pm_sql.h"
#include "pm_refimpl.h"

Data Structures

struct  xfer

Defines

#define _GNU_SOURCE

Functions

AlpBundle alp_bundle_me (void)
 Return a bundle index of the bundle containing the running code Returns a bundle index to the bundle which contains the code which invoked this function. Note that this function explicitly detects what routine it is being called from. Don't expect it to operate from a utility subroutine -- consider using a macro.
AlpBundle alp_bundle_locate_file (const char *file)
 Identify open bundle containing a file Given a POSIX file path, this will attempt to identify an open bundle which matches that path. The supplied path can be the root of a folder, or any file or folder name within that folder (existing or not).
AlpBundle alp_bundle_application (void)
 Return a bundle index of the running application Returns a bundle index to the bundle which contains the launched ALP application.
void alp_prv_bundle_set_application (AlpBundle index)
 Set the bundle index to return as the index of the running application.
void alp_prv_bundle_set_application_ref (AlpBundleRef ref)
 Set which bundle to return as the index of the running application.
AlpBundleRef alp_bundle_ref_application (void)
 Return a bundle ref to the running application Returns a bundle ref to the bundle which the running application was launched from.
AlpBundleRef alp_bundle_ref_me (void)
 Return a bundle ref to the running code Returns a bundle ref to the bundle which contains the code which invoked this function. Note that this function explicitly detects what routine it is being called from. Don't expect it to operate from a utility subroutine -- consider using a macro.
void alp_prv_package_clear_refs (void)
const char * alp_bundle_ref_gettextdomain (AlpBundleRef ref)
const char * alp_bundle_ref_name (AlpBundleRef ref)
gchar * alp_bundle_name (AlpBundle index)
gboolean do_idle (gpointer data)
void do_notify (gpointer data, gpointer userdata)
void * thread_func (void *param)
void destroy_notify_pool (void)
alp_status_t my_sync_notify (const char *appID, const char *notifyType, void *details, int length, int queue, int flags, int timeout, int *handled)
alp_status_t my_async_notify (const char *appID, const char *notifyType, void *details, int length, int queue, int flags)
alp_status_t set_error (alp_status_t status)
alp_status_t alp_bundle_error (void)
gchar * alp_bundle_saved_settings (AlpBundle index, const char *key)
gchar * alp_bundle_unsaved_settings (AlpBundle index, const char *key)
int safe_sql_fillin (char *str, const char *fillin)


Define Documentation

#define _GNU_SOURCE
 


Function Documentation

AlpBundle alp_bundle_application  ) 
 

Return a bundle index of the running application Returns a bundle index to the bundle which contains the launched ALP application.

Returns:
NULL bundle index if the code is not running from an ALP application, otherwise a valid bundle index.

alp_status_t alp_bundle_error void   ) 
 

Returns status of last failing alp_bundle routine.

Some Bundle Manager routines cannot return a detailed status value. Any Bundle Manager routine which fails (and returns and error value) will set an error status value which can be retrieved via this function.

Successfull operations do not clear this status -- it is only modified by failing functions. This function should not be used except immediately after a failing Bundle Manager routine.

Returns:
An alp_status_t value which won't be ALP_STATUS_OK

AlpBundle alp_bundle_locate_file const char *  filename  ) 
 

Identify open bundle containing a file Given a POSIX file path, this will attempt to identify an open bundle which matches that path. The supplied path can be the root of a folder, or any file or folder name within that folder (existing or not).

Parameters:
[in] filename 
Returns:
NULL bundle index if no appropriate bundle can be found.

AlpBundle alp_bundle_me  ) 
 

Return a bundle index of the bundle containing the running code Returns a bundle index to the bundle which contains the code which invoked this function. Note that this function explicitly detects what routine it is being called from. Don't expect it to operate from a utility subroutine -- consider using a macro.

This routine identifies the caller, and determines if that caller is in library loaded from a bundle. If the immediate caller is not in a bundle, NULL will be returned.

Note:
This routine is only specified to operate with shared libraries inside bundles. Operation when invoked from an executable is unpredictable.
Returns:
NULL bundle index if the code is not running from an identifable bundle, otherwise a bundle index.

gchar* alp_bundle_name AlpBundle  index  ) 
 

Given a bundle index, this will retrieve the bundle's name

Parameters:
[in] index Bundle index to retrieve text domain for
Returns:
An allocated gchar* of the bundle name. This value should be freed with g_free() when you are done with it.

AlpBundleRef alp_bundle_ref_application  ) 
 

Return a bundle ref to the running application Returns a bundle ref to the bundle which the running application was launched from.

Note:
. This routine will return the same AlpBundleRef for each invocation from the same instance of application. This AlpBundleRef will be effectively global, and should not be closed with alp_bundle_ref_close(). As such, it "leaks" and will not be closed until the application exits.
Returns:
NULL bundle ref if the code is not running from a launched application process, otherwise a bundle ref.

const char* alp_bundle_ref_gettextdomain AlpBundleRef  ref  ) 
 

Given a bundle ref, this will retrieve its domain for gettext

Some bundle types (ALP native bundles -- "bar") support gettext for localization. For these types of bundles, you can retrieve a text domain.

Parameters:
[in] ref Bundle reference to retrieve text domain for
Returns:
A char* of the appropriate textdomain, or NULL. This value is owned by bundle manager, and should not be freed, or used after the bundle reference is closed.

AlpBundleRef alp_bundle_ref_me  ) 
 

Return a bundle ref to the running code Returns a bundle ref to the bundle which contains the code which invoked this function. Note that this function explicitly detects what routine it is being called from. Don't expect it to operate from a utility subroutine -- consider using a macro.

This routine identifies the caller, and determines if that caller is in library loaded from a bundle. If the immediate caller is not in a bundle, NULL will be returned.

Note:
. This routine will return the same AlpBundleRef for each invocation from the same bundle. This AlpBundleRef will be effectively global, and should not be closed with alp_bundle_ref_close(). As such, it "leaks" and will not be closed until the application exits. For this reason, if you want fine control over the lifetime of the bundle containing code (likely for a plugin), then code in such bundles should not use alp_bundle_ref_me(), and instead use alp_bundle_me(), and explictly get an AlpBundleRef via alp_bundle_open() -- that will also be more efficient, as the invocation of either alp_bundle_me() or alp_bundle_ref_me() is somewhat expensive, and the result ought to be cached if possible.
Returns:
NULL bundle ref if the code is not running from an identifable bundle, otherwise a bundle ref.

const char* alp_bundle_ref_name AlpBundleRef  ref  ) 
 

Given a bundle ref, this will retrieve the bundle's name

Parameters:
[in] ref Bundle reference to retrieve name for
Returns:
A char* of the bundle name. This value is owned by bundle manager, and should not be freed, or used after the bundle reference is closed.

gchar* alp_bundle_saved_settings AlpBundle  index,
const char *  key
 

Given a bundle index, retrieve the matching saved global settings key

Saved settings are global settings specific to a bundle which survive even when the associated bundle is deleted. The settings are related to bundle name, so any bundles of the same name share the same saved global settings.

Parameters:
[in] index Bundle index to retrieve settings key for
[in] key Sub-key to use for specific settings. This may be empty or NULL, in which case the primary key for saved settings will be returned.
Returns:
An allocated gchar* of the appropriate global settings key. This value should be freed with g_free() when you are done with it.

gchar* alp_bundle_unsaved_settings AlpBundle  index,
const char *  key
 

Given a bundle index, retrieve the matching unsaved global settings key

Unsaved settings are global settings specific to a bundle which are deleted when the associated bundle is deleted. The settings are related to bundle name, so any bundles of the same name share the same unsaved global settings.

Parameters:
[in] index Bundle index to retrieve settings key for
[in] key Sub-key to use for specific settings. This may be empty or NULL, in which case the primary key for unsaved settings will be returned.
Returns:
An allocated gchar* of the appropriate global settings key. This value should be freed with g_free() when you are done with it.

void alp_prv_package_clear_refs void   ) 
 

void destroy_notify_pool void   ) 
 

gboolean do_idle gpointer  data  ) 
 

void do_notify gpointer  data,
gpointer  userdata
 

alp_status_t my_async_notify const char *  appID,
const char *  notifyType,
void *  details,
int  length,
int  queue,
int  flags
 

alp_status_t my_sync_notify const char *  appID,
const char *  notifyType,
void *  details,
int  length,
int  queue,
int  flags,
int  timeout,
int *  handled
 

int safe_sql_fillin char *  str,
const char *  fillin
 

alp_status_t set_error alp_status_t  status  ) 
 

void* thread_func void *  param  ) 
 


Generated on Sat Dec 16 20:29:48 2006 for hiker-0.9 by  doxygen 1.4.4