settings/src/iLiadArcLocScreen.c File Reference

settings - Archive Location Screen More...

#include <string.h>
#include <gtk/gtk.h>
#include <liberdm/display.h>
#include <libergtk/ergtk.h>
#include "setupLog.h"
#include "displayStatus.h"
#include "gtkInfoItem.h"
#include "gtkSettingItem.h"
#include "iLiadArcLocData.h"
#include "iLiadArcLocScreen.h"
#include "settings.h"
#include "languages.h"

Go to the source code of this file.

Functions

static GtkWidget * gtk_archive_location_new (gtkArcLoc_t *arcLoc)
static GtkWidget * iLiad_archive_location_create_buttons (gtkArcLoc_t *arcLoc)
static void on_selection_update (erGtkSelectionGroup *selection, gpointer button, gpointer data)
GtkWidget * iLiad_archive_location_create (void)
void iLiad_archive_location_set_text (void)
void iLiad_archive_location_display_data (void)

Variables

static GtkWidget * g_archive_settingitem = NULL
static GtkWidget * g_export_settingitem = NULL
static gtkArcLoc_t g_archive_locs [arcTypeUndefined]
static gtkArcLoc_t g_export_loc
static GtkWidget * g_info_item = NULL


Detailed Description

settings - Archive Location Screen

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

Providing GUI interface to let users input their personalize archive location.

Definition in file iLiadArcLocScreen.c.


Function Documentation

static GtkWidget * gtk_archive_location_new ( gtkArcLoc_t arcLoc  )  [static]

Definition at line 127 of file iLiadArcLocScreen.c.

00128 {
00129     GtkWidget *background;
00130     GtkWidget *alignment;
00131     GtkWidget *vbox;
00132     GtkWidget *title;
00133     GtkWidget *subTitle;
00134     GtkWidget *widget;
00135 
00136     ST_LOGPRINTF("entry");
00137     g_return_val_if_fail(arcLoc, NULL);
00138 
00139     // widget hierarchy
00140     // ----------------
00141     //     background 
00142     //       |
00143     background = gtk_event_box_new();
00144     gtk_widget_set_name(background, "archive_location_background");
00145     gtk_widget_set_size_request(background, ARC_LOC_ITEM_BK_W, ARC_LOC_ITEM_BK_H);
00146    //       |
00147     //       |-- alignment
00148     //             |-- vbox
00149     //                   |
00150     alignment = gtk_alignment_new(0, 0, 0, 0);
00151     gtk_alignment_set_padding(GTK_ALIGNMENT(alignment),
00152                               ARC_LOC_SCR_ITEM_PADDING_T, ARC_LOC_SCR_ITEM_PADDING_B,
00153                               ARC_LOC_SCR_ITEM_PADDING_L, ARC_LOC_SCR_ITEM_PADDING_R);
00154     gtk_container_add(GTK_CONTAINER(background), alignment);
00155     //
00156     vbox = gtk_vbox_new(FALSE, ARC_LOC_SCR_SPACING_V);
00157     gtk_container_add(GTK_CONTAINER(alignment), vbox);
00158     //                   |
00159     //                   |-- title
00160     title = gtk_label_new("");
00161     gtk_box_pack_start(GTK_BOX(vbox), title, FALSE, FALSE, 0);
00162     gtk_widget_set_name(title, "archive_location_title");
00163     gtk_widget_set_size_request(title, ARC_LOC_ITEM_LABEL_W, (-1));
00164     gtk_label_set_single_line_mode(GTK_LABEL(title), FALSE);
00165     gtk_label_set_line_wrap(GTK_LABEL(title), FALSE);
00166     gtk_label_set_justify(GTK_LABEL(title), GTK_JUSTIFY_LEFT);
00167     gtk_misc_set_alignment(GTK_MISC(title), 0.0, 0.0);
00168     arcLoc->title = title;
00169     //                   |
00170     //                   |-- subTitle
00171     subTitle = gtk_label_new("");
00172     gtk_box_pack_start(GTK_BOX(vbox), subTitle, FALSE, FALSE, 0);
00173     gtk_widget_set_name(subTitle, "archive_location_info_text");
00174     gtk_widget_set_size_request(subTitle, ARC_LOC_ITEM_LABEL_W, (-1));
00175     gtk_label_set_single_line_mode(GTK_LABEL(subTitle), FALSE);
00176     gtk_label_set_line_wrap(GTK_LABEL(subTitle), TRUE);
00177     gtk_label_set_justify(GTK_LABEL(subTitle), GTK_JUSTIFY_LEFT);
00178     gtk_misc_set_alignment(GTK_MISC(subTitle), 0.0, 0.0);
00179     arcLoc->subTitle = subTitle;
00180     //                   |
00181     //                   |-- buttons
00182     widget = iLiad_archive_location_create_buttons(arcLoc);
00183     gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0);
00184     
00185     // return
00186     return background;
00187 }

Here is the call graph for this function:

GtkWidget* iLiad_archive_location_create ( void   ) 

Definition at line 74 of file iLiadArcLocScreen.c.

00075 {
00076     int        i;
00077     GtkWidget *item;
00078     GtkWidget *top_vbox;
00079     GtkWidget *vbox;
00080     GtkWidget *widget;
00081 
00082     ST_LOGPRINTF("entry");
00083 
00084     // Top level vbox
00085     top_vbox = gtk_vbox_new(FALSE, ARC_LOC_SCR_SPACING_V);
00086 
00087     // g_archive_settingitem
00088     item = gtk_settingitem_new("");
00089     gtk_widget_set_size_request(item, -1, -1);
00090     gtk_box_pack_start(GTK_BOX(top_vbox), item, FALSE, FALSE, 0);
00091     g_archive_settingitem = item;
00092 
00093     // vbox
00094     vbox = gtk_vbox_new(FALSE, SETTINGITEM_ITEM_SPACING);
00095     gtk_settingitem_add_details(GTK_SETTINGITEM(item), vbox);
00096     
00097     // g_archive_locs[..]
00098     for (i = 0 ; i < sizeof(g_archive_locs) / sizeof(g_archive_locs[0]) ; i++)
00099     {
00100         widget = gtk_archive_location_new(&g_archive_locs[i]);
00101         gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0);
00102     }
00103 
00104     // g_export_settingitem
00105     item = gtk_settingitem_new("");
00106     gtk_widget_set_size_request(item, -1, -1);
00107     gtk_box_pack_start(GTK_BOX(top_vbox), item, FALSE, FALSE, 0);
00108     g_export_settingitem = item;
00109 
00110     widget = gtk_archive_location_new(&g_export_loc);
00111     gtk_settingitem_add_details(GTK_SETTINGITEM(item), widget);
00112     gtk_widget_show_all(widget);
00113 
00114     // g_info_item
00115     widget = gtk_infoitem_new(FALSE);
00116     gtk_box_pack_start(GTK_BOX(top_vbox), widget, FALSE, FALSE, 0);
00117     g_info_item = widget;
00118    
00119     // show widgets
00120     gtk_widget_show_all(vbox);
00121     gtk_widget_show(g_archive_settingitem);
00122     gtk_widget_show(g_export_settingitem);
00123     gtk_widget_show(top_vbox);
00124     return top_vbox;
00125 }

Here is the call graph for this function:

static GtkWidget * iLiad_archive_location_create_buttons ( gtkArcLoc_t arcLoc  )  [static]

Definition at line 189 of file iLiadArcLocScreen.c.

00190 {
00191     int i;
00192     GtkWidget *hbox;
00193     GtkWidget *button;
00194     GtkWidget *selection;
00195     GtkToggleButton *button_tbl[ARC_LOC_BTN_NUM + 1];
00196 
00197     ST_LOGPRINTF("entry");
00198 
00199     // widget hierarchy
00200     // ----------------
00201     //     hbox
00202     //       |-- xx_buttons[..]
00203     //
00204     hbox = gtk_hbox_new(FALSE, ARC_LOC_BTN_SPACING_H);
00205     for (i = 0; i < ARC_LOC_BTN_NUM; i++)
00206     {
00207         button = ergtk_toggle_button_new_with_label("");
00208         button_tbl[i] = GTK_TOGGLE_BUTTON(button);
00209         gtk_widget_set_size_request(GTK_WIDGET(button), ARC_LOC_BTN_W, ARC_LOC_BTN_H);
00210         gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(button), FALSE, FALSE, 0);
00211 
00212         arcLoc->buttons[i] = GTK_WIDGET(button);
00213     }
00214     button_tbl[i] = NULL;
00215     //
00216     // selection grout not part of widget hierarchy
00217     selection = ergtk_selection_group_new(button_tbl);
00218     gtk_widget_set_name(selection, "archive_location_background");
00219     ergtk_selection_group_set_details(ERGTK_SELECTION_GROUP(selection), 1, 1);
00220     g_signal_connect(G_OBJECT(selection), "selection-update", G_CALLBACK(on_selection_update), arcLoc);
00221     arcLoc->selection = selection;
00222 
00223     return hbox;
00224 }

Here is the call graph for this function:

void iLiad_archive_location_display_data ( void   ) 

Definition at line 290 of file iLiadArcLocScreen.c.

00291 {
00292     int           i;
00293     arcType_e     type;
00294     arcLocType_e  location;
00295     GtkWidget    *button;
00296 
00297     ST_LOGPRINTF("entry");
00298 
00299     for (i = 0 ; i < sizeof(g_archive_locs) / sizeof(g_archive_locs[0]) ; i++)
00300     {
00301         type = g_archive_locs[i].arcType;
00302         location = iLiad_archive_location_data_get(type);
00303 
00304         button = g_archive_locs[i].buttons[location];
00305         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
00306     }
00307 
00308     location = iLiad_export_location_data_get();
00309     button = g_export_loc.buttons[location];
00310     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
00311 }

Here is the call graph for this function:

void iLiad_archive_location_set_text ( void   ) 

Definition at line 226 of file iLiadArcLocScreen.c.

00227 {
00228     int           i;
00229     gtkArcLoc_t  *arcLoc;
00230     GtkWidget   **button_tbl;
00231 
00232     ST_LOGPRINTF("entry");
00233 
00234     if (g_archive_settingitem)
00235     {
00236         gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_archive_settingitem), _("Archive locations"));
00237         // news
00238         arcLoc = &g_archive_locs[arcNews];
00239         gtk_label_set_text(GTK_LABEL(arcLoc->title),    _("Newspapers"));
00240         gtk_label_set_text(GTK_LABEL(arcLoc->subTitle), _("Select a memory type for the 'NEWS' button."));
00241         // books
00242         arcLoc = &g_archive_locs[arcBooks];
00243         gtk_label_set_text(GTK_LABEL(arcLoc->title),    _("Books"));
00244         gtk_label_set_text(GTK_LABEL(arcLoc->subTitle), _("Select a memory type for the 'BOOKS' button."));
00245         // docs
00246         arcLoc = &g_archive_locs[arcDocs];
00247         gtk_label_set_text(GTK_LABEL(arcLoc->title),    _("Documents"));
00248         gtk_label_set_text(GTK_LABEL(arcLoc->subTitle), _("Select a memory type for the 'DOCS' button."));
00249         // notes
00250         arcLoc = &g_archive_locs[arcNotes];
00251         gtk_label_set_text(GTK_LABEL(arcLoc->title),    _("Notes"));
00252         gtk_label_set_text(GTK_LABEL(arcLoc->subTitle), _("Select a memory type for the 'NOTES' button."));
00253 
00254         // button labels
00255         for (i = 0 ; i < sizeof(g_archive_locs) / sizeof(g_archive_locs[0]) ; i++)
00256         {
00257             button_tbl = g_archive_locs[i].buttons;
00258             gtk_button_set_label(GTK_BUTTON(button_tbl[arcLocMain]), _("Internal memory"));
00259             gtk_button_set_label(GTK_BUTTON(button_tbl[arcLocCard]), _("MMC card"       ));
00260             gtk_button_set_label(GTK_BUTTON(button_tbl[arcLocUSB ]), _("USB stick"      ));
00261             gtk_button_set_label(GTK_BUTTON(button_tbl[arcLocCF  ]), _("CF card"        ));
00262         }
00263     }
00264 
00265     if (g_export_settingitem)
00266     {
00267         gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_export_settingitem), _("USB Connection"));
00268         
00269         // Export
00270         arcLoc = &g_export_loc;
00271         gtk_label_set_text(GTK_LABEL(arcLoc->title),    _("Export via USB"));
00272         gtk_label_set_text(GTK_LABEL(arcLoc->subTitle), _("Select a memory type to be exported to the PC via the USB cable."));
00273 
00274         button_tbl = g_export_loc.buttons;
00275         gtk_button_set_label(GTK_BUTTON(button_tbl[arcLocMain]), _("Internal memory"));
00276         gtk_button_set_label(GTK_BUTTON(button_tbl[arcLocCard]), _("MMC card"       ));
00277         gtk_button_set_label(GTK_BUTTON(button_tbl[arcLocUSB ]), _("USB stick"      ));
00278         gtk_button_set_label(GTK_BUTTON(button_tbl[arcLocCF  ]), _("CF card"        ));
00279     }
00280 
00281     if (g_info_item)
00282     {
00283         // info
00284         gtk_infoitem_set_text( GTK_INFOITEM(g_info_item),
00285                                _("\nWhen you select a memory type for an archive key, "
00286                                  "the iLiad will use this as storage for newly downloaded items from iDS.") );
00287     }
00288 }

Here is the call graph for this function:

static void on_selection_update ( erGtkSelectionGroup selection,
gpointer  button,
gpointer  data 
) [static]

Definition at line 314 of file iLiadArcLocScreen.c.

00315 {
00316     const gtkArcLoc_t *arcLoc = (gtkArcLoc_t*)data;
00317 
00318     int          button_id = 0;
00319     arcLocType_e location;
00320 
00321 
00322     ST_LOGPRINTF("entry");
00323     g_return_if_fail(data != NULL);
00324 
00325     ergtk_selection_group_get_selected_buttons(ERGTK_SELECTION_GROUP(arcLoc->selection), &button_id, 1);
00326     if (button_id >= 0  &&  button_id < arcLocUndefined)
00327     {
00328         location = button_id;
00329     }
00330     else
00331     {
00332         location = arcLocMain;
00333     }
00334 
00335     if (arcLoc == &g_export_loc)
00336     {
00337         iLiad_export_location_data_set(location);
00338     }
00339     else
00340     {
00341         iLiad_archive_location_data_set(arcLoc->arcType, location);
00342     }
00343 }

Here is the call graph for this function:


Variable Documentation

gtkArcLoc_t g_archive_locs[arcTypeUndefined] [static]

Initial value:

 {
                                                        { arcNews  },
                                                        { arcBooks },
                                                        { arcDocs  },
                                                        { arcNotes },
                                                      }

Definition at line 49 of file iLiadArcLocScreen.c.

GtkWidget* g_archive_settingitem = NULL [static]

Definition at line 47 of file iLiadArcLocScreen.c.

Definition at line 55 of file iLiadArcLocScreen.c.

GtkWidget* g_export_settingitem = NULL [static]

Definition at line 48 of file iLiadArcLocScreen.c.

GtkWidget* g_info_item = NULL [static]

Definition at line 56 of file iLiadArcLocScreen.c.


Generated on Sun Dec 14 17:17:01 2008 by  doxygen 1.5.6