Go to the source code of this file.
Functions | |
gboolean | ipc_set_services (void) |
Setup IPC connection and register API functions. | |
void | ipc_unset_services (void) |
Unregister API functions. | |
void | ipc_sys_startup_complete (int xid) |
Report "settings started" to sysd. | |
gboolean | ipc_menu_show_menu (const char *name) |
Set menu context. | |
gboolean | ipc_remove_menu (const char *name) |
Remove menu from popup menu. | |
void | menu_init (void) |
Initialise popup menus for settings application. | |
gboolean | ipc_menu_popup (const char *state) |
Request popup menu state. | |
void | ipc_menu_enable () |
Enable items in popup menu. | |
void | ipc_menu_disable () |
Disable items in popup menu. | |
gboolean | ipc_sys_busy (gboolean look_busy) |
Send message sysSetBusy to system daemon. | |
gboolean | ipc_set_stylus (const char *state) |
Request popup menu state. | |
gboolean | get_device_capabilities (gboolean *has_stylus, gboolean *has_wifi, gboolean *has_bluetooth, gboolean *has_3g) |
Get device capabilities from sysd. | |
void | mount_sd_card (void) |
Mount sd card via sysd. | |
void | unmount_sd_card (void) |
Unmount sd card via sysd. | |
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. | |
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_block (void) |
gboolean | ipc_menu_unblock (void) |
gboolean | ipc_sys_is_in_portrait_mode (void) |
Query sysd if device in portrait mode. | |
gboolean | ipc_get_battery_state (gint *level, gchar **state, gint *timeleft) |
Get current battery state and level and update statusbar icon. |
gboolean get_device_capabilities | ( | gboolean * | has_stylus, | |
gboolean * | has_wifi, | |||
gboolean * | has_bluetooth, | |||
gboolean * | has_3g | |||
) |
Get device capabilities from sysd.
---------------------------------------------------------------------------
Name : get_device_capabilities
has_stylus | [Output] Store result of hasing stylus. has_wifi [Output] Store result of hasing wifi. has_bluetooth [Output] Store result of hasing bluetooth. has_3g [Output] Store result of hasing 3g. |
--------------------------------------------------------------------------
Definition at line 202 of file settings/src/ipc.c.
References eripc_sysd_get_device_capabilities(), eripc_device_caps_t::has_3g, eripc_device_caps_t::has_bluetooth, eripc_device_caps_t::has_stylus, and eripc_device_caps_t::has_wifi.
00206 { 00207 eripc_device_caps_t er_dev_caps; 00208 00209 eripc_sysd_get_device_capabilities( eripcClient, &er_dev_caps ); 00210 00211 *has_stylus = er_dev_caps.has_stylus; 00212 *has_wifi = er_dev_caps.has_wifi; 00213 *has_bluetooth = er_dev_caps.has_bluetooth; 00214 *has_3g = er_dev_caps.has_3g; 00215 00216 return TRUE; 00217 }
gboolean ipc_get_battery_state | ( | gint * | level, | |
gchar ** | state, | |||
gint * | timeleft | |||
) |
Get current battery state and level and update statusbar icon.
---------------------------------------------------------------------------
Name : ipc_get_battery_state
[out] | level | Current battery level |
[out] | state | Current charging state, string must be freed |
[out] | timeleft | Minutes to empty (discharing) of -1 (charging) |
--------------------------------------------------------------------------
Definition at line 369 of file popupmenu/src/ipc.c.
References eripc_event_info_t::args, eripc_client_context_t::context, DBUS_SERVICE_SYSD, DBUS_SERVICE_SYSTEM_CONTROL, ERIPC_BUS_SESSION, eripc_error_string(), ERIPC_ERROR_SUCCESS, eripc_event_info_free(), eripc_send_varargs_and_wait(), ERIPC_TYPE_INT, ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, ERRORPRINTF, eripc_arg_t::i, LOGPRINTF, eripc_arg_t::s, and eripc_arg_t::value.
00370 { 00371 eripc_error_t retval; 00372 eripc_event_info_t *info = NULL; 00373 gboolean result = FALSE; 00374 00375 LOGPRINTF("entry"); 00376 00377 retval = eripc_send_varargs_and_wait(eripcClient->context, 00378 &info, 00379 ERIPC_BUS_SESSION, 00380 DBUS_SERVICE_SYSTEM_CONTROL, 00381 "sysGetBatteryState", 00382 ERIPC_TYPE_INVALID); 00383 00384 if (retval == ERIPC_ERROR_SUCCESS) 00385 { 00386 const eripc_arg_t *arg_array = info->args; 00387 00388 if ((arg_array[0].type == ERIPC_TYPE_INT) && 00389 (arg_array[1].type == ERIPC_TYPE_STRING) && 00390 (arg_array[2].type == ERIPC_TYPE_INT)) 00391 { 00392 *level = arg_array[0].value.i; 00393 *state = g_strdup(arg_array[1].value.s); 00394 if (timeleft != NULL) 00395 { 00396 *timeleft = arg_array[2].value.i; 00397 LOGPRINTF("Reply received: battery at %d%% %s, time left: %d", *level, *state, *timeleft); 00398 } 00399 else 00400 { 00401 LOGPRINTF("Reply received: battery at %d%% %s", *level, *state); 00402 } 00403 00404 result = TRUE; 00405 } 00406 } 00407 else 00408 { 00409 ERRORPRINTF("Error launching eripc handler: %s", eripc_error_string(retval)); 00410 } 00411 00412 eripc_event_info_free(eripcClient->context, info); 00413 return result; 00414 }
gboolean ipc_menu_block | ( | void | ) |
Definition at line 301 of file ctb/src/ipc.c.
References eripc_sysd_set_menu_state(), and g_menu_blocked.
00302 { 00303 return eripc_sysd_set_menu_state(eripcClient, "block"); 00304 }
void ipc_menu_disable | ( | ) |
Disable items in popup menu.
---------------------------------------------------------------------------
Name : ipc_menu_disable
-- |
--------------------------------------------------------------------------
void ipc_menu_enable | ( | ) |
Enable items in popup menu.
---------------------------------------------------------------------------
Name : ipc_menu_enable
-- |
--------------------------------------------------------------------------
gboolean ipc_menu_popup | ( | const char * | state | ) |
Request popup menu state.
---------------------------------------------------------------------------
Name : ipc_menu_popup
state | [Input] State ("show", "hide", "toggle", "block", "unblock") |
--------------------------------------------------------------------------
Definition at line 170 of file settings/src/ipc.c.
References eripc_sysd_set_menu_state().
Referenced by on_calibrate_button_clicked().
00171 { 00172 return eripc_sysd_set_menu_state(eripcClient, state); 00173 }
gboolean ipc_menu_show_menu | ( | const char * | name | ) |
Set menu context.
---------------------------------------------------------------------------
Name : ipc_menu_show_menu
name | [Input] Menu name. |
--------------------------------------------------------------------------
Set menu context.
---------------------------------------------------------------------------
Name : ipc_menu_show_menu
[in] | name | - name (mnemonic) of menu to be displayed |
--------------------------------------------------------------------------
Definition at line 280 of file ctb/src/ipc.c.
References DBUS_SERVICE_POPUP_MENU, ERIPC_BUS_SESSION, ERIPC_ERROR_SUCCESS, eripc_menu_show_menu(), eripc_send_varargs(), ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, ERRORPRINTF, and LOGPRINTF.
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.
References eripc_sysd_set_menu_state(), and g_menu_blocked.
00308 { 00309 return eripc_sysd_set_menu_state(eripcClient, "unblock"); 00310 }
gboolean ipc_remove_menu | ( | const char * | name | ) |
Remove menu from popup menu.
---------------------------------------------------------------------------
Name : ipc_remove_menu
name | [Input] Menu name. |
--------------------------------------------------------------------------
---------------------------------------------------------------------------
Name : ipc_remove_menu
[in] | name | - name (mnemonic) of menu to be removed |
--------------------------------------------------------------------------
Definition at line 320 of file erbrowser/src/ipc.c.
References DBUS_SERVICE_POPUP_MENU, ERIPC_BUS_SESSION, ERIPC_ERROR_SUCCESS, eripc_menu_remove_menu(), eripc_send_varargs(), ERIPC_TYPE_INVALID, ERIPC_TYPE_STRING, ERRORPRINTF, and LOGPRINTF.
00321 { 00322 LOGPRINTF("entry"); 00323 return eripc_menu_remove_menu(eripcClient, name); 00324 }
gboolean ipc_set_services | ( | void | ) |
Setup IPC connection and register API functions.
File Name : ipc.h
Description: Internationalization and localization Copyright (C) 2008 iRex Technologies B.V. All rights reserved.---------------------------------------------------------------------------
Name : ipc_set_services
-- |
--------------------------------------------------------------------------
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
None |
--------------------------------------------------------------------------
Definition at line 95 of file index_ipc.c.
00096 { 00097 eripcClient = eripc_client_context_new( 00098 DBUS_APPL_NAME, 00099 "1.0", 00100 DBUS_SERVICE, 00101 DBUS_PATH, 00102 DBUS_INTERFACE, 00103 service_functions); 00104 }
gboolean ipc_set_stylus | ( | const char * | state | ) |
Request popup menu state.
---------------------------------------------------------------------------
Name : ipc_set_stylus
state | [Input] State ("enable", "disable", "suspend", "resume", "high", "normal") |
--------------------------------------------------------------------------
Definition at line 132 of file erscribble/test/ipc.c.
References eripc_menu_set_statusitem_state().
00133 { 00134 g_return_val_if_fail( (state != NULL), FALSE); 00135 return eripc_menu_set_statusitem_state(eripcClient, "statusbar_stylus", state); 00136 }
gboolean ipc_sys_busy | ( | gboolean | look_busy | ) |
Send message sysSetBusy to system daemon.
---------------------------------------------------------------------------
Name : ipc_sys_busy
[in] | look_busy | - TRUE to show, FALSE to remove the busy indication |
--------------------------------------------------------------------------
Definition at line 325 of file ctb/src/ipc.c.
References eripc_sysd_reset_busy(), eripc_sysd_set_busy(), notepad::eripcClient, and LOGPRINTF.
Referenced by notepad::CNotepadPages::get_page().
00326 { 00327 if (look_busy) 00328 return eripc_sysd_set_busy(eripcClient, "delaydialog", NULL); 00329 else 00330 return eripc_sysd_reset_busy(eripcClient); 00331 }
gboolean ipc_sys_is_in_portrait_mode | ( | void | ) |
Query sysd if device in portrait mode.
---------------------------------------------------------------------------
Name : ipc_sys_is_in_portrait_mode
--------------------------------------------------------------------------
Definition at line 340 of file ctb/src/ipc.c.
References eripc_event_info_t::args, eripc_client_context_t::context, DBUS_SERVICE_SYSD, 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, notepad::eripcClient, ERRORPRINTF, g_in_portrait, LOGPRINTF, and eripc_arg_t::s.
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
[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 |
--------------------------------------------------------------------------
Definition at line 200 of file ctb/src/ipc.c.
References eripc_sysd_open_url(), and LOGPRINTF.
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
[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 |
--------------------------------------------------------------------------
Definition at line 174 of file ctb/src/ipc.c.
References eripc_sysd_start_task(), and LOGPRINTF.
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 | ( | int | xid | ) |
Report "settings started" to sysd.
---------------------------------------------------------------------------
Name : ipc_sys_startup_complete
[in] | xid | Xwindows id of main window |
--------------------------------------------------------------------------
Definition at line 302 of file notepad_ipc.cpp.
References eripc_sysd_startup_complete(), notepad::eripcClient, notepad::g_xid, GCONF_DEFAULT_PEN_SIZE, notepad::gMountpoint, notepad::gPensize, notepad::ipc_gconf_initialize(), notepad::ipc_gconf_read(), and notepad::menu_show().
00303 { 00304 // before sending startup_complete contruct default values; 00305 gMountpoint[0] = 0; 00306 gPensize = GCONF_DEFAULT_PEN_SIZE; 00307 00308 ipc_gconf_initialize(); // initalize gconf client 00309 ipc_gconf_read(); 00310 00311 // send startup_complete 00312 g_xid = xid; 00313 eripc_sysd_startup_complete( eripcClient, getpid(), FALSE, xid); 00314 00315 // re-read initialized items 00316 menu_show(); 00317 }
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
[in] | cmd_line | - command-line passed to ipc_sys_start_task() when launching the task |
--------------------------------------------------------------------------
Definition at line 192 of file ctb/src/ipc.c.
References eripc_sysd_stop_task(), and LOGPRINTF.
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 }
void ipc_unset_services | ( | void | ) |
Unregister API functions.
---------------------------------------------------------------------------
Name : ipc_unset_services
-- |
--------------------------------------------------------------------------
Definition at line 108 of file index_ipc.c.
00109 { 00110 eripc_client_context_free(eripcClient, service_functions); 00111 }
void menu_init | ( | void | ) |
Initialise popup menus for settings application.
---------------------------------------------------------------------------
Name : menu_init
-- |
--------------------------------------------------------------------------
Initialise popup menus for settings application.
Initialise popup menus.
---------------------------------------------------------------------------
Name : menu_init
-- |
--------------------------------------------------------------------------
Definition at line 101 of file ctb/src/menu.c.
References BACK_TO_LIBRARY, g_sort_item, GROUP_ACTIONS, GROUP_SORT, GROUP_TOOLS, GROUP_TOOLS_FONTSIZE, GROUP_VIEWS, GROUP_ZOOM_FONT_TOOLS, ipc_menu_add_group(), ipc_menu_add_item(), ipc_menu_add_menu(), ipc_menu_set_item_state(), ipc_menu_show_menu(), ITEM_ACTION_BACK, ITEM_ACTION_CLOSE, ITEM_ACTION_COPY, ITEM_ACTION_CUT, ITEM_ACTION_DELETE, ITEM_ACTION_FORWARD, ITEM_ACTION_OPEN, ITEM_ACTION_PASTE, ITEM_ACTION_RELOAD, ITEM_FONT_SIZE_LARGE, ITEM_FONT_SIZE_MEDIUM, ITEM_FONT_SIZE_SMALL, ITEM_FONT_SIZE_XLARGE, ITEM_SORT_AUTHOR, ITEM_SORT_DATE_ADDED, ITEM_SORT_DATE_READ, ITEM_SORT_NAME, ITEM_VIEW_CONTENT, ITEM_VIEW_DETAIL, ITEM_VIEW_ICON, ITEM_VIEW_LIST, LOGPRINTF, MENU_CONTENT, MENU_CONTENT_DELETE_MODE, MENU_CONTENT_MEDIA, MENU_CONTENT_RECENT_MODE, MENU_MAIN, menu_set_text(), menu_show(), SETTINGS_MENU, STATE_DISABLED, STATE_NORMAL, STATE_SELECTED, SYSTEM_TOP, and WARNPRINTF.
00102 { 00103 g_sort_item = g_string_new(""); 00104 00105 // add groups 00106 const char *group = GROUP_VIEWS; 00107 ipc_menu_add_group( group, "", "folder" ); 00108 ipc_menu_add_item ( ITEM_VIEW_ICON, group, "view_small" ); 00109 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW 00110 ipc_menu_add_item ( ITEM_VIEW_DETAIL, group, "view_detail" ); 00111 #endif 00112 ipc_menu_add_item ( ITEM_VIEW_CONTENT, group, "view_content" ); 00113 00114 group = GROUP_SORT; 00115 ipc_menu_add_group( group, "", "folder" ); 00116 ipc_menu_add_item ( ITEM_SORT_NAME, group, "sort_name" ); 00117 ipc_menu_add_item ( ITEM_SORT_AUTHOR, group, "sort_author" ); 00118 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW 00119 ipc_menu_add_item ( ITEM_SORT_TYPE, group, "sort_type" ); 00120 ipc_menu_add_item ( ITEM_SORT_SIZE, group, "sort_size" ); 00121 #endif 00122 ipc_menu_add_item ( ITEM_SORT_DATE_ADDED, group, "sort_date_added" ); 00123 ipc_menu_add_item ( ITEM_SORT_DATE_READ, group, "sort_date_read" ); 00124 00125 group = GROUP_ACTIONS; 00126 ipc_menu_add_group( group, "", "folder" ); 00127 #if MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW 00128 ipc_menu_add_item ( ITEM_ACTION_SHORTCUT, group, "create_shortcut" ); 00129 #endif 00130 ipc_menu_add_item ( ITEM_ACTION_DELETE, group, "delete" ); 00131 00132 // add menus 00133 ipc_menu_add_menu(MENU_CONTENT_MEDIA, GROUP_VIEWS, GROUP_SORT, GROUP_ACTIONS); 00134 ipc_menu_add_menu(MENU_CONTENT, GROUP_VIEWS, NULL, NULL); 00135 ipc_menu_add_menu(MENU_CONTENT_DELETE_MODE, GROUP_ACTIONS, NULL, NULL); 00136 ipc_menu_add_menu(MENU_CONTENT_RECENT_MODE, GROUP_VIEWS, GROUP_ACTIONS, NULL); 00137 00138 ipc_menu_set_item_state(BACK_TO_LIBRARY, SYSTEM_TOP, STATE_NORMAL); 00139 00140 menu_set_text(); 00141 }
void mount_sd_card | ( | void | ) |
Mount sd card via sysd.
---------------------------------------------------------------------------
Name : mount_sd_card
-- |
--------------------------------------------------------------------------
Definition at line 220 of file settings/src/ipc.c.
References eripc_sysd_mount_sd_card().
Referenced by on_umount_done().
00221 { 00222 eripc_sysd_mount_sd_card(eripcClient, FALSE); 00223 }
void unmount_sd_card | ( | void | ) |
Unmount sd card via sysd.
---------------------------------------------------------------------------
Name : unmount_sd_card
-- |
--------------------------------------------------------------------------
Definition at line 226 of file settings/src/ipc.c.
References eripc_sysd_unmount_sd_card().
Referenced by on_format_sd().
00227 { 00228 eripc_sysd_unmount_sd_card(eripcClient); 00229 }