advanced.c File Reference

#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <libergtk/ergtk.h>
#include "i18n.h"
#include "log.h"
#include "settings.h"
#include "settings_utils.h"
#include "settings_style.h"
#include "advanced.h"
Include dependency graph for advanced.c:

Go to the source code of this file.

Data Structures

struct  AdvancedSettings

Functions

static GtkWidget * create_zooming_widgets (GtkBox *parent)
static GtkWidget * create_scribble_widgets (GtkBox *parent)
static GtkWidget * create_sd_card_widgets (GtkBox *parent)
static GtkWidget * create_thumbnail_widgets (GtkBox *parent)
static void on_zooming_changed (GtkWidget *widget, gpointer data)
static void on_scribble_changed (GtkWidget *widget, gpointer data)
static void on_sd_card_changed (GtkWidget *widget, gpointer data)
static void on_thumbnail_changed (GtkWidget *widget, gpointer data)
static void init_widgets_with_settings (void)
static void on_listview_row_activated (GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data)
static void on_listview_navigate_cursor (erGtkListView *er_listview, erGtkListViewKeyPress keycode, gpointer user_data)
static gboolean on_focus_in (GtkWidget *widget, gpointer data)
static gboolean on_focus_out (GtkWidget *widget, gpointer data)
void load_advanced_settings ()
void save_advanced_settings ()
GtkWidget * create_advanced_window (GtkWidget *parent)

Variables

static AdvancedSettings g_original_settings
static AdvancedSettings g_current_settings
static GtkWidget * g_advanced_settings_window = NULL
static GtkWidget * g_zooming_check = NULL
static GtkWidget * g_scribble_check = NULL
static GtkWidget * g_sd_card_check = NULL
static GtkWidget * g_thumbnail_check = NULL

Function Documentation

GtkWidget* create_advanced_window ( GtkWidget *  parent  ) 

Copyright (C) 2010 IREX Technologies B.V. All rights reserved.

Definition at line 150 of file advanced.c.

References create_frame(), create_scribble_widgets(), create_sd_card_widgets(), create_settingsview(), create_thumbnail_widgets(), create_title(), create_zooming_widgets(), g_advanced_settings_window, init_widgets_with_settings(), on_focus_in(), on_focus_out(), on_listview_navigate_cursor(), on_listview_row_activated(), and WINDOW_BORDER_PADDING.

Referenced by create_concrete_win().

00151 {
00152     // create top window
00153     GtkWidget* top_window = parent;
00154     gtk_window_maximize(GTK_WINDOW(top_window));
00155     gtk_window_set_resizable(GTK_WINDOW(top_window), FALSE);
00156     gtk_container_set_border_width(GTK_CONTAINER(top_window),WINDOW_BORDER_PADDING  );
00157     gtk_window_set_modal(GTK_WINDOW(top_window), TRUE);
00158 
00159     // top level vbox (vboxtop)
00160     GtkWidget* vboxtop = gtk_vbox_new(FALSE, 0);
00161     gtk_container_add(GTK_CONTAINER(top_window), vboxtop);
00162 
00163     // add header container the title and subtitle of this settings page
00164     create_title(GTK_VBOX(vboxtop), _("Settings"), _("Advanced Settings"));
00165     
00166     // add the back/exit bar below the title 
00167     GtkWidget* view = create_settingsview();
00168     gtk_box_pack_start(GTK_BOX(vboxtop), view, FALSE, FALSE,0 ); 
00169     g_signal_connect(view, "row-activated", G_CALLBACK(on_listview_row_activated), NULL ) ;
00170     g_signal_connect(view, "navigate-cursor", G_CALLBACK(on_listview_navigate_cursor), NULL ) ;
00171     g_signal_connect(view, "focus-in-event", G_CALLBACK(on_focus_in), NULL );
00172     g_signal_connect(view, "focus-out-event", G_CALLBACK(on_focus_out), NULL );
00173 
00174    
00175     GtkWidget* vbox1 = GTK_WIDGET( create_frame(GTK_VBOX(vboxtop)) );
00176     create_zooming_widgets(GTK_BOX(vbox1));
00177 
00178     GtkWidget* vbox2 = GTK_WIDGET( create_frame(GTK_VBOX(vboxtop)) );
00179     create_scribble_widgets(GTK_BOX(vbox2));
00180 
00181     GtkWidget* vbox3 = GTK_WIDGET( create_frame(GTK_VBOX(vboxtop)) );
00182     create_sd_card_widgets(GTK_BOX(vbox3));
00183 
00184     GtkWidget* vbox4 = GTK_WIDGET( create_frame(GTK_VBOX(vboxtop)) );
00185     create_thumbnail_widgets(GTK_BOX(vbox4));
00186 
00187     // Update widget with current settings.
00188     init_widgets_with_settings();
00189 
00190     g_advanced_settings_window = top_window;
00191 
00192     gtk_widget_grab_focus(view);
00193 
00194     gtk_widget_show_all(top_window);
00195     return top_window;
00196 }

Here is the call graph for this function:

Here is the caller graph for this function:

static GtkWidget * create_scribble_widgets ( GtkBox *  parent  )  [static]

Definition at line 291 of file advanced.c.

References description_create(), g_scribble_check, ITEM_SPACING, on_scribble_changed(), and subject_create().

Referenced by create_advanced_window().

00292 {
00293     // Top level vbox.
00294     GtkWidget* top_level_vbox = gtk_vbox_new(FALSE, ITEM_SPACING);
00295     gtk_box_pack_start(parent, top_level_vbox, FALSE, FALSE, 0);
00296 
00297     // Subject
00298     GtkWidget* subject = subject_create();
00299     gtk_label_set_label(GTK_LABEL(subject),
00300         _("PDF Annotation"));
00301     gtk_box_pack_start(GTK_BOX(top_level_vbox), subject, FALSE, FALSE, 0);
00302 
00303     // Description
00304     GtkWidget* desc = description_create();
00305     gtk_label_set_label(GTK_LABEL(desc),
00306         _("Enable the ability to write on the Original Layout of a PDF document. "
00307           "Changing the font size of the document disables the writing features. " 
00308           "Currently, annotations cannot be exported or merged."));
00309     gtk_box_pack_start(GTK_BOX(top_level_vbox), desc, FALSE, FALSE, 0);
00310 
00311     // The check button
00312     g_scribble_check = gtk_check_button_new_with_label(_("Enable writing"));
00313     g_signal_connect(G_OBJECT(g_scribble_check),
00314         "toggled",
00315         G_CALLBACK(on_scribble_changed),
00316         NULL);
00317     gtk_box_pack_start(GTK_BOX(top_level_vbox), g_scribble_check, FALSE, FALSE, 0);
00318 
00319     return top_level_vbox;
00320 }

Here is the call graph for this function:

Here is the caller graph for this function:

static GtkWidget * create_sd_card_widgets ( GtkBox *  parent  )  [static]

Definition at line 327 of file advanced.c.

References description_create(), g_sd_card_check, ITEM_SPACING, on_sd_card_changed(), and subject_create().

Referenced by create_advanced_window().

00328 {
00329     // Top level vbox.
00330     GtkWidget* top_level_vbox = gtk_vbox_new(FALSE, ITEM_SPACING);
00331     gtk_box_pack_start(parent, top_level_vbox, FALSE, FALSE, 0);
00332 
00333     // Subject
00334     GtkWidget* subject = subject_create();
00335     gtk_label_set_label(GTK_LABEL(subject), 
00336         _("Folder Based Navigation"));
00337     gtk_box_pack_start(GTK_BOX(top_level_vbox), subject, FALSE, FALSE, 0);
00338 
00339     // Description
00340     GtkWidget* desc = description_create();
00341     gtk_label_set_label(GTK_LABEL(desc),
00342         _("Access the folder structure of the memory card by adding an SD Card icon on the Home screen."));
00343     gtk_box_pack_start(GTK_BOX(top_level_vbox), desc, FALSE, FALSE, 0);
00344 
00345     // The check button
00346     g_sd_card_check = gtk_check_button_new_with_label(_("Enable folder navigation"));
00347     g_signal_connect(G_OBJECT(g_sd_card_check),
00348         "toggled",
00349         G_CALLBACK(on_sd_card_changed),
00350         NULL);
00351     gtk_box_pack_start(GTK_BOX(top_level_vbox), g_sd_card_check, FALSE, FALSE, 0);
00352 
00353     return top_level_vbox;
00354 }

Here is the call graph for this function:

Here is the caller graph for this function:

static GtkWidget * create_thumbnail_widgets ( GtkBox *  parent  )  [static]

Definition at line 361 of file advanced.c.

References description_create(), g_thumbnail_check, ITEM_SPACING, on_thumbnail_changed(), and subject_create().

Referenced by create_advanced_window().

00362 {
00363     // Top level vbox.
00364     GtkWidget* top_level_vbox = gtk_vbox_new(FALSE, ITEM_SPACING);
00365     gtk_box_pack_start(parent, top_level_vbox, FALSE, FALSE, 0);
00366 
00367     // Subject
00368     GtkWidget* subject = subject_create();
00369     gtk_label_set_label(GTK_LABEL(subject),
00370         _("Automatic Thumbnail Generation"));
00371     gtk_box_pack_start(GTK_BOX(top_level_vbox), subject, FALSE, FALSE, 0);
00372 
00373     // Description
00374     GtkWidget* desc = description_create();
00375     gtk_label_set_label(GTK_LABEL(desc),
00376         _("Allow automatic thumbnail generation to occur while indexing content. "
00377           "Indexing will become slower when this option is enabled."));    
00378     gtk_box_pack_start(GTK_BOX(top_level_vbox), desc, FALSE, FALSE, 0);
00379 
00380     // The check button
00381     g_thumbnail_check = gtk_check_button_new_with_label(_("Enable thumbnail generation"));
00382     g_signal_connect(G_OBJECT(g_thumbnail_check),
00383         "toggled",
00384         G_CALLBACK(on_thumbnail_changed),
00385         NULL);
00386     gtk_box_pack_start(GTK_BOX(top_level_vbox), g_thumbnail_check, FALSE, FALSE, 0);
00387 
00388     return top_level_vbox;
00389 }

Here is the call graph for this function:

Here is the caller graph for this function:

static GtkWidget * create_zooming_widgets ( GtkBox *  parent  )  [static]

Definition at line 256 of file advanced.c.

References description_create(), g_zooming_check, ITEM_SPACING, on_zooming_changed(), and subject_create().

Referenced by create_advanced_window().

00257 {
00258     // Top level vbox.
00259     GtkWidget* top_level_vbox = gtk_vbox_new(FALSE, ITEM_SPACING);
00260     gtk_box_pack_start(parent, top_level_vbox, FALSE, FALSE, 0);
00261 
00262     // Subject
00263     GtkWidget* subject = subject_create();
00264     gtk_label_set_label(GTK_LABEL(subject),
00265         _("PDF Document Zoom"));
00266     gtk_box_pack_start(GTK_BOX(top_level_vbox), subject, FALSE, FALSE, 0);
00267 
00268     // Description
00269     GtkWidget* desc = description_create();
00270     gtk_label_set_label(GTK_LABEL(desc),
00271         _("Enable custom zoom for PDF documents as well as the ability to pan the viewport of a zoomed-in page. "
00272           "Zooming is not available in reflowable document formats such as EPUB, TXT, and PDB."));
00273     gtk_box_pack_start(GTK_BOX(top_level_vbox), desc, FALSE, FALSE, 0);
00274 
00275     // The check button
00276     g_zooming_check = gtk_check_button_new_with_label(_("Enable zoom"));
00277     g_signal_connect(G_OBJECT(g_zooming_check),
00278         "toggled",
00279         G_CALLBACK(on_zooming_changed),
00280         NULL);
00281     gtk_box_pack_start(GTK_BOX(top_level_vbox), g_zooming_check, FALSE, FALSE, 0);
00282 
00283     return top_level_vbox;
00284 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void init_widgets_with_settings ( void   )  [static]

Definition at line 414 of file advanced.c.

References AdvancedSettings::enable_scribble, AdvancedSettings::enable_sd_card, AdvancedSettings::enable_zooming, g_scribble_check, g_sd_card_check, g_thumbnail_check, g_zooming_check, and AdvancedSettings::index_with_thumbnails.

Referenced by create_advanced_window().

00415 {
00416     gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(g_zooming_check),
00417                                   g_current_settings.enable_zooming  );
00418 
00419     gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(g_scribble_check),
00420                                   g_current_settings.enable_scribble  );
00421 
00422     gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(g_sd_card_check),
00423                                   g_current_settings.enable_sd_card  );
00424 
00425     gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(g_thumbnail_check),
00426                                   g_current_settings.index_with_thumbnails  );
00427 }

Here is the caller graph for this function:

void load_advanced_settings (  ) 
static gboolean on_focus_in ( GtkWidget *  widget,
gpointer  data 
) [static]

Definition at line 203 of file advanced.c.

References ERGTK_LIST_VIEW, and ergtk_list_view_set_cursor().

Referenced by create_advanced_window().

00204 {
00205     g_assert(widget != NULL ) ;
00206     ergtk_list_view_set_cursor( ERGTK_LIST_VIEW(widget), 0); // row = 0;
00207     return FALSE;
00208 }

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean on_focus_out ( GtkWidget *  widget,
gpointer  data 
) [static]

Definition at line 210 of file advanced.c.

Referenced by create_advanced_window().

00211 {
00212     g_assert(widget != NULL ) ;
00213     GtkTreeSelection* my_selection = gtk_tree_view_get_selection((GtkTreeView*) widget);
00214     g_assert( my_selection != NULL ) ;
00215     gtk_tree_selection_unselect_all(my_selection);
00216     return FALSE;
00217 }

Here is the caller graph for this function:

static void on_listview_navigate_cursor ( erGtkListView er_listview,
erGtkListViewKeyPress  keycode,
gpointer  user_data 
) [static]

Definition at line 229 of file advanced.c.

References ERGTK_LIST_VIEW_PRESS_LONG_DOWN, ERGTK_LIST_VIEW_PRESS_SHORT_DOWN, g_zooming_check, and LOGPRINTF.

Referenced by create_advanced_window().

00232 {
00233     GtkTreeSelection* my_selection = gtk_tree_view_get_selection((GtkTreeView*) er_listview);
00234     g_assert( my_selection != NULL ) ;
00235 
00236     // determine new cursor position
00237     switch (keycode)
00238     {
00239         case ERGTK_LIST_VIEW_PRESS_SHORT_DOWN:
00240         case ERGTK_LIST_VIEW_PRESS_LONG_DOWN:
00241             gtk_widget_grab_focus(GTK_WIDGET(g_zooming_check)); // down: to first widget
00242             gtk_tree_selection_unselect_all(my_selection);
00243             break;
00244         default:
00245             LOGPRINTF("illegal erGtkListViewKeyPress [%d]", keycode);
00246             ;  // ignore
00247             break;
00248     }
00249 }

Here is the caller graph for this function:

static void on_listview_row_activated ( GtkTreeView *  view,
GtkTreePath *  path,
GtkTreeViewColumn *  column,
gpointer  user_data 
) [static]

Definition at line 219 of file advanced.c.

References main_quit(), and save_advanced_settings().

Referenced by create_advanced_window().

00223 {
00224     save_advanced_settings();
00225     main_quit();
00226     return;
00227 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void on_scribble_changed ( GtkWidget *  widget,
gpointer  data 
) [static]

Definition at line 398 of file advanced.c.

References AdvancedSettings::enable_scribble.

Referenced by create_scribble_widgets().

00399 {
00400     g_current_settings.enable_scribble = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
00401 }

Here is the caller graph for this function:

static void on_sd_card_changed ( GtkWidget *  widget,
gpointer  data 
) [static]

Definition at line 403 of file advanced.c.

References AdvancedSettings::enable_sd_card.

Referenced by create_sd_card_widgets().

00404 {
00405     g_current_settings.enable_sd_card = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
00406 }

Here is the caller graph for this function:

static void on_thumbnail_changed ( GtkWidget *  widget,
gpointer  data 
) [static]

Definition at line 408 of file advanced.c.

References AdvancedSettings::index_with_thumbnails.

Referenced by create_thumbnail_widgets().

00409 {
00410     g_current_settings.index_with_thumbnails = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
00411 }

Here is the caller graph for this function:

static void on_zooming_changed ( GtkWidget *  widget,
gpointer  data 
) [static]

Definition at line 393 of file advanced.c.

References AdvancedSettings::enable_zooming.

Referenced by create_zooming_widgets().

00394 {
00395     g_current_settings.enable_zooming = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
00396 }

Here is the caller graph for this function:

void save_advanced_settings (  ) 

Variable Documentation

GtkWidget* g_advanced_settings_window = NULL [static]

Definition at line 73 of file advanced.c.

Referenced by create_advanced_window().

Definition at line 71 of file advanced.c.

Definition at line 70 of file advanced.c.

GtkWidget* g_scribble_check = NULL [static]

Definition at line 75 of file advanced.c.

Referenced by create_scribble_widgets(), and init_widgets_with_settings().

GtkWidget* g_sd_card_check = NULL [static]

Definition at line 76 of file advanced.c.

Referenced by create_sd_card_widgets(), and init_widgets_with_settings().

GtkWidget* g_thumbnail_check = NULL [static]

Definition at line 77 of file advanced.c.

Referenced by create_thumbnail_widgets(), and init_widgets_with_settings().

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