| Easy Publish and Consume Reference Manual | ||||
|---|---|---|---|---|
#include <libepc/shell.h> #define EPC_DEBUG_LEVEL (level)guint epc_shell_get_debug_level (void); EpcShellProgressHooks;void epc_shell_progress_begin (constgchar *title, constgchar *message);void epc_shell_progress_end (void);void epc_shell_progress_update (gdouble percentage, constgchar *message);void epc_shell_set_progress_hooks (const EpcShellProgressHooks *hooks,gpointer user_data,GDestroyNotify destroy_data); #define EPC_AVAHI_ERRORguint epc_shell_watch_avahi_client_state (AvahiClientCallback callback,gpointer user_data,GDestroyNotify destroy_data,GError **error);AvahiEntryGroup * epc_shell_create_avahi_entry_group (AvahiEntryGroupCallback callback,gpointer user_data);AvahiServiceBrowser * epc_shell_create_service_browser (AvahiIfIndex interface,AvahiProtocol protocol, constgchar *type, constgchar *domain,AvahiLookupFlags flags,AvahiServiceBrowserCallback callback,gpointer user_data,GError **error);void epc_shell_restart_avahi_client (constgchar *strloc); constgchar * epc_shell_get_host_name (GError **error);void epc_shell_watch_remove (guint id);
#define EPC_DEBUG_LEVEL(level) G_UNLIKELY(epc_shell_get_debug_level () >= (level))
Checks if the library's debug level, which can be modified by setting the
EPC_DEBUG environment variable, is above the value
sepecified by level.
level : |
the minimum level to check for |
guint epc_shell_get_debug_level (void);
Query the library's debug level. The debug level can be modified by setting
the external EPC_DEBUG environment variable. In most
cases the EPC_DEBUG_LEVEL macro should be used, instead of calling this
checking the return value of this function.
| Returns : | The library's current debugging level. |
typedef struct {
void (*begin) (const gchar *title,
gpointer user_data);
void (*update) (gdouble percentage,
const gchar *message,
gpointer user_data);
void (*end) (gpointer user_data);
} EpcShellProgressHooks;
This table is used by epc_shell_set_progress_hooks to install functions allowing the library to provide feedback during processing.
See also: epc_progress_window_install
begin () |
the function called by epc_shell_progress_begin |
update () |
the function called by epc_shell_progress_update |
end () |
the function called by epc_shell_progress_end |
void epc_shell_progress_begin (constgchar *title, constgchar *message);
Call this function before starting a lengthy operation to allow the application tp provide some visual feedback during the operation, and to generally keep its UI responsive.
This function calls your title
as argument and message.
See also: epc_shell_set_progress_hooks(), epc_progress_window_install,
epc_shell_progress_update(), epc_shell_progress_end
title : |
the title of the lengthy operation |
message : |
description of the lengthy operation |
void epc_shell_progress_end (void);
Call this function when your lengthy operation has finished.
See also: epc_shell_set_progress_hooks(), epc_progress_window_install,
epc_shell_progress_begin(), epc_shell_progress_update
void epc_shell_progress_update (gdouble percentage, constgchar *message);
Called this function to inform about progress of a lengthy operation.
The progress is expressed as percentage in the range [0..1], or -1 if the
progress cannot be estimated.
See also: epc_shell_set_progress_hooks(), epc_progress_window_install,
epc_shell_progress_begin, epc_shell_progress_end()
percentage : |
current progress of the operation, or -1 |
message : |
a description of the current progress |
void epc_shell_set_progress_hooks (const EpcShellProgressHooks *hooks,gpointer user_data,GDestroyNotify destroy_data);
Installs functions which are called during processing, such as generating
server keys. This allows the application to indicate progress and generally
keep its UI responsive. If no progress callbacks are provided,
or when NULLhooks, progress messages are written to the
console.
See also:
hooks : |
the function table to install, or NULL |
user_data : |
custom data which shall be passed to the start hook |
destroy_data : |
function to call on user_data when the hooks are replaced
|
#define EPC_AVAHI_ERROR (epc_avahi_error_quark ())
Error domain for Avahi operations. Errors in this domain will be Avahi error codes. See GError for information on error domains.
guint epc_shell_watch_avahi_client_state (AvahiClientCallback callback,gpointer user_data,GDestroyNotify destroy_data,GError **error);
Registers a function to watch state changes of the library's epc_shell_watch_remove() to remove the watch. On failure it returns 0 and
sets error. The error domain is EPC_AVAHI_ERROR. Possible error codes are
those of the Avahi library.
Usually there is no need in handling the callback, as the callback dispatcher takes care already. This
state is dispatched mostly for notification purposes.
callback : |
a callback function |
user_data : |
data to pass to callback
|
destroy_data : |
a function for freeing user_data when removing the watch
|
error : |
return location for a NULL |
| Returns : | The identifier of the newly created watch, or 0 on error. |
AvahiEntryGroup * epc_shell_create_avahi_entry_group (AvahiEntryGroupCallback callback,gpointer user_data);
Creates a new NULL
callback : |
a callback function |
user_data : |
data to pass to callback
|
| Returns : | The newly created NULL |
AvahiServiceBrowser * epc_shell_create_service_browser (AvahiIfIndex interface,AvahiProtocol protocol, constgchar *type, constgchar *domain,AvahiLookupFlags flags,AvahiServiceBrowserCallback callback,gpointer user_data,GError **error);
Creates a new NULLerror is set. The error domain is EPC_AVAHI_ERROR.
Possible error codes are those of the Avahi library.
interface : |
the index of the network interface to watch |
protocol : |
the protocol of the services to watch |
type : |
the DNS-SD service type to watch |
domain : |
the DNS domain to watch, or NULL |
flags : |
flags for creating the service browser |
callback : |
a callback function |
user_data : |
data to pass to callback
|
error : |
return location for a NULL |
| Returns : | The newly created NULL |
void epc_shell_restart_avahi_client (constgchar *strloc);
Requests restart of the builtin Avahi client. Use this function to react on
critical failures (like strloc argument is used to prevent endless restart cycles.
Do not call this function to react on
strloc : |
code location of the callee ( |
constgchar * epc_shell_get_host_name (GError **error);
Retrieves the official host name of this machine. On failure the function
returns NULLerror. The error domain is EPC_AVAHI_ERROR.
Possible error codes are those of the Avahi library.
error : |
return location for a NULL |
| Returns : | The official host name, or NULL |