ctb/src/ipc.c File Reference

#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include <liberipc/eripc.h>
#include <liberipc/eripc_support.h>
#include <liberutils/er_error.h>
#include <libermetadb/ermetadb.h>
#include "ctb_log.h"
#include "ipc.h"
#include "menu.h"
Include dependency graph for ctb/src/ipc.c:

Go to the source code of this file.

Defines

#define DBUS_APPL_NAME   PACKAGE_NAME
#define DBUS_SERVICE   "com.irexnet." DBUS_APPL_NAME
#define DBUS_PATH   "/com/irexnet/" DBUS_APPL_NAME
#define DBUS_INTERFACE   "com.irexnet." DBUS_APPL_NAME
#define DBUS_SERVICE_SYSTEM_CONTROL   "com.irexnet.sysd"
#define DBUS_SERVICE_POPUP_MENU   "com.irexnet.popupmenu"
#define DBUS_SERVICE_SETTINGS   "com.irexnet.settings"

Functions

static void on_goto_location (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static void on_page_change (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static void on_filesystem_change (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static void on_window_activated (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static void on_window_deactivated (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static void on_menu_item (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static void on_mounted (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static void on_unmounted (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static void on_prepare_standby (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static void on_changed_locale (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static void on_changed_orientation (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static gboolean is_in_portrait_orientation ()
void ipc_init (quit_function quit_cb, locale_function set_locale_cb, mount_cb_t mount_cb, unmount_cb_t unmount_cb)
void ipc_sys_startup_complete ()
 Report "content browser started" to sysd.
gint ipc_sys_start_task (const gchar *cmd_line, const gchar *work_dir, const gchar *label, const gchar *thumbnail_path, gchar **err_message)
 Send message startTask to system control, usually to open a document in the relevant viewer application.
gboolean ipc_sys_stop_task (const gchar *cmd_line)
 Send message stopTask to system control, usually to close a documen that has previously been open using ipc_sys_start_task().
gint ipc_sys_open_url (const gchar *url, const gchar *label, const gchar *back_text, gchar **err_message)
 Send message openURL to system control, usually to open a web location in the browser application.
const device_caps_tipc_sys_get_device_capabilities ()
 Query system control for device capabilties.
gboolean ipc_menu_add_menu (const char *name, const char *group1, const char *group2, const char *group3)
 Send message addMenu to popup menu.
gboolean ipc_menu_add_group (const char *name, const char *parent, const char *image)
 Send message addGroup to popup menu.
gboolean ipc_menu_add_item (const char *name, const char *parent, const char *image)
 Send message addGroup to popup menu.
gboolean ipc_menu_set_menu_label (const char *name, const char *label)
 Send message setMenuLabel to popup menu.
gboolean ipc_menu_set_group_label (const char *name, const char *label)
 Send message setGroupLabel to popup menu.
gboolean ipc_menu_set_item_label (const char *name, const char *parent, const char *label)
 Send message setItemLabel to popup menu.
gboolean ipc_menu_show_menu (const char *name)
 Send message showMenu to popup menu.
gboolean ipc_menu_set_group_state (const char *name, const char *state)
 Send message setItemState to popup menu.
gboolean ipc_menu_set_item_state (const char *name, const char *parent, const char *state)
 Send message setItemState to popup menu.
gboolean ipc_menu_block (void)
gboolean ipc_menu_unblock (void)
void ipc_menu_updates_finished ()
void ipc_menu_set_pagecounter (int cur_page, int num_pages, gboolean boundary_check)
gboolean ipc_sys_busy (gboolean look_busy)
 Send message sysSetBusy to system daemon.
gboolean ipc_status_set_stylus (const char *state)
 Send message setStatusItemState(statusbar_stylus) to popup menu.
gboolean ipc_sys_is_in_portrait_mode ()
 Query sysd if device in portrait mode.
const gchar * ipc_get_media ()
 Get currently mounted storage media.
void storage_media_mounted (const gchar *mountpoint)
 Report that a storage media has been mounted.

Variables

static eripc_client_context_teripcClient = NULL
static quit_function g_quit_callback = NULL
static locale_function g_set_locale_callback = NULL
static gboolean g_in_portrait = TRUE
static gchar * g_storage_media = NULL
static mount_cb_t g_mount_cb = NULL
static unmount_cb_t g_unmount_cb = NULL
static eripc_callback_function_t service_functions []

Define Documentation

#define DBUS_APPL_NAME   PACKAGE_NAME

Copyright (C) 2008 iRex Technologies B.V. All rights reserved.

Definition at line 50 of file ctb/src/ipc.c.

#define DBUS_INTERFACE   "com.irexnet." DBUS_APPL_NAME

Definition at line 53 of file ctb/src/ipc.c.

#define DBUS_PATH   "/com/irexnet/" DBUS_APPL_NAME

Definition at line 52 of file ctb/src/ipc.c.

#define DBUS_SERVICE   "com.irexnet." DBUS_APPL_NAME

Definition at line 51 of file ctb/src/ipc.c.

#define DBUS_SERVICE_POPUP_MENU   "com.irexnet.popupmenu"
#define DBUS_SERVICE_SETTINGS   "com.irexnet.settings"

Definition at line 57 of file ctb/src/ipc.c.

#define DBUS_SERVICE_SYSTEM_CONTROL   "com.irexnet.sysd"

Function Documentation

const gchar* ipc_get_media (  ) 

Get currently mounted storage media.

---------------------------------------------------------------------------

Name : ipc_get_media

Returns:
gchar* of mount point of storage media or NULL if not mounted

--------------------------------------------------------------------------

Definition at line 583 of file ctb/src/ipc.c.

References g_storage_media.

Referenced by add_desktop_items(), create_shortcut_item(), filemodel_chdir(), get_last_modified(), is_dir_on_media(), and load_items_in_model().

00584 {
00585     return g_storage_media;
00586 }

Here is the caller graph for this function:

void ipc_init ( quit_function  quit_cb,
locale_function  set_locale_cb,
mount_cb_t  mount_cb,
unmount_cb_t  unmount_cb 
)

Definition at line 147 of file ctb/src/ipc.c.

References DBUS_APPL_NAME, DBUS_INTERFACE, DBUS_PATH, DBUS_SERVICE, eripc_client_context_new(), g_in_portrait, g_mount_cb, g_quit_callback, g_set_locale_callback, g_unmount_cb, and is_in_portrait_orientation().

Referenced by main().

00151 {
00152     g_quit_callback = quit_cb;
00153     g_set_locale_callback = set_locale_cb;
00154     g_mount_cb = mount_cb;
00155     g_unmount_cb = unmount_cb;
00156 
00157     eripcClient = eripc_client_context_new(
00158                     DBUS_APPL_NAME, 
00159                     "1.0",
00160                     DBUS_SERVICE, 
00161                     DBUS_PATH,
00162                     DBUS_INTERFACE,
00163                     service_functions);
00164     g_in_portrait = is_in_portrait_orientation();
00165 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean ipc_menu_add_group ( const char *  name,
const char *  parent,
const char *  image 
)

Send message addGroup to popup menu.

---------------------------------------------------------------------------

Name : ipc_menu_add_group

Parameters:
[in] name - name (mnemonic) of menu group
[in] parent - name (mnemonic) of the group this group belongs to, or NULL when this group is at the highest level
[in] image - icon bitmap file
Returns:
TRUE on success, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 242 of file ctb/src/ipc.c.

00245 {
00246     return eripc_menu_add_group(eripcClient, name, parent, image);
00247 }

gboolean ipc_menu_add_item ( const char *  name,
const char *  parent,
const char *  image 
)

Send message addGroup to popup menu.

---------------------------------------------------------------------------

Name : ipc_menu_add_item

Parameters:
[in] name - name (mnemonic) of menu item
[in] parent - name (mnemomic) of the menu group this item belongs to
[in] image - icon bitmap file
Returns:
TRUE on success, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 250 of file ctb/src/ipc.c.

00253 {
00254     return eripc_menu_add_item(eripcClient, name, parent, image);
00255 }

gboolean ipc_menu_add_menu ( const char *  name,
const char *  group1,
const char *  group2,
const char *  group3 
)

Send message addMenu to popup menu.

---------------------------------------------------------------------------

Name : ipc_menu_add_menu

Parameters:
[in] name - name (mnemonic) of the menu
[in] group1 .. group3 - name (mnemonic) of the menu groups
Returns:
TRUE on success, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 233 of file ctb/src/ipc.c.

00237 {
00238     return eripc_menu_add_menu(eripcClient, name, group1, group2, group3, "");
00239 }

gboolean ipc_menu_block ( void   ) 

Definition at line 301 of file ctb/src/ipc.c.

00302 {
00303     return eripc_sysd_set_menu_state(eripcClient, "block");
00304 }

gboolean ipc_menu_set_group_label ( const char *  name,
const char *  label 
)

Send message setGroupLabel to popup menu.

---------------------------------------------------------------------------

Name : ipc_menu_set_group_label

Parameters:
[in] name - name (mnemonic) of menu group
[in] label - on-screen text at the top of the menu group
Returns:
TRUE on success, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 265 of file ctb/src/ipc.c.

00267 {
00268     return eripc_menu_set_group_label(eripcClient, name, label);
00269 }

gboolean ipc_menu_set_group_state ( const char *  name,
const char *  state 
)

Send message setItemState to popup menu.

---------------------------------------------------------------------------

Name : ipc_menu_set_group_state

Parameters:
[in] name - name (mnemonic) of menu group to be set
[in] state - new state ("normal", "disabled")
Returns:
TRUE on success, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 286 of file ctb/src/ipc.c.

00288 {
00289     return eripc_menu_set_group_state(eripcClient, name, state);
00290 }

gboolean ipc_menu_set_item_label ( const char *  name,
const char *  parent,
const char *  label 
)

Send message setItemLabel to popup menu.

---------------------------------------------------------------------------

Name : ipc_menu_set_item_label

Parameters:
[in] name - name (mnemonic) of menu item
[in] parent - name (mnemomic) of the menu group this item belongs to
[in] label - on-screen text below icon
Returns:
TRUE on success, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 272 of file ctb/src/ipc.c.

00275 {
00276     return eripc_menu_set_item_label(eripcClient, name, parent, label);
00277 }

gboolean ipc_menu_set_item_state ( const char *  name,
const char *  parent,
const char *  state 
)

Send message setItemState to popup menu.

Set new menu item state.

---------------------------------------------------------------------------

Name : ipc_menu_set_item_state

Parameters:
[in] name - name (mnemonic) of menu item to be set
[in] parent - name (mnemomic) of the menu group this item belongs to
[in] state - new state ("normal", "selected", "disabled")
Returns:
TRUE on success, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 293 of file ctb/src/ipc.c.

00296 {
00297     return eripc_menu_set_item_state(eripcClient, name, parent, state);
00298 }

gboolean ipc_menu_set_menu_label ( const char *  name,
const char *  label 
)

Send message setMenuLabel to popup menu.

---------------------------------------------------------------------------

Name : ipc_menu_set_menu_label

Parameters:
[in] name - name (mnemonic) of the menu
[in] label - on-screen text at the top of the menu
Returns:
TRUE on success, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 258 of file ctb/src/ipc.c.

00260 {
00261     return eripc_menu_set_menu_label(eripcClient, name, label);
00262 }

void ipc_menu_set_pagecounter ( int  cur_page,
int  num_pages,
gboolean  boundary_check 
)

Definition at line 319 of file ctb/src/ipc.c.

References eripc_menu_set_pagecounter().

Referenced by filemodel_set_viewmode(), filemodel_update_pagecounter(), and update_numpages().

00320 {
00321     eripc_menu_set_pagecounter(eripcClient, cur_page, num_pages, boundary_check);
00322 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean ipc_menu_show_menu ( const char *  name  ) 

Send message showMenu to popup menu.

Set menu context.

---------------------------------------------------------------------------

Name : ipc_menu_show_menu

Parameters:
[in] name - name (mnemonic) of menu to be displayed
Returns:
TRUE on success, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 280 of file ctb/src/ipc.c.

00281 {
00282     return eripc_menu_show_menu(eripcClient, name);
00283 }

gboolean ipc_menu_unblock ( void   ) 

Definition at line 307 of file ctb/src/ipc.c.

00308 {
00309     return eripc_sysd_set_menu_state(eripcClient, "unblock");
00310 }

void ipc_menu_updates_finished (  ) 

Definition at line 313 of file ctb/src/ipc.c.

References eripc_client_context_t::context, DBUS_SERVICE_POPUP_MENU, ERIPC_BUS_SESSION, eripc_send_varargs(), and ERIPC_TYPE_INVALID.

Referenced by menu_hide(), and menu_on_item_activated().

00314 {
00315     eripc_send_varargs(eripcClient->context, NULL, NULL, ERIPC_BUS_SESSION, DBUS_SERVICE_POPUP_MENU, "updatesFinished", ERIPC_TYPE_INVALID);
00316 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean ipc_status_set_stylus ( const char *  state  ) 

Send message setStatusItemState(statusbar_stylus) to popup menu.

---------------------------------------------------------------------------

Name : ipc_status_set_stylus

Parameters:
[in] state - state string, e.g. 'pointer'
Returns:
TRUE on success, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 333 of file ctb/src/ipc.c.

References eripc_menu_set_statusitem_state().

Referenced by menu_show().

00334 {
00335     g_return_val_if_fail( (state != NULL), FALSE);
00336     return eripc_menu_set_statusitem_state(eripcClient, "statusbar_stylus", state);
00337 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean ipc_sys_busy ( gboolean  look_busy  ) 

Send message sysSetBusy to system daemon.

---------------------------------------------------------------------------

Name : ipc_sys_busy

Parameters:
[in] look_busy - TRUE to show, FALSE to remove the busy indication
Returns:
TRUE on success, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 325 of file ctb/src/ipc.c.

00326 {
00327     if (look_busy)
00328         return eripc_sysd_set_busy(eripcClient, "delaydialog", NULL);
00329     else
00330         return eripc_sysd_reset_busy(eripcClient);
00331 }

const device_caps_t* ipc_sys_get_device_capabilities (  ) 

Query system control for device capabilties.

---------------------------------------------------------------------------

Name : ipc_sys_get_device_capabilities

Parameters:
-- 
Returns:
current device capabilities

--------------------------------------------------------------------------

Definition at line 212 of file ctb/src/ipc.c.

00213 {
00214     static device_caps_t dev_caps;
00215 
00216     eripc_device_caps_t er_dev_caps;
00217 
00218     eripc_sysd_get_device_capabilities( eripcClient, &er_dev_caps );
00219 
00220     dev_caps.has_stylus = er_dev_caps.has_stylus;
00221     dev_caps.has_wifi = er_dev_caps.has_wifi;
00222     dev_caps.has_bluetooth = er_dev_caps.has_bluetooth;
00223     dev_caps.has_3g = er_dev_caps.has_3g;
00224 
00225     return &dev_caps;
00226 }

gboolean ipc_sys_is_in_portrait_mode (  ) 

Query sysd if device in portrait mode.

---------------------------------------------------------------------------

Name : ipc_sys_is_in_portrait_mode

Returns:
TRUE if in portrait mode, FALSE otherwise (landscape)

--------------------------------------------------------------------------

Definition at line 340 of file ctb/src/ipc.c.

00341 {
00342     return g_in_portrait;
00343 }

gint ipc_sys_open_url ( const gchar *  url,
const gchar *  label,
const gchar *  back_text,
gchar **  err_message 
)

Send message openURL to system control, usually to open a web location in the browser application.

---------------------------------------------------------------------------

Name : ipc_sys_open_url

Parameters:
[in] url - url to open
[in] label - text to show in popup menu, or NULL
[in] back_text - text in Back bar, or NULL to omit this bar
[out] err_message - error message text from application
Returns:
error code (0 for success, >0 for failure)

--------------------------------------------------------------------------

Definition at line 200 of file ctb/src/ipc.c.

00204 {
00205     LOGPRINTF("entry: url [%s] label [%s] back_text [%s]",
00206                       url,     label,     back_text     );
00207     g_assert( url && *url );
00208     return eripc_sysd_open_url( eripcClient, url, label, back_text, err_message );
00209 }

gint ipc_sys_start_task ( const gchar *  cmd_line,
const gchar *  work_dir,
const gchar *  label,
const gchar *  thumbnail_path,
gchar **  err_message 
)

Send message startTask to system control, usually to open a document in the relevant viewer application.

---------------------------------------------------------------------------

Name : ipc_sys_start_task

Parameters:
[in] cmd_line - command-line to launch the task (executable + options)
[in] work_dir - working directory in which to start this task
[in] label - text to show in popup menu
[in] thumbnail_path - the file containing the thumbnail to show in popup menu
[out] err_message - error message text from application
Returns:
error code (0 for success, >0 for failure)

--------------------------------------------------------------------------

Definition at line 174 of file ctb/src/ipc.c.

00179 {
00180     LOGPRINTF("entry: cmd_line [%s] work_dir [%s] label [%s] thumbnail_path [%s]",
00181                        cmd_line,     work_dir,     label,     thumbnail_path       );
00182     g_assert( cmd_line && *cmd_line );
00183     return eripc_sysd_start_task( eripcClient, 
00184                                   cmd_line, 
00185                                   work_dir, 
00186                                   label, 
00187                                   thumbnail_path, 
00188                                   err_message);
00189 }

void ipc_sys_startup_complete (  ) 

Report "content browser started" to sysd.

Report "application started" to sysd.

Report "settings started" to sysd.

Report "application started" to system daemon.

---------------------------------------------------------------------------

Name : ipc_sys_startup_complete

Parameters:
-- 
Returns:
--

--------------------------------------------------------------------------

Definition at line 168 of file ctb/src/ipc.c.

00169 {
00170     eripc_sysd_startup_complete( eripcClient, getpid(), FALSE, fileview_get_xid());
00171 }

gboolean ipc_sys_stop_task ( const gchar *  cmd_line  ) 

Send message stopTask to system control, usually to close a documen that has previously been open using ipc_sys_start_task().

---------------------------------------------------------------------------

Name : ipc_sys_stop_task

Parameters:
[in] cmd_line - command-line passed to ipc_sys_start_task() when launching the task
Returns:
TRUE on success, FALSE otherwise

--------------------------------------------------------------------------

Definition at line 192 of file ctb/src/ipc.c.

00193 {
00194     LOGPRINTF("entry: cmd_line [%s]", cmd_line );
00195     g_assert( cmd_line && *cmd_line );
00196     return eripc_sysd_stop_task( eripcClient, cmd_line );
00197 }

static gboolean is_in_portrait_orientation (  )  [static]

Definition at line 350 of file ctb/src/ipc.c.

References eripc_event_info_t::args, eripc_client_context_t::context, DBUS_SERVICE_SYSTEM_CONTROL, ERIPC_BUS_SESSION, ERIPC_ERROR_SUCCESS, eripc_event_info_free(), eripc_send_varargs_and_wait(), ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, ERRORPRINTF, and eripc_arg_t::s.

Referenced by ipc_init().

00351 {
00352     gboolean result = TRUE;
00353 
00354     eripc_event_info_t* info = NULL;
00355     eripc_error_t retval = eripc_send_varargs_and_wait(eripcClient->context,
00356             &info,
00357             ERIPC_BUS_SESSION,
00358             DBUS_SERVICE_SYSTEM_CONTROL,
00359             "sysGetOrientation",
00360             ERIPC_TYPE_INVALID);
00361 
00362     if (retval != ERIPC_ERROR_SUCCESS)
00363     {
00364         ERRORPRINTF("Error launching eripc handler");
00365     }
00366     else if (info == NULL || info->args == NULL)
00367     {
00368         ERRORPRINTF("sysd returns OK but no reply structure");
00369     }
00370     else
00371     {
00372         const eripc_arg_t *arg_array = info->args;
00373 
00374         if (arg_array[0].type == ERIPC_TYPE_STRING
00375             && strcmp("portrait", arg_array[0].value.s) == 0)
00376         {
00377             result = TRUE;
00378         }
00379         else
00380         {
00381             result = FALSE;
00382         }
00383     }
00384     eripc_event_info_free(eripcClient->context, info);
00385     return result;
00386 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void on_changed_locale ( eripc_context_t context,
const eripc_event_info_t info,
void *  user_data 
) [static]

Definition at line 533 of file ctb/src/ipc.c.

References eripc_event_info_t::args, ERIPC_TYPE_STRING, g_set_locale_callback, LOGPRINTF, eripc_arg_t::s, eripc_arg_t::type, and eripc_arg_t::value.

00536 {
00537     LOGPRINTF("entry");
00538     g_return_if_fail(info->args);
00539     g_return_if_fail(info->args[0].type == ERIPC_TYPE_STRING);
00540 
00541     const eripc_arg_t *arg_array = info->args;
00542     const char        *locale    = arg_array[0].value.s;
00543 
00544     if (locale)
00545     {
00546         g_set_locale_callback(locale);
00547     }
00548 }

static void on_changed_orientation ( eripc_context_t context,
const eripc_event_info_t info,
void *  user_data 
) [static]

Definition at line 555 of file ctb/src/ipc.c.

References eripc_event_info_t::args, ERIPC_TYPE_STRING, fileview_move_undo(), fileview_move_up(), g_in_portrait, LOGPRINTF, eripc_arg_t::s, and eripc_arg_t::value.

00558 {
00559     LOGPRINTF("entry");
00560     const eripc_arg_t *arg_array = info->args;
00561 
00562     if (arg_array[0].type == ERIPC_TYPE_STRING)
00563     {   
00564         const char *orientation = arg_array[0].value.s;
00565         if (orientation)
00566         {
00567             if (strcasecmp("portrait", orientation) == 0)
00568             {
00569                 g_in_portrait = TRUE;
00570                 fileview_move_undo();
00571             }
00572             else 
00573             {
00574                 g_in_portrait = FALSE;
00575                 // call orientation change code
00576                 fileview_move_up( 5 ); // moveup 5 pixels to compensate for higher popupmenu in landscape
00577             }
00578         }
00579     }
00580 }

Here is the call graph for this function:

static void on_filesystem_change ( eripc_context_t context,
const eripc_event_info_t info,
void *  user_data 
) [static]

Definition at line 423 of file ctb/src/ipc.c.

References fileview_refresh().

00426 {
00427     fileview_refresh(FALSE);
00428 }

Here is the call graph for this function:

static void on_goto_location ( eripc_context_t context,
const eripc_event_info_t info,
void *  user_data 
) [static]

Definition at line 394 of file ctb/src/ipc.c.

References eripc_event_info_t::args, ERIPC_TYPE_STRING, menu_on_goto_location(), eripc_arg_t::s, eripc_arg_t::type, and eripc_arg_t::value.

00397 {
00398     g_return_if_fail(info->args);
00399     g_return_if_fail(info->args[0].type == ERIPC_TYPE_STRING);
00400 
00401     const eripc_arg_t *arg_array = info->args;
00402     const char        *location  = arg_array[0].value.s;
00403 
00404     if (location==NULL || location[0] == '\0') return;
00405 
00406     menu_on_goto_location( location );
00407 }

Here is the call graph for this function:

static void on_menu_item ( eripc_context_t context,
const eripc_event_info_t info,
void *  user_data 
) [static]

Definition at line 452 of file ctb/src/ipc.c.

References eripc_event_info_t::args, ERIPC_TYPE_STRING, menu_on_item_activated(), eripc_arg_t::s, eripc_arg_t::type, and eripc_arg_t::value.

00455 {
00456     g_return_if_fail(info->args);
00457     g_return_if_fail(info->args[0].type == ERIPC_TYPE_STRING);
00458     g_return_if_fail(info->args[1].type == ERIPC_TYPE_STRING);
00459     g_return_if_fail(info->args[2].type == ERIPC_TYPE_STRING);
00460     g_return_if_fail(info->args[3].type == ERIPC_TYPE_STRING);
00461 
00462     const eripc_arg_t *arg_array = info->args;
00463     const char        *item      = arg_array[0].value.s;
00464     const char        *group     = arg_array[1].value.s;
00465     const char        *menu      = arg_array[2].value.s;
00466     const char        *state     = arg_array[3].value.s;
00467 
00468     if (item && group && menu && state)
00469     {
00470         menu_on_item_activated( item, group, menu, state );
00471     }
00472 }

Here is the call graph for this function:

static void on_mounted ( eripc_context_t context,
const eripc_event_info_t info,
void *  user_data 
) [static]

Definition at line 476 of file ctb/src/ipc.c.

References eripc_event_info_t::args, ERIPC_TYPE_STRING, LOGPRINTF, eripc_arg_t::s, storage_media_mounted(), eripc_arg_t::type, and eripc_arg_t::value.

00479 {
00480     LOGPRINTF("entry");
00481     g_return_if_fail(info->args);
00482     g_return_if_fail(info->args[0].type == ERIPC_TYPE_STRING);
00483 
00484     const eripc_arg_t *arg_array  = info->args;
00485     const char        *mountpoint = arg_array[0].value.s;
00486 
00487     if (mountpoint && *mountpoint)
00488     {
00489         storage_media_mounted(mountpoint);
00490     }
00491 }

Here is the call graph for this function:

static void on_page_change ( eripc_context_t context,
const eripc_event_info_t info,
void *  user_data 
) [static]

Definition at line 410 of file ctb/src/ipc.c.

References eripc_event_info_t::args, ERIPC_TYPE_STRING, fileview_show_next_page(), fileview_show_prev_page(), eripc_arg_t::s, and eripc_arg_t::value.

00413 {
00414     const eripc_arg_t *arg_array = info->args;
00415     g_return_if_fail(arg_array[0].type == ERIPC_TYPE_STRING);
00416     gchar* direction = arg_array[0].value.s;
00417 
00418     if (strcmp(direction, "prev") == 0) fileview_show_prev_page();
00419     if (strcmp(direction, "next") == 0) fileview_show_next_page();
00420 }

Here is the call graph for this function:

static void on_prepare_standby ( eripc_context_t context,
const eripc_event_info_t info,
void *  user_data 
) [static]

Definition at line 522 of file ctb/src/ipc.c.

References fileview_save_view_type(), and LOGPRINTF.

00525 {
00526     LOGPRINTF("entry");
00527 
00528     fileview_save_view_type();
00529 }

Here is the call graph for this function:

static void on_unmounted ( eripc_context_t context,
const eripc_event_info_t info,
void *  user_data 
) [static]

Definition at line 494 of file ctb/src/ipc.c.

References eripc_event_info_t::args, ERIPC_TYPE_STRING, ERRORPRINTF, g_storage_media, g_unmount_cb, LOGPRINTF, eripc_arg_t::s, eripc_arg_t::type, eripc_arg_t::value, and WARNPRINTF.

00497 {
00498     LOGPRINTF("entry");
00499     g_return_if_fail(info->args);
00500     g_return_if_fail(info->args[0].type == ERIPC_TYPE_STRING);
00501 
00502     const eripc_arg_t *arg_array  = info->args;
00503     const char        *mountpoint = arg_array[0].value.s;
00504 
00505     if (!mountpoint || !*mountpoint) return;
00506 
00507     if (g_storage_media) {
00508         if (strcmp(mountpoint, g_storage_media) == 0) {
00509             g_free(g_storage_media);
00510             g_storage_media = NULL;
00511             g_unmount_cb();
00512         } else {
00513             ERRORPRINTF("media mismatch, mountpoint=%s  need to unmount %s", g_storage_media, mountpoint);
00514         }
00515     } else {
00516         WARNPRINTF("storage not present [%s]", mountpoint);
00517     }
00518 }

static void on_window_activated ( eripc_context_t context,
const eripc_event_info_t info,
void *  user_data 
) [static]

Definition at line 431 of file ctb/src/ipc.c.

References fileview_grab_focus(), fileview_refresh(), fileview_set_on_top(), fileview_stop_update_display(), and menu_show().

00434 {
00435     fileview_set_on_top(TRUE);
00436     fileview_stop_update_display();
00437     menu_show();
00438     fileview_grab_focus();
00439     fileview_refresh(FALSE);  // needed for icons + author
00440 }

Here is the call graph for this function:

static void on_window_deactivated ( eripc_context_t context,
const eripc_event_info_t info,
void *  user_data 
) [static]

Definition at line 443 of file ctb/src/ipc.c.

References fileview_set_on_top(), and menu_hide().

00446 {
00447     fileview_set_on_top(FALSE);
00448     menu_hide();
00449 }

Here is the call graph for this function:

void storage_media_mounted ( const gchar *  mountpoint  ) 

Report that a storage media has been mounted.

---------------------------------------------------------------------------

Name : storage_media_mounted

Parameters:
[in] mountpoint - location where this media has been mounted

--------------------------------------------------------------------------

Definition at line 589 of file ctb/src/ipc.c.

References ERRORPRINTF, g_mount_cb, g_storage_media, and LOGPRINTF.

Referenced by main(), and on_mounted().

00590 {
00591     LOGPRINTF("entry: mountpoint [%s]", mountpoint);
00592     g_assert(mountpoint && *mountpoint);
00593 
00594     if (g_storage_media) {
00595         ERRORPRINTF("storage already present %s (new %s)", g_storage_media, mountpoint);
00596     } else {
00597         g_storage_media = g_strdup(mountpoint);
00598         g_mount_cb(mountpoint);
00599     }
00600 }

Here is the caller graph for this function:


Variable Documentation

Definition at line 63 of file ctb/src/ipc.c.

gboolean g_in_portrait = TRUE [static]

Definition at line 66 of file ctb/src/ipc.c.

Referenced by ipc_init(), ipc_sys_is_in_portrait_mode(), and on_changed_orientation().

mount_cb_t g_mount_cb = NULL [static]

Definition at line 69 of file ctb/src/ipc.c.

Referenced by ipc_init(), and storage_media_mounted().

quit_function g_quit_callback = NULL [static]

Definition at line 64 of file ctb/src/ipc.c.

Referenced by ipc_init().

Definition at line 65 of file ctb/src/ipc.c.

Referenced by ipc_init(), and on_changed_locale().

gchar* g_storage_media = NULL [static]

Definition at line 68 of file ctb/src/ipc.c.

Referenced by ipc_get_media(), on_unmounted(), and storage_media_mounted().

unmount_cb_t g_unmount_cb = NULL [static]

Definition at line 70 of file ctb/src/ipc.c.

Referenced by ipc_init(), and on_unmounted().

Initial value:
 {

    { on_goto_location,     "gotoLocation",        NULL                        ,0 },
    { on_menu_item,         "menuItemActivated",   NULL                        ,0 },
    { on_mounted,           "sysVolumeMounted",    NULL                        ,0 },
    { on_window_activated,  "activatedWindow",     NULL                        ,0 },
    { on_window_deactivated,"deactivatedWindow",   NULL                        ,0 },
    { on_mounted,           "sysVolumeMounted",    DBUS_SERVICE_SYSTEM_CONTROL ,0 },
    { on_unmounted,         "sysPrepareUnmount",   DBUS_SERVICE_SYSTEM_CONTROL ,0 },
    { on_unmounted,         "sysVolumeUnmounted",  DBUS_SERVICE_SYSTEM_CONTROL ,0 },
    { on_prepare_standby,   "sysPrepareStandby",   DBUS_SERVICE_SYSTEM_CONTROL ,0 },
    { on_changed_locale,    "sysChangedLocale",    DBUS_SERVICE_SYSTEM_CONTROL ,0 },
    { on_page_change,       "pageChange"    ,      NULL                        ,0 },
    { on_filesystem_change, "filesystemChanged",   NULL                        ,0 },
    { on_changed_orientation, "sysChangedOrientation",  DBUS_SERVICE_SYSTEM_CONTROL ,0 },
    { NULL, NULL, NULL, 0 }  
}

Definition at line 124 of file ctb/src/ipc.c.

Generated by  doxygen 1.6.2-20100208