popupmenu/src/dialog.c File Reference

#include <gtk/gtk.h>
#include <string.h>
#include <libergtk/ergtk.h>
#include <liberipc/eripc.h>
#include <liberutils/display_utils.h>
#include "log.h"
#include "dialog.h"
#include "i18n.h"
#include "ipc.h"
#include "popup.h"
#include "statusbar.h"
Include dependency graph for popupmenu/src/dialog.c:

Go to the source code of this file.

Data Structures

struct  dialog_t

Functions

static void create_splash (void)
static void show_splash (const char *background, const char *title, const char *message)
static void redraw_splash (void)
static void on_dialog_response (GtkDialog *dialog, gint rc, gpointer data)
static void on_dialog_close (GtkDialog *dialog, gint rc, gpointer data)
static void dialog_message_confirm_destroy (void)
static void dialog_message_info_destroy (void)
void dialog_create (void)
 Initialize dialogs for later use.
gboolean dialog_splash_remove ()
 Remove the splash screen.
gboolean dialog_splash_show (const char *type)
 Show a splash screen.
void dialog_wait_show (const char *message)
 Show busy/wait popup dialog (with animation).
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_wait_close (void)
 Close busy/wait popup dialog.
void dialog_message_confirm_close (void)
 Close modal popup dialog with confirmation request (YES/NO).
void dialog_message_info_close (void)
 Close message info popup dialog.
void dialog_rotated (const char *orientation)
static gboolean on_splash_expose (GtkWidget *widget, GdkEventExpose *event, gpointer data)

Variables

static GtkWidget * dialog_wait = NULL
static GtkWidget * splash_window = NULL
static GtkWidget * splash_title = NULL
static GtkWidget * splash_message = NULL
static GdkPixbuf * splash_pixbuf = NULL
static gboolean g_got_control = FALSE
static dialog_tdialog_response = NULL
static dialog_tdialog_info = NULL
static gboolean g_is_rotated = FALSE
static gboolean g_temp_rotation = FALSE
static gboolean g_expect_expose = FALSE
static gboolean g_ignore_next_expose = FALSE

Function Documentation

static void create_splash ( void   )  [static]

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

References LOGPRINTF, on_splash_expose(), splash_message, splash_title, splash_window, and widget.

Referenced by dialog_create().

00519 {
00520     LOGPRINTF("entry");
00521     
00522     GtkWidget *window     = NULL;
00523     GtkWidget *widget     = NULL;
00524     GtkBox    *vbox       = NULL;
00525     GtkWidget *alignment  = NULL;
00526 
00527     // object hierarchy:
00528     //    
00529     // window
00530     //  |
00531     widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
00532     window = widget;
00533     splash_window = GTK_WIDGET(widget);
00534     gtk_window_set_resizable(GTK_WINDOW(splash_window), FALSE);
00535     gtk_window_fullscreen(GTK_WINDOW(splash_window)); 
00536     gtk_window_set_type_hint(GTK_WINDOW(splash_window), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);
00537 
00538 #if MACHINE_IS_DR800SG || MACHINE_IS_DR800S || MACHINE_IS_DR800SW
00539     //    |--alignment
00540     //       |
00541     widget = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
00542     gtk_alignment_set_padding(GTK_ALIGNMENT(widget),
00543             TEXT_TOP_PADDING,
00544             TEXT_BOTTOM_PADDING,
00545             TEXT_LEFT_PADDING,
00546             TEXT_RIGHT_PADDING);
00547     gtk_container_add(GTK_CONTAINER(window), widget);
00548     gtk_widget_show(widget);
00549     alignment = widget;
00550     //       |
00551     //       |-- vbox
00552     //             |
00553     widget = gtk_vbox_new(FALSE, 0);
00554     gtk_container_add(GTK_CONTAINER(alignment), widget);
00555     gtk_widget_show(widget);
00556     vbox = GTK_BOX(widget);   
00557 #elif MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW
00558     //       |
00559     //       |-- vbox
00560     //             |
00561     widget = gtk_vbox_new(FALSE, 0);
00562     gtk_container_add(GTK_CONTAINER(window), widget);
00563     gtk_widget_show(widget);
00564     vbox = GTK_BOX(widget);   
00565     //             |
00566     //             |-- alignment (filler)
00567     //             |    
00568     widget = gtk_alignment_new(0.0, 0.0, 0.0, 0.0);
00569     gtk_box_pack_start(vbox, widget, TRUE, TRUE, 0);
00570     gtk_widget_show(widget);
00571 #else
00572 #error "Unhandled machine type"
00573 #endif     
00574     //             |
00575     //             |-- alignment
00576     //             |     |
00577     widget = gtk_alignment_new(0.5, 0.5, 0.5, 0.5);
00578     gtk_alignment_set_padding( GTK_ALIGNMENT(widget),
00579                                TITLE_TOP_PADDING,
00580                                TITLE_BOTTOM_PADDING,
00581                                TITLE_LEFT_PADDING,
00582                                TITLE_RIGHT_PADDING);
00583     gtk_box_pack_start(vbox, widget, FALSE, FALSE, 0);
00584     gtk_widget_show(widget);
00585     alignment = widget;
00586     
00587     //             |     |    
00588     //             |     |-- label
00589     //             |        
00590     widget = gtk_label_new(NULL);
00591 #if MACHINE_IS_DR800SG || MACHINE_IS_DR800S || MACHINE_IS_DR800SW
00592     int LABEL_WIDTH = 768 - TEXT_LEFT_PADDING - TEXT_RIGHT_PADDING 
00593                           - TITLE_LEFT_PADDING - TITLE_RIGHT_PADDING; 
00594     gtk_widget_set_size_request(widget, LABEL_WIDTH, -1);
00595     gtk_label_set_justify(GTK_LABEL(widget), GTK_JUSTIFY_CENTER);
00596     gtk_label_set_line_wrap(GTK_LABEL(widget), TRUE);
00597 #endif    
00598     gtk_widget_set_name(widget, "irex-splash-title");
00599     gtk_container_add(GTK_CONTAINER(alignment), widget);
00600     gtk_widget_show(widget);
00601     splash_title = widget;
00602 
00603     //             |
00604     //             |-- alignment
00605     //                   |
00606     widget = gtk_alignment_new(0.5, 0.5, 0.5, 0.5);
00607     gtk_alignment_set_padding( GTK_ALIGNMENT(widget),
00608                                MESSAGE_TOP_PADDING,
00609                                MESSAGE_BOTTOM_PADDING,
00610                                MESSAGE_LEFT_PADDING,
00611                                MESSAGE_RIGHT_PADDING);
00612     gtk_box_pack_start(vbox, widget, FALSE, FALSE, 0);
00613     gtk_widget_show(widget);
00614     alignment = widget;
00615     
00616     //                   |    
00617     //                   |-- label
00618     //                     
00619     widget = gtk_label_new(NULL);
00620 #if MACHINE_IS_DR800SG || MACHINE_IS_DR800S || MACHINE_IS_DR800SW
00621     LABEL_WIDTH = 768 - TEXT_LEFT_PADDING - TEXT_RIGHT_PADDING 
00622                       - MESSAGE_LEFT_PADDING - MESSAGE_RIGHT_PADDING; 
00623     gtk_widget_set_size_request(widget, LABEL_WIDTH, -1);
00624 #elif MACHINE_IS_DR1000S || MACHINE_IS_DR1000SW
00625     gtk_widget_set_size_request(widget, 1024, -1);
00626 #else
00627 #error "Unhandled machine type"
00628 #endif    
00629     gtk_widget_set_name(widget, "irex-splash-message");
00630     gtk_label_set_justify(GTK_LABEL(widget), GTK_JUSTIFY_CENTER);
00631     gtk_label_set_line_wrap(GTK_LABEL(widget), TRUE);
00632     gtk_container_add(GTK_CONTAINER(alignment), widget);
00633     gtk_widget_show(widget);   
00634     splash_message = widget;
00635 
00636     // force non-decorated full screen splash
00637     gint w = -1;
00638     gint h = -1;
00639     gdk_window_get_geometry(gdk_get_default_root_window(), NULL, NULL, &w, &h, NULL);
00640     gtk_widget_set_size_request(splash_window, w,  h);
00641     g_signal_connect(GTK_OBJECT(splash_window), "expose_event", G_CALLBACK (on_splash_expose), NULL);
00642 }

Here is the call graph for this function:

Here is the caller graph for this function:

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:

static void dialog_message_confirm_destroy ( void   )  [static]

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

References ipc_send_request_popup(), LOGPRINTF, dialog_t::message_id, and dialog_t::widget.

Referenced by dialog_message_confirm(), and on_dialog_response().

00691 {
00692     LOGPRINTF("entry");
00693     if (dialog_response != NULL)
00694     {
00695         gtk_widget_destroy(dialog_response->widget);
00696         g_free(dialog_response->message_id);
00697         g_free(dialog_response);
00698         dialog_response = NULL;
00699         ipc_send_request_popup("unblock");
00700     }
00701 }

Here is the call graph for this function:

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:

static void dialog_message_info_destroy ( void   )  [static]

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

References ipc_send_request_popup(), LOGPRINTF, dialog_t::message_id, and dialog_t::widget.

Referenced by dialog_message_info(), and on_dialog_close().

00705 {
00706     LOGPRINTF("entry");
00707     if (dialog_info != NULL)
00708     {
00709         gtk_widget_destroy(dialog_info->widget);
00710         g_free(dialog_info->message_id);
00711         g_free(dialog_info);
00712         dialog_info = NULL;
00713         ipc_send_request_popup("unblock");
00714     }
00715 }

Here is the call graph for this function:

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:

static void on_dialog_close ( GtkDialog *  dialog,
gint  rc,
gpointer  data 
) [static]

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

References dialog_t::context, dialog_message_info_destroy(), ipc_send_reply(), LOGPRINTF, dialog_t::message_id, WARNPRINTF, and dialog_t::widget.

Referenced by dialog_message_info().

00672 {
00673     LOGPRINTF("entry");
00674 
00675     if (GTK_WIDGET(widget) != dialog_info->widget)
00676     {
00677         WARNPRINTF("huh? expected these to be the same");
00678     }
00679 
00680     if (dialog_info->context)
00681     {
00682         ipc_send_reply(dialog_info->context, dialog_info->message_id, TRUE);
00683     }
00684     
00685     // remove dialog and its data
00686     dialog_message_info_destroy();
00687 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void on_dialog_response ( GtkDialog *  dialog,
gint  rc,
gpointer  data 
) [static]

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

References dialog_t::context, dialog_message_confirm_destroy(), ipc_send_reply(), LOGPRINTF, dialog_t::message_id, WARNPRINTF, and dialog_t::widget.

Referenced by dialog_message_confirm().

00646 {
00647     gboolean  retval  = FALSE;
00648     
00649     LOGPRINTF("entry");
00650 
00651     if (GTK_WIDGET(widget) != dialog_response->widget)
00652     {
00653         WARNPRINTF("huh? expected these to be the same");
00654     }
00655     
00656     if ((rc == GTK_RESPONSE_OK) || (rc == GTK_RESPONSE_YES))
00657     {
00658         retval = TRUE;
00659     }
00660     
00661     if (dialog_response->context)
00662     {
00663         ipc_send_reply(dialog_response->context, dialog_response->message_id, retval);
00664     }
00665 
00666     // remove dialog and its data
00667     dialog_message_confirm_destroy();
00668 }

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean on_splash_expose ( GtkWidget *  widget,
GdkEventExpose *  event,
gpointer  data 
) [static]

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

References display_update_keep_splash_lock(), g_expect_expose, g_ignore_next_expose, g_is_rotated, g_temp_rotation, LOGPRINTF, and splash_pixbuf.

Referenced by create_splash().

00488 { 
00489     LOGPRINTF("entry: expect expose [%d] is rotated [%d] temp_rotation [%d] ignore next [%d]", g_expect_expose, g_is_rotated, g_temp_rotation, g_ignore_next_expose);
00490     
00491     if (g_ignore_next_expose)
00492     {
00493         g_ignore_next_expose = FALSE;
00494         return FALSE;
00495     }
00496 
00497     if (g_expect_expose)
00498     {
00499         gdk_draw_pixbuf(widget->window, NULL, splash_pixbuf, 0, 0, 0, 0, -1, -1, GDK_RGB_DITHER_MAX, 0, 0);
00500         
00501         GtkWidget *child = gtk_bin_get_child(GTK_BIN(widget));
00502         if (child)
00503         {
00504             gtk_container_propagate_expose(GTK_CONTAINER(widget), child, event);
00505         }
00506 
00507         if (!g_is_rotated)
00508         {
00509             display_update_keep_splash_lock();
00510         }
00511 
00512         g_expect_expose = FALSE;
00513     }
00514     return TRUE;
00515 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void redraw_splash ( void   )  [static]

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

References g_expect_expose, LOGPRINTF, and splash_window.

Referenced by dialog_rotated(), and show_splash().

00410 {
00411     LOGPRINTF("entry");
00412     
00413     GdkRectangle rect;
00414     rect.x = 0;
00415     rect.y = 0;
00416     rect.width  = 1024;
00417     rect.height = 1268;
00418     gtk_widget_show(splash_window);
00419     gdk_window_invalidate_rect(splash_window->window, &rect, TRUE);
00420     
00421     g_expect_expose = TRUE;
00422 }

Here is the caller graph for this function:

static void show_splash ( const char *  background,
const char *  title,
const char *  message 
) [static]

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

References dialog_message_confirm_close(), dialog_message_info_close(), dialog_wait_close(), display_gain_control(), display_splash_lock(), g_got_control, g_ignore_next_expose, g_is_rotated, g_temp_rotation, ipc_send_request_popup(), ipc_set_orientation(), LOGPRINTF, redraw_splash(), splash_message, splash_pixbuf, splash_title, splash_window, and WARNPRINTF.

Referenced by dialog_splash_show().

00426 {
00427     LOGPRINTF("entry");
00428     
00429     g_return_if_fail(splash_window != NULL);
00430     
00431     display_splash_lock();
00432     display_gain_control();
00433     g_got_control = TRUE;
00434     
00435     // close dialogs
00436     dialog_wait_close();
00437     dialog_message_info_close();
00438     dialog_message_confirm_close();
00439         
00440     // replace image
00441     gchar *background_file = NULL;
00442     if (strcmp(image, "usbconnect") == 0
00443 #if MACHINE_IS_DR800SG || MACHINE_IS_DR800S || MACHINE_IS_DR800SW
00444         || strcmp(image, "batterylow") == 0
00445         || strcmp(image, "nosd") == 0
00446         || strcmp(image, "softwareupdate") == 0
00447 #endif    
00448         )
00449     {
00450         background_file = g_strdup_printf("/usr/share/popupmenu/background_%s.png", image);
00451     }
00452     else
00453     {
00454         background_file = g_strdup("/usr/share/popupmenu/background_general.png");
00455     }
00456 
00457     if (splash_pixbuf) g_object_unref(splash_pixbuf);
00458     splash_pixbuf = gdk_pixbuf_new_from_file(background_file, NULL);
00459     if (!splash_pixbuf)
00460     {
00461         WARNPRINTF("splash background not found [%s]", background_file);
00462     }
00463     g_free(background_file);
00464     
00465     // replace title and message
00466     gtk_label_set_text(GTK_LABEL(splash_title), title);
00467     gtk_label_set_text(GTK_LABEL(splash_message), message);
00468     
00469     if (g_is_rotated)
00470     {
00471         // set display to portrait mode temporarily
00472         ipc_set_orientation("portrait");
00473         g_ignore_next_expose = TRUE;
00474         g_temp_rotation = TRUE;
00475     }
00476     else
00477     {
00478         redraw_splash();
00479     }
00480 
00481     ipc_send_request_popup("block");
00482 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

dialog_t* dialog_info = NULL [static]

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

dialog_t* dialog_response = NULL [static]

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

GtkWidget* dialog_wait = NULL [static]

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

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

Referenced by dialog_wait_close(), and dialog_wait_show().

gboolean g_expect_expose = FALSE [static]

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

Referenced by on_splash_expose(), and redraw_splash().

gboolean g_got_control = FALSE [static]

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

Referenced by dialog_splash_remove(), and show_splash().

gboolean g_ignore_next_expose = FALSE [static]

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

Referenced by dialog_splash_remove(), on_splash_expose(), and show_splash().

gboolean g_is_rotated = FALSE [static]
gboolean g_temp_rotation = FALSE [static]
GtkWidget* splash_message = NULL [static]

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

Referenced by create_splash(), and show_splash().

GdkPixbuf* splash_pixbuf = NULL [static]

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

Referenced by on_splash_expose(), and show_splash().

GtkWidget* splash_title = NULL [static]

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

Referenced by create_splash(), and show_splash().

GtkWidget* splash_window = NULL [static]
Generated by  doxygen 1.6.2-20100208