margins.h File Reference

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

Go to the source code of this file.

Functions

GtkWidget * create_margins_window (GtkWidget *parent)
void load_margins_settings ()
void save_margins_settings ()

Function Documentation

GtkWidget* create_margins_window ( GtkWidget *  parent  ) 

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

Definition at line 120 of file margins.c.

References create_margin_widgets(), create_settingsview(), create_title(), g_margin_radios, init_widgets_with_settings(), LOGPRINTF, on_focus_in(), on_focus_out(), on_listview_navigate_cursor(), on_listview_row_activated(), SMALL_SPACING, WINDOW_BORDER_PADDING, WINDOW_BOTTOM_PADDING, WINDOW_H_PADDING, and WINDOW_TOP_ALT_PADDING.

Referenced by create_concrete_win().

00121 {
00122     LOGPRINTF("entry");
00123 
00124     bzero(g_margin_radios, 2);
00125 
00126     // create top window
00127     GtkWidget* top_window = parent;
00128     gtk_window_maximize(GTK_WINDOW(top_window));
00129     gtk_window_set_resizable(GTK_WINDOW(top_window), FALSE);
00130     gtk_container_set_border_width(GTK_CONTAINER(top_window),WINDOW_BORDER_PADDING  );
00131     gtk_window_set_modal(GTK_WINDOW(top_window), TRUE);
00132 
00133     // top level vbox (vboxtop)
00134     GtkWidget* vboxtop = gtk_vbox_new(FALSE, 3);
00135     gtk_container_add(GTK_CONTAINER(top_window), vboxtop);
00136 
00137     // add header container the title and subtitle of this settings page
00138     create_title(GTK_VBOX(vboxtop), _("Settings"), _("Page Margins"));
00139     
00140     // add the back/exit bar below the title 
00141     GtkWidget* view = create_settingsview();
00142     gtk_box_pack_start(GTK_BOX(vboxtop), view, FALSE, FALSE,0 ); 
00143     g_signal_connect(view, "row-activated", G_CALLBACK(on_listview_row_activated), NULL ) ;
00144     g_signal_connect(view, "navigate-cursor", G_CALLBACK(on_listview_navigate_cursor), NULL ) ;
00145     g_signal_connect(view, "focus-in-event", G_CALLBACK(on_focus_in), NULL );
00146     g_signal_connect(view, "focus-out-event", G_CALLBACK(on_focus_out), NULL );
00147 
00148     // add an alignment below the exit bar
00149     GtkWidget* alignment = gtk_alignment_new(0, 0, 1.0, 0.0);
00150     gtk_container_add(GTK_CONTAINER(vboxtop), alignment);
00151 
00152     // introdude a frame in the alignment
00153     GtkWidget* frame = gtk_frame_new(NULL);
00154     gtk_widget_set_name(frame, "irex-margins-frame");
00155     gtk_container_add(GTK_CONTAINER(alignment), frame);
00156     gtk_container_set_border_width(GTK_CONTAINER(frame), 3);
00157 
00158     // alignment in frame 
00159     GtkWidget* alignment2 = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
00160     gtk_container_add(GTK_CONTAINER(frame), alignment2);
00161     gtk_alignment_set_padding(GTK_ALIGNMENT(alignment2),
00162                               WINDOW_TOP_ALT_PADDING,
00163                               WINDOW_BOTTOM_PADDING,
00164                               WINDOW_H_PADDING,
00165                               WINDOW_H_PADDING);
00166    
00167     // vbox in alignment2
00168     GtkWidget* innervbox = gtk_vbox_new(FALSE, SMALL_SPACING);
00169     gtk_container_add(GTK_CONTAINER(alignment2), innervbox);
00170     
00171     // The margin settings section.
00172     create_margin_widgets(GTK_BOX(innervbox));
00173 
00174     // Update widget with current settings.
00175     init_widgets_with_settings();
00176 
00177     gtk_widget_grab_focus(view);
00178 
00179     gtk_widget_show_all(top_window);
00180     return top_window;
00181 }

Here is the call graph for this function:

Here is the caller graph for this function:

void load_margins_settings (  ) 

Definition at line 232 of file margins.c.

References DEFAULT_MARGIN, GCONF_PAGE_MARGINS, get_int_array(), LOGPRINTF, UdsSettings::margin_horizontal, and UdsSettings::margin_vertical.

Referenced by create_concrete_win().

00233 {
00234     int val;
00235     int margins[] = { DEFAULT_MARGIN,
00236                       DEFAULT_MARGIN,
00237                       DEFAULT_MARGIN,
00238                       DEFAULT_MARGIN };
00239     GArray *values = NULL;
00240     
00241     LOGPRINTF("entry");
00242 
00243     values = get_int_array(GCONF_PAGE_MARGINS);
00244     if (values && values->len > 0)
00245     {
00246         unsigned int i;
00247         for ( i = 0 ;
00248               i < sizeof(margins)/sizeof(margins[0])  &&  i < values->len ;
00249               i++ )
00250         {
00251             val = g_array_index(values, int, i);
00252             if (val >= 0)
00253             {
00254                 // valid margin setting
00255                 margins[i] = val;
00256             }
00257         }
00258     }
00259 
00260     // Note: gconf margin left   -> use as horizontal margin
00261     //       gconf margin right  -> ignore (for now)
00262     //       gconf margin top    -> use as vertical margin
00263     //       gconf margin bottom -> ignore (for now)
00264     g_orig_uds_settings.margin_horizontal = margins[0];
00265     g_orig_uds_settings.margin_vertical   = margins[2];
00266 
00267     g_cur_uds_settings = g_orig_uds_settings;
00268 
00269     // clean up
00270     if (values) { g_array_free(values, TRUE); }
00271 }

Here is the call graph for this function:

Here is the caller graph for this function:

void save_margins_settings (  ) 

Definition at line 274 of file margins.c.

References GCONF_PAGE_MARGINS, LOGPRINTF, UdsSettings::margin_horizontal, UdsSettings::margin_vertical, and set_int_array().

Referenced by on_listview_row_activated().

00275 {
00276     GArray *values = NULL;
00277     
00278     LOGPRINTF("entry");
00279 
00280     if (   g_cur_uds_settings.margin_horizontal != g_orig_uds_settings.margin_horizontal
00281         || g_cur_uds_settings.margin_vertical   != g_orig_uds_settings.margin_vertical  )
00282     {
00283         values = g_array_new(FALSE, FALSE, sizeof(int));
00284         g_array_append_val(values, g_cur_uds_settings.margin_horizontal);  // left
00285         g_array_append_val(values, g_cur_uds_settings.margin_horizontal);  // right
00286         g_array_append_val(values, g_cur_uds_settings.margin_vertical);    // top
00287         g_array_append_val(values, g_cur_uds_settings.margin_vertical);    // bottom
00288 
00289         set_int_array(GCONF_PAGE_MARGINS, values);
00290         g_orig_uds_settings =  g_cur_uds_settings;
00291     }
00292 
00293     LOGPRINTF("Saving margin settings, done.");
00294 
00295     // clean up
00296     if (values) { g_array_free(values, TRUE); }
00297 }

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  doxygen 1.6.2-20100208