dialog.h File Reference

#include <liberipc/eripc.h>
Include dependency graph for dialog.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

G_BEGIN_DECLS void dialog_create (void)
 Initialize dialogs for later use.
void dialog_wait_show (const char *message)
 Show busy/wait popup dialog (with animation).
void dialog_wait_close (void)
 Close busy/wait popup dialog.
GtkWidget * dialog_message_info (GtkMessageType type, const char *title, const char *message, eripc_context_t *context, const char *message_id)
 Show popup dialog with message and OK button.
gboolean dialog_message_confirm (const char *title, const char *message, eripc_context_t *context, const char *message_id, const char *button_no, const char *button_yes)
 Show modal popup dialog with confirmation request (YES/NO).
void dialog_message_confirm_close (void)
 Close modal popup dialog with confirmation request (YES/NO).
gboolean dialog_splash_remove (void)
 Remove the splash screen.
gboolean dialog_splash_show (const char *type)
 Show a splash screen.
void dialog_message_info_close (void)
 Close message info popup dialog.
void dialog_rotated (const char *orientation)

Function Documentation

G_BEGIN_DECLS void dialog_create ( void   ) 

Initialize dialogs for later use.

File Name : dialog.h

Description: The dialog functions Copyright (C) 2008 iRex Technologies B.V. All rights reserved.---------------------------------------------------------------------------

Name : dialog_create

Parameters:
-- 
Returns:
--

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

Definition at line 128 of file popupmenu/src/dialog.c.

References create_splash(), g_is_rotated, ipc_get_orientation(), and LOGPRINTF.

Referenced by main().

00129 {
00130     LOGPRINTF("entry");
00131     
00132     gchar *orient = ipc_get_orientation();
00133     if (orient && (strcmp(orient, "portrait") !=0))
00134     {
00135         g_is_rotated = TRUE;
00136     }
00137     g_free(orient);
00138     
00139     create_splash();
00140 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean dialog_message_confirm ( const char *  title,
const char *  message,
eripc_context_t context,
const char *  message_id,
const char *  button_no,
const char *  button_yes 
)

Show modal popup dialog with confirmation request (YES/NO).

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

Name : dialog_message_confirm

Parameters:
title Text to show as window title, NULL to leave blank
message Text to show in dialog
context 
message_id 
button_no 
button_yes 
Returns:
TRUE when confirmed by used, FALSE otherwise

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

Definition at line 296 of file popupmenu/src/dialog.c.

References dialog_t::context, dialog_message_confirm_destroy(), ERRORPRINTF, g_statusbar_window, ipc_send_request_popup(), LOGPRINTF, dialog_t::message_id, on_dialog_response(), dialog_t::widget, and widget.

Referenced by confirm_install_drz_cb(), confirm_install_update_cb(), and confirm_usbconnect_cb().

00302 {
00303     LOGPRINTF("entry");
00304     
00305     GtkWidget *widget = NULL;
00306     
00307     dialog_message_confirm_destroy();
00308     
00309     ipc_send_request_popup("block");
00310     
00311     widget = gtk_message_dialog_new(g_statusbar_window, 
00312                                     GTK_DIALOG_DESTROY_WITH_PARENT,
00313                                     GTK_MESSAGE_QUESTION, 
00314                                     GTK_BUTTONS_NONE,
00315                                     message);
00316     
00317     gtk_dialog_add_buttons(GTK_DIALOG(widget), 
00318                            button_no,  GTK_RESPONSE_NO, 
00319                            button_yes, GTK_RESPONSE_YES, 
00320                            NULL);
00321             
00322     // make sure the dialog appears on top
00323     gtk_window_set_transient_for(GTK_WINDOW(widget), NULL);
00324     gtk_window_set_keep_above(GTK_WINDOW(widget), TRUE);
00325    
00326     if (title)
00327     {
00328         gtk_window_set_title(GTK_WINDOW(widget), title);
00329     }
00330     
00331     dialog_response = g_new0(dialog_t, 1);
00332     if (!dialog_response)
00333     {
00334         ERRORPRINTF("mem alloc failed");
00335         return FALSE;
00336     }
00337     dialog_response->widget  = widget;
00338     dialog_response->context = context;
00339     dialog_response->message_id = g_strdup(message_id);
00340         
00341     // return immediately and capture response through callback
00342     g_signal_connect(widget, "response", G_CALLBACK (on_dialog_response), NULL);
00343     gtk_widget_show(widget);
00344           
00345     return TRUE;
00346 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dialog_message_confirm_close ( void   ) 

Close modal popup dialog with confirmation request (YES/NO).

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

Name : dialog_message_confirm_close

Parameters:
-- 
Returns:
--

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

Definition at line 360 of file popupmenu/src/dialog.c.

References dialog_t::widget.

Referenced by confirm_install_drz_cb(), confirm_install_update_cb(), confirm_usbconnect_cb(), and show_splash().

00361 {
00362     if (dialog_response && dialog_response->widget)
00363     {
00364         gtk_dialog_response(GTK_DIALOG(dialog_response->widget), GTK_RESPONSE_CLOSE);
00365     }
00366 }

Here is the caller graph for this function:

GtkWidget* dialog_message_info ( GtkMessageType  type,
const char *  title,
const char *  message,
eripc_context_t context,
const char *  message_id 
)

Show popup dialog with message and OK button.

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

Name : dialog_message_info

Parameters:
type The type of message being displayed in the dialog
title Text to show as window title, NULL to leave blank
message Text to show in dialog
context 
message_id 
Returns:
GtkWidget pointer to dialog

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

Definition at line 249 of file popupmenu/src/dialog.c.

References dialog_t::context, dialog_message_info_destroy(), ERRORPRINTF, g_statusbar_window, ipc_send_request_popup(), LOGPRINTF, dialog_t::message_id, on_dialog_close(), and dialog_t::widget.

Referenced by main(), and set_message_show_cb().

00254 {
00255     LOGPRINTF("entry");
00256     
00257     GtkWidget *dialog = NULL;
00258 
00259     dialog_message_info_destroy();
00260 
00261     ipc_send_request_popup("block");
00262 
00263     dialog = gtk_message_dialog_new(g_statusbar_window, 
00264                                     GTK_DIALOG_DESTROY_WITH_PARENT,
00265                                     type, 
00266                                     GTK_BUTTONS_OK,
00267                                     message);
00268     
00269     // make sure the dialog appears on top
00270     gtk_window_set_transient_for(GTK_WINDOW(dialog), NULL);
00271     gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE);
00272     
00273     if (title)
00274     {
00275         gtk_window_set_title(GTK_WINDOW(dialog), title);
00276     }
00277     
00278     dialog_info = g_new0(dialog_t, 1);
00279     if (!dialog_info)
00280     {
00281         ERRORPRINTF("mem alloc failed");
00282         return FALSE;
00283     }
00284     dialog_info->widget  = dialog;
00285     dialog_info->context = context;
00286     dialog_info->message_id = g_strdup(message_id);
00287 
00288     // return immediately and capture response through callback
00289     g_signal_connect(dialog, "response", G_CALLBACK (on_dialog_close), NULL);
00290     gtk_widget_show(dialog);
00291     
00292     return dialog;
00293 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dialog_message_info_close ( void   ) 

Close message info popup dialog.

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

Name : dialog_message_info_close

Parameters:
-- 
Returns:
--

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

Definition at line 369 of file popupmenu/src/dialog.c.

References dialog_t::widget.

Referenced by set_message_show_cb(), and show_splash().

00370 {
00371     if (dialog_info && dialog_info->widget)
00372     {
00373         gtk_dialog_response(GTK_DIALOG(dialog_info->widget), GTK_RESPONSE_CLOSE);
00374     }
00375 }

Here is the caller graph for this function:

void dialog_rotated ( const char *  orientation  ) 

Definition at line 378 of file popupmenu/src/dialog.c.

References dialog_splash_remove(), display_update_keep_splash_lock(), g_is_rotated, g_temp_rotation, LOGPRINTF, redraw_splash(), and splash_window.

Referenced by cb_sys_changed_orientation().

00379 {
00380     LOGPRINTF("entry");
00381     
00382     if (strcmp(orientation, "portrait") == 0)
00383     {
00384         g_is_rotated = FALSE;
00385         if (g_temp_rotation)
00386         {
00387             // show completed window
00388             redraw_splash();
00389             gtk_widget_show(splash_window);
00390             display_update_keep_splash_lock();
00391         }
00392     }
00393     else if (g_str_has_prefix(orientation, "landscape"))
00394     {
00395         g_is_rotated = TRUE;
00396         if (g_temp_rotation)
00397         {
00398             g_temp_rotation = FALSE;
00399             dialog_splash_remove();
00400         }
00401     }
00402 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean dialog_splash_remove ( void   ) 

Remove the splash screen.

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

Name : dialog_splash_remove

Returns:
TRUE for success, FALSE otherwise

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

Definition at line 143 of file popupmenu/src/dialog.c.

References display_return_control(), display_splash_unlock(), g_got_control, g_ignore_next_expose, g_temp_rotation, ipc_send_request_popup(), ipc_set_orientation(), LOGPRINTF, and splash_window.

Referenced by dialog_rotated(), and set_splash_show_cb().

00144 {
00145     LOGPRINTF("entry");
00146     
00147     if (g_temp_rotation)
00148     {
00149         // set display back to landscape
00150         ipc_set_orientation("landscape");
00151         g_ignore_next_expose = TRUE;
00152         return FALSE;
00153     }
00154     
00155     gtk_widget_hide(splash_window);
00156     ipc_send_request_popup("unblock");
00157 
00158     if (g_got_control) {
00159         display_splash_unlock();
00160         display_return_control();
00161         g_got_control = FALSE;
00162     }
00163 
00164     return TRUE;
00165 }

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean dialog_splash_show ( const char *  type  ) 

Show a splash screen.

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

Name : dialog_splash_show

Parameters:
type Splash to show ("usbconnect" or "shutdown")
Returns:
TRUE for success, FALSE otherwise

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

Definition at line 168 of file popupmenu/src/dialog.c.

References LOGPRINTF, show_splash(), and WARNPRINTF.

Referenced by on_check_low_battery(), and set_splash_show_cb().

00169 {
00170     LOGPRINTF("entry");
00171     gboolean retval = TRUE;
00172     
00173     g_return_val_if_fail(type != NULL, FALSE);
00174     
00175     if (strcmp(type,"usbconnect") == 0)
00176     {
00177         show_splash("usbconnect", 
00178                 _("Connected"), 
00179                 _("Tip: Eject the device from your computer to resume use while charging."));
00180     }
00181     else if (strcmp(type,"restart") == 0)
00182     { 
00183         show_splash("softwareupdate", 
00184                 _("Installing Firmware"), 
00185                 _("In a few seconds, the device will restart "
00186                   "to install the new firmware."));
00187     }
00188     else if (strcmp(type,"shutdown") == 0)
00189     { 
00190         show_splash("shutdown", 
00191                 _("Goodbye"),
00192                 _("In a few seconds, the device will turn off."));
00193     }
00194     else if (strcmp(type, "indexing") == 0)
00195     {
00196         show_splash("indexing", 
00197                 _("Indexing Files"),
00198                 _("Please wait while indexing files..."));
00199     }
00200     else if (strcmp(type, "batterylow") == 0)
00201     {
00202         show_splash("batterylow",
00203                 _("Low Battery"),
00204                 _("Connect to a power source to keep using the device."));
00205     }
00206     else if (strcmp(type, "safelyremove") == 0)
00207     {
00208         show_splash("nosd", 
00209                 _("Eject Memory Card"), 
00210                 _("You can now safely remove the card from the device."));
00211     }
00212     else if (strcmp(type, "nosd") == 0)
00213     {
00214         show_splash("nosd",
00215                 _("No Memory Card Found"),
00216                 _("Insert a card into the device to continue use."));
00217     }
00218     else if (strcmp(type, "sdfull") == 0)
00219     {
00220         show_splash("nosd",
00221                 _("Memory Card Full"),
00222                 _("Free space by deleting files to continue use."));
00223     }
00224     else if (strcmp(type, "sdreadonly") == 0)
00225     {
00226         show_splash("nosd",
00227                 _("Memory Card Locked"),
00228                 _("Remove the write lock to continue use."));
00229     }
00230     else 
00231     {
00232         WARNPRINTF("splash screen not found: %s", type);
00233         retval = FALSE;
00234     }
00235     
00236     return retval;
00237 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dialog_wait_close ( void   ) 

Close busy/wait popup dialog.

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

Name : dialog_wait_close

Parameters:
-- 
Returns:
--

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

Definition at line 349 of file popupmenu/src/dialog.c.

References dialog_wait, and LOGPRINTF.

Referenced by dialog_wait_show(), set_busy_show_cb(), and show_splash().

00350 {
00351     LOGPRINTF("entry");
00352     if (dialog_wait)
00353     {
00354         gtk_widget_destroy(dialog_wait);
00355         dialog_wait = NULL;
00356     }
00357 }

Here is the caller graph for this function:

void dialog_wait_show ( const char *  message  ) 

Show busy/wait popup dialog (with animation).

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

Name : dialog_wait_show

Parameters:
message Text to show in dialog
Returns:
--

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

Definition at line 240 of file popupmenu/src/dialog.c.

References dialog_wait, dialog_wait_close(), ergtk_busy_dialog_new(), and LOGPRINTF.

Referenced by set_busy_show_cb().

00241 {
00242     LOGPRINTF("entry");
00243     dialog_wait_close();
00244     dialog_wait = ergtk_busy_dialog_new(message);
00245     gtk_widget_show(dialog_wait);
00246 }

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  doxygen 1.6.2-20100208