hello-world/src/ipc.c File Reference

#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <gdk/gdkx.h>
#include <sys/types.h>
#include <unistd.h>
#include <liberipc/eripc.h>
#include <liberipc/eripc_support.h>
#include "log.h"
#include "i18n.h"
#include "ipc.h"
#include "main.h"
#include "menu.h"
Include dependency graph for hello-world/src/ipc.c:

Go to the source code of this file.

Defines

#define DBUS_APPL_NAME   "helloworld"
#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"

Functions

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_file_open (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static void on_file_close (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_prepare_unmount (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 void on_page_change (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
static void on_sys_changed_pageturn_inverted (eripc_context_t *context, const eripc_event_info_t *info, void *user_data)
void ipc_set_services (void)
 Setup IPC connection and register API functions.
void ipc_unset_services (void)
 Unregister API functions.
void ipc_sys_startup_complete (void)
 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().
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_remove_menu (const char *name)
 Remove menu from 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_sys_busy (gboolean look_busy)
 Send message sysSetBusy to system daemon.
gboolean ipc_sys_is_pageturn_inverted ()
 Query sysd if pageturning is inverted.
gboolean ipc_sys_is_in_portrait_mode (void)
 Query sysd if device in portrait mode.

Variables

static eripc_client_context_teripcClient = NULL
static eripc_callback_function_t service_functions []

Define Documentation

#define DBUS_APPL_NAME   "helloworld"

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

Definition at line 63 of file hello-world/src/ipc.c.

#define DBUS_INTERFACE   "com.irexnet." DBUS_APPL_NAME

Definition at line 66 of file hello-world/src/ipc.c.

#define DBUS_PATH   "/com/irexnet/" DBUS_APPL_NAME

Definition at line 65 of file hello-world/src/ipc.c.

#define DBUS_SERVICE   "com.irexnet." DBUS_APPL_NAME

Definition at line 64 of file hello-world/src/ipc.c.

#define DBUS_SERVICE_POPUP_MENU   "com.irexnet.popupmenu"

Definition at line 72 of file hello-world/src/ipc.c.

#define DBUS_SERVICE_SYSTEM_CONTROL   "com.irexnet.sysd"

Definition at line 69 of file hello-world/src/ipc.c.


Function Documentation

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 244 of file hello-world/src/ipc.c.

References eripc_menu_add_group().

Referenced by menu_init().

00247 {
00248     return eripc_menu_add_group(eripcClient, name, parent, image);
00249 }

Here is the call graph for this function:

Here is the caller graph for this function:

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 253 of file hello-world/src/ipc.c.

References eripc_menu_add_item().

Referenced by menu_init().

00256 {
00257     return eripc_menu_add_item(eripcClient, name, parent, image);
00258 }

Here is the call graph for this function:

Here is the caller graph for this function:

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 234 of file hello-world/src/ipc.c.

References eripc_menu_add_menu().

Referenced by menu_init().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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 270 of file hello-world/src/ipc.c.

References eripc_menu_set_group_label().

Referenced by menu_set_text().

00272 {
00273     return eripc_menu_set_group_label(eripcClient, name, label);
00274 }

Here is the call graph for this function:

Here is the caller graph for this function:

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 301 of file hello-world/src/ipc.c.

References eripc_menu_set_group_state().

00303 {
00304     return eripc_menu_set_group_state(eripcClient, name, state);
00305 }

Here is the call graph for this function:

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 278 of file hello-world/src/ipc.c.

References eripc_menu_set_item_label().

Referenced by menu_set_text(), update_category(), and update_viewmode_text().

00281 {
00282     return eripc_menu_set_item_label(eripcClient, name, parent, label);
00283 }

Here is the call graph for this function:

Here is the caller graph for this function:

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 309 of file hello-world/src/ipc.c.

References eripc_menu_set_item_state().

00312 {
00313     return eripc_menu_set_item_state(eripcClient, name, parent, state);
00314 }

Here is the call graph for this function:

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 262 of file hello-world/src/ipc.c.

References eripc_menu_set_menu_label().

Referenced by menu_set_text().

00264 {
00265     return eripc_menu_set_menu_label(eripcClient, name, label);
00266 }

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 287 of file hello-world/src/ipc.c.

References eripc_menu_show_menu().

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

Here is the call graph for this function:

gboolean ipc_remove_menu ( const char *  name  ) 

Remove menu from popup menu.

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

Name : ipc_remove_menu

Parameters:
[in] name - name (mnemonic) of menu to be removed
Returns:
--

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

Definition at line 294 of file hello-world/src/ipc.c.

References eripc_menu_remove_menu().

00295 {
00296     return eripc_menu_remove_menu(eripcClient, name);
00297 }

Here is the call graph for this function:

void ipc_set_services (  ) 

Setup IPC connection and register API functions.

File Name : index_ipc.h

Description: The dbus-based eripc functions Copyright (C) 2009 IREX Technologies B.V. All rights reserved.---------------------------------------------------------------------------

Name : ipc_set_services

Parameters:
None 
Returns:
--

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

Definition at line 170 of file hello-world/src/ipc.c.

References DBUS_APPL_NAME, DBUS_INTERFACE, DBUS_PATH, DBUS_SERVICE, and eripc_client_context_new().

00171 {
00172     eripcClient = eripc_client_context_new(
00173                     DBUS_APPL_NAME, 
00174                     "1.0",
00175                     DBUS_SERVICE, 
00176                     DBUS_PATH,
00177                     DBUS_INTERFACE,
00178                     service_functions);
00179 }

Here is the call 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 318 of file hello-world/src/ipc.c.

References eripc_sysd_reset_busy(), and eripc_sysd_set_busy().

00319 {
00320     if (look_busy)
00321         return eripc_sysd_set_busy(eripcClient, "delaydialog", NULL);
00322     else
00323         return eripc_sysd_reset_busy(eripcClient);
00324 }

Here is the call graph for this function:

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 813 of file hello-world/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, LOGPRINTF, and eripc_arg_t::s.

00814 {
00815 
00816     gboolean result = TRUE;
00817 
00818     eripc_error_t retval;
00819     eripc_event_info_t* info = NULL;
00820 
00821     LOGPRINTF("entry");
00822 
00823     retval = eripc_send_varargs_and_wait(eripcClient->context,
00824             &info,
00825             ERIPC_BUS_SESSION,
00826             DBUS_SERVICE_SYSTEM_CONTROL,
00827             "sysGetOrientation",
00828             ERIPC_TYPE_INVALID);
00829 
00830     if (retval != ERIPC_ERROR_SUCCESS)
00831     {
00832         ERRORPRINTF("Error launching eripc handler");
00833     }
00834     else if (info == NULL || info->args == NULL)
00835     {
00836         ERRORPRINTF("sysd returns OK but no reply structure");
00837     }
00838     else
00839     {
00840         const eripc_arg_t *arg_array = info->args;
00841 
00842         if (arg_array[0].type == ERIPC_TYPE_STRING)
00843         {
00844             if ( strcmp("portrait", arg_array[0].value.s) == 0 )
00845             {
00846                 result = TRUE;
00847             }
00848             else
00849             {
00850                 result = FALSE;
00851             }
00852         }
00853         else
00854         {
00855             result = FALSE ;
00856         }
00857     }
00858     eripc_event_info_free(eripcClient->context, info);
00859     return result;
00860 }

Here is the call graph for this function:

gboolean ipc_sys_is_pageturn_inverted (  ) 

Query sysd if pageturning is inverted.

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

Name : ipc_sys_is_pageturn_inverted

Returns:
TRUE if inverted, FALSE otherwise

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

Definition at line 763 of file hello-world/src/ipc.c.

References eripc_event_info_t::args, eripc_arg_t::b, 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_BOOL, ERIPC_TYPE_INVALID, ERRORPRINTF, and LOGPRINTF.

00764 {
00765     gboolean result = FALSE;
00766 
00767     eripc_error_t retval;
00768     eripc_event_info_t* info = NULL;
00769 
00770     LOGPRINTF("entry");
00771 
00772     retval = eripc_send_varargs_and_wait(eripcClient->context,
00773             &info,
00774             ERIPC_BUS_SESSION,
00775             DBUS_SERVICE_SYSTEM_CONTROL,
00776             "sysGetPageturnInverted",
00777             ERIPC_TYPE_INVALID);
00778 
00779     if (retval != ERIPC_ERROR_SUCCESS)
00780     {
00781         ERRORPRINTF("Error launching eripc handler");
00782     }
00783     else if (info == NULL || info->args == NULL)
00784     {
00785         ERRORPRINTF("sysd returns OK but no reply structure");
00786     }
00787     else
00788     {
00789         const eripc_arg_t *arg_array = info->args;
00790 
00791         if (arg_array[0].type == ERIPC_TYPE_BOOL)
00792         {
00793             result = (gboolean) arg_array[0].value.b;
00794         }
00795         else 
00796         {
00797             result = FALSE ;
00798         }
00799     }
00800 
00801     eripc_event_info_free(eripcClient->context, info);
00802     return result; 
00803 }

Here is the call graph for this function:

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 202 of file hello-world/src/ipc.c.

References eripc_sysd_start_task(), and LOGPRINTF.

00207 {
00208     LOGPRINTF("entry: cmd_line [%s] work_dir [%s] label [%s] thumbnail_path [%s]",
00209                        cmd_line,     work_dir,     label,     thumbnail_path       );
00210     g_assert( cmd_line && *cmd_line );
00211     return eripc_sysd_start_task( eripcClient, 
00212                                   cmd_line, 
00213                                   work_dir, 
00214                                   label, 
00215                                   thumbnail_path, 
00216                                   err_message);
00217 }

Here is the call graph for this function:

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 194 of file hello-world/src/ipc.c.

References eripc_sysd_startup_complete(), fileview_get_xid(), and g_main_window.

Referenced by main(), on_startup_complete(), and sys_startup_complete().

00195 {
00196     const int xid = GDK_WINDOW_XID(g_main_window->window);
00197     eripc_sysd_startup_complete( eripcClient, getpid(), TRUE, xid);
00198 }

Here is the call graph for this function:

Here is the caller graph for this function:

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 221 of file hello-world/src/ipc.c.

References eripc_sysd_stop_task(), and LOGPRINTF.

00222 {
00223     LOGPRINTF("entry: cmd_line [%s]", cmd_line );
00224     g_assert( cmd_line && *cmd_line );
00225     return eripc_sysd_stop_task( eripcClient, cmd_line );
00226 }

Here is the call graph for this function:

void ipc_unset_services ( void   ) 

Unregister API functions.

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

Name : ipc_unset_services

Parameters:
-- 
Returns:
--

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

Definition at line 183 of file hello-world/src/ipc.c.

References eripc_client_context_free().

Here is the call 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 646 of file hello-world/src/ipc.c.

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

00649 {
00650     LOGPRINTF("entry");
00651     const eripc_arg_t *arg_array = info->args;
00652 
00653     if (arg_array[0].type == ERIPC_TYPE_STRING)
00654     {
00655         const char *locale = arg_array[0].value.s;
00656         if (locale)
00657         {
00658             const char *old_locale = g_getenv("LANG");
00659             if (!old_locale || (strcmp(old_locale, locale) != 0))
00660             {
00661                 main_set_locale(locale);
00662             }
00663         }
00664     }
00665 }

Here is the call graph for this function:

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

Definition at line 673 of file hello-world/src/ipc.c.

References eripc_event_info_t::args, ERIPC_TYPE_STRING, g_action, LOGPRINTF, msg, eripc_arg_t::s, and eripc_arg_t::value.

00676 {
00677     LOGPRINTF("entry");
00678     gchar             *msg        = NULL;
00679     const eripc_arg_t *arg_array = info->args;
00680     
00681     if (arg_array[0].type == ERIPC_TYPE_STRING)
00682     {
00683         const char *orientation = arg_array[0].value.s;
00684         if (orientation)
00685         {
00686             // TODO: Replace implementation
00687             
00688             msg = g_strdup_printf("Orientation changed: %s", orientation);
00689             gtk_label_set_text( GTK_LABEL(g_action), msg);
00690             LOGPRINTF("%s", msg);
00691             g_free(msg);
00692         }
00693     }
00694 }

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

Definition at line 498 of file hello-world/src/ipc.c.

References eripc_event_info_t::args, eripc_reply_bool(), ERIPC_TYPE_STRING, g_action, LOGPRINTF, eripc_event_info_t::message_id, msg, eripc_arg_t::s, and eripc_arg_t::value.

00501 {
00502     LOGPRINTF("entry");
00503     gchar             *msg        = NULL;
00504     gboolean          result      = FALSE; 
00505     const eripc_arg_t *arg_array  = info->args;
00506     
00507     if (arg_array[0].type == ERIPC_TYPE_STRING)
00508     {
00509         const char *file = arg_array[0].value.s;
00510         if (file)
00511         {
00512             // TODO: Replace implementation
00513 
00514             msg = g_strdup_printf("File to close: %s", file);
00515             gtk_label_set_text( GTK_LABEL(g_action), msg);
00516             LOGPRINTF("%s", msg);
00517             g_free(msg);
00518             
00519             result = TRUE;
00520         }
00521     }
00522     
00523     // return result to caller
00524     eripc_reply_bool(context, info->message_id, result);
00525 }

Here is the call graph for this function:

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

Definition at line 445 of file hello-world/src/ipc.c.

References eripc_event_info_t::args, eripc_reply_varargs(), ERIPC_TYPE_INT, ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, g_action, g_main_window, LOGPRINTF, menu_show(), eripc_event_info_t::message_id, msg, eripc_arg_t::s, and eripc_arg_t::value.

00448 {
00449     LOGPRINTF("entry");
00450     gchar             *msg        = NULL;
00451     gchar             *error_msg  = NULL;
00452     gint              my_xid      = -1; 
00453 
00454     const eripc_arg_t *arg_array  = info->args;
00455     
00456     if (arg_array[0].type == ERIPC_TYPE_STRING)
00457     {
00458         const char *file = arg_array[0].value.s;
00459         if (file)
00460         {
00461             // TODO: Replace implementation
00462 
00463             msg = g_strdup_printf("File to open: %s", file);
00464             gtk_label_set_text( GTK_LABEL(g_action), msg);
00465             LOGPRINTF("%s", msg);
00466             g_free(msg);
00467             
00468             // TODO: Replace implementation
00469 
00470             gboolean success = TRUE;
00471             
00472             if (success) 
00473             {
00474                 my_xid = GDK_WINDOW_XID(g_main_window->window);
00475                 menu_show();
00476             }
00477             else
00478             {
00479                 error_msg = g_strdup_printf(_("Error opening '%s'"), file);
00480             }
00481         }
00482     }
00483     
00484     // return result to caller
00485     eripc_reply_varargs(context, info->message_id, 
00486                         ERIPC_TYPE_INT, my_xid,
00487                         ERIPC_TYPE_STRING, error_msg,
00488                         ERIPC_TYPE_INVALID);
00489     g_free(error_msg);
00490 }

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 339 of file hello-world/src/ipc.c.

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

00342 {
00343     LOGPRINTF("entry");
00344     const eripc_arg_t *arg_array = info->args;
00345 
00346     if ((arg_array[0].type == ERIPC_TYPE_STRING) && 
00347         (arg_array[1].type == ERIPC_TYPE_STRING) && 
00348         (arg_array[2].type == ERIPC_TYPE_STRING) && 
00349         (arg_array[3].type == ERIPC_TYPE_STRING))
00350     {
00351         const char        *item      = arg_array[0].value.s;
00352         const char        *group     = arg_array[1].value.s;
00353         const char        *menu      = arg_array[2].value.s;
00354         const char        *state     = arg_array[3].value.s;
00355         
00356         if (item && group && menu && state)
00357         {
00358             menu_on_item_activated( item, group, menu, state );
00359         }
00360     }
00361 }

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 532 of file hello-world/src/ipc.c.

References eripc_event_info_t::args, ERIPC_TYPE_STRING, g_mountpoint, g_volume, LOGPRINTF, msg, eripc_arg_t::s, and eripc_arg_t::value.

00535 {
00536     LOGPRINTF("entry");
00537     gchar             *msg        = NULL;
00538     const eripc_arg_t *arg_array  = info->args;
00539 
00540     if (arg_array[0].type == ERIPC_TYPE_STRING)
00541     {
00542         const char *mountpoint = arg_array[0].value.s;
00543         if (mountpoint)
00544         {
00545             // TODO: Replace implementation
00546             
00547             g_free(g_mountpoint);
00548             g_mountpoint = g_strdup(mountpoint);
00549             
00550             msg = g_strdup_printf("Device mounted: %s", mountpoint);
00551             gtk_label_set_text( GTK_LABEL(g_volume), msg);
00552             LOGPRINTF("%s", msg);
00553             g_free(msg);
00554         }
00555     }
00556 }

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

Definition at line 724 of file hello-world/src/ipc.c.

References eripc_event_info_t::args, ERIPC_TYPE_STRING, g_action, LOGPRINTF, msg, eripc_arg_t::s, and eripc_arg_t::value.

00727 {
00728     LOGPRINTF("entry");
00729 
00730     gchar             *msg        = NULL;
00731     const eripc_arg_t *arg_array = info->args;
00732 
00733     g_return_if_fail(arg_array[0].type == ERIPC_TYPE_STRING);
00734 
00735     const gchar* direction = arg_array[0].value.s;
00736 
00737     if (direction)
00738     {
00739         // TODO: Replace implementation
00740         msg = g_strdup_printf("page change from menubar, direction:  %s", direction);
00741         gtk_label_set_text( GTK_LABEL(g_action), msg);
00742         LOGPRINTF("%s", msg);
00743         g_free(msg);
00744     }
00745 
00746 }

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

Definition at line 629 of file hello-world/src/ipc.c.

References LOGPRINTF.

00632 {
00633     LOGPRINTF("entry");
00634 
00635     // TODO: Add implementation here
00636 }

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

Definition at line 564 of file hello-world/src/ipc.c.

References eripc_event_info_t::args, ERIPC_TYPE_STRING, g_volume, LOGPRINTF, msg, eripc_arg_t::s, and eripc_arg_t::value.

00567 {
00568     LOGPRINTF("entry");
00569     gchar             *msg        = NULL;
00570     const eripc_arg_t *arg_array  = info->args;
00571 
00572     if (arg_array[0].type == ERIPC_TYPE_STRING)
00573     {
00574         const char *mountpoint = arg_array[0].value.s;
00575         if (mountpoint)
00576         {
00577             // TODO: Replace implementation
00578 
00579             msg = g_strdup_printf("Device to unmount: %s", mountpoint);
00580             gtk_label_set_text( GTK_LABEL(g_volume), msg);
00581             LOGPRINTF("%s", msg);
00582             g_free(msg);
00583         }
00584     }
00585 }

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

Definition at line 701 of file hello-world/src/ipc.c.

References eripc_event_info_t::args, eripc_arg_t::b, ERIPC_TYPE_BOOL, g_action, LOGPRINTF, msg, and eripc_arg_t::value.

00704 {
00705     LOGPRINTF("entry");
00706 
00707     gchar             *msg        = NULL;
00708     const eripc_arg_t *arg_array = info->args;
00709 
00710     if (arg_array[0].type == ERIPC_TYPE_BOOL)
00711     {
00712         gboolean is_inverted = arg_array[0].value.b;
00713 
00714         // TODO: Replace implementation
00715         msg = g_strdup_printf("page turning setting from from flipbar change, is_inverted = %d", is_inverted);
00716         gtk_label_set_text( GTK_LABEL(g_action), msg);
00717         LOGPRINTF("%s", msg);
00718         g_free(msg);
00719     }
00720 
00721 }

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

Definition at line 594 of file hello-world/src/ipc.c.

References eripc_event_info_t::args, ERIPC_TYPE_STRING, g_mountpoint, g_volume, LOGPRINTF, msg, eripc_arg_t::s, and eripc_arg_t::value.

00597 {
00598     LOGPRINTF("entry");
00599     gchar             *msg        = NULL;
00600     const eripc_arg_t *arg_array  = info->args;
00601 
00602     if (arg_array[0].type == ERIPC_TYPE_STRING)
00603     {
00604         const char  *mountpoint = arg_array[0].value.s;
00605         if (mountpoint)
00606         {
00607             // TODO: Replace implementation
00608             
00609             if (g_mountpoint && (strcmp(mountpoint, g_mountpoint) == 0))
00610             {
00611                 g_free(g_mountpoint);
00612                 g_mountpoint = NULL;
00613             }
00614             
00615             msg = g_strdup_printf("Device unmounted: %s", mountpoint);
00616             gtk_label_set_text( GTK_LABEL(g_volume), msg);
00617             LOGPRINTF("%s", msg);
00618             g_free(msg);
00619         }
00620     }
00621 }

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

Definition at line 369 of file hello-world/src/ipc.c.

References eripc_event_info_t::args, eripc_reply_bool(), ERIPC_TYPE_INT, g_action, eripc_arg_t::i, LOGPRINTF, menu_show(), eripc_event_info_t::message_id, msg, and eripc_arg_t::value.

00372 {
00373     LOGPRINTF("entry");
00374     gchar             *msg        = NULL;
00375     gboolean          result      = FALSE; 
00376     const eripc_arg_t *arg_array  = info->args;
00377 
00378     if (arg_array[0].type == ERIPC_TYPE_INT)
00379     {
00380         // TODO: Replace implementation
00381 
00382         gint window = arg_array[0].value.i;
00383         
00384         menu_show();
00385 
00386         msg = g_strdup_printf("Window activated: %d", window);
00387         gtk_label_set_text( GTK_LABEL(g_action), msg);
00388         LOGPRINTF("%s", msg);
00389         g_free(msg);
00390         
00391         result = TRUE;
00392     }
00393 
00394     // return result to caller
00395     eripc_reply_bool(context, info->message_id, result);
00396 }

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 403 of file hello-world/src/ipc.c.

References eripc_event_info_t::args, eripc_reply_bool(), ERIPC_TYPE_INT, g_action, eripc_arg_t::i, LOGPRINTF, main_quit(), eripc_event_info_t::message_id, msg, and eripc_arg_t::value.

00406 {
00407     LOGPRINTF("entry");
00408     gchar             *msg        = NULL;
00409     gboolean          result      = FALSE; 
00410     const eripc_arg_t *arg_array  = info->args;
00411 
00412     if (arg_array[0].type == ERIPC_TYPE_INT)
00413     {
00414         // TODO: Replace implementation
00415 
00416         gint window = arg_array[0].value.i;
00417         
00418         msg = g_strdup_printf("Window deactivated: %d", window);
00419         gtk_label_set_text( GTK_LABEL(g_action), msg);
00420         LOGPRINTF("%s", msg);
00421         g_free(msg);
00422         
00423         result = TRUE;
00424     }
00425     
00426     // return result to caller
00427     eripc_reply_bool(context, info->message_id, result);
00428 
00429     // and close application
00430     main_quit();
00431 }

Here is the call graph for this function:


Variable Documentation

Definition at line 79 of file hello-world/src/ipc.c.

Initial value:
 {
    
    { on_menu_item,           "menuItemActivated",      NULL                       , 0 },
    { on_mounted,             "sysVolumeMounted",       NULL                       , 0 },
    { on_file_open,           "openFile",               NULL                       , 0 },
    { on_file_close,          "closeFile",              NULL                       , 0 },
    { on_window_activated,    "activatedWindow",        NULL                       , 0 },
    { on_window_deactivated,  "deactivatedWindow",      NULL                       , 0 },
    
    { on_mounted,             "sysVolumeMounted",       DBUS_SERVICE_SYSTEM_CONTROL, 0 },
    { on_prepare_unmount,     "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_changed_orientation, "sysChangedOrientation",  DBUS_SERVICE_SYSTEM_CONTROL, 0 },
    { on_page_change,         "pageChange",             NULL                       , 0 },
    { on_sys_changed_pageturn_inverted, "sysChangedPageturnInverted", DBUS_SERVICE_SYSTEM_CONTROL , 0},
    { NULL, NULL, NULL, 0 }
}

Definition at line 139 of file hello-world/src/ipc.c.

Generated by  doxygen 1.6.2-20100208