connectionMgr/src/connectScreen.c File Reference

connectionMgr - the entry of 'connect-to-server' screen containing a connectScreenOptions and a connectScreenProfiles screen handling and event processing More...

#include <unistd.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <liberipc/eripctoolbar.h>
#include "connectionMgrLog.h"
#include "displayStatus.h"
#include "connectionMgr.h"
#include "background.h"
#include "connectScreen.h"
#include "connectScreenOptions.h"
#include "connectScreenProfiles.h"
#include "connectScreenData.h"
#include "connectScan.h"
#include "connectPing.h"
#include "connectBackground.h"
#include "pagebar.h"
#include "erbusy.h"
#include "toolbar.h"

Go to the source code of this file.

Functions

static void on_connect_switch_page (GtkNotebook *notebook, GtkNotebookPage *new_page, guint page_num, gpointer data)
static void connect_show_back (void)
static void connect_show_keyboard (void)
static void connect_show_trashcan (void)
GtkWidget * connect_screen_create (void)
void connect_screen_display (void)
void connect_screen_set_text (void)
void connect_set_pagebar (void)
void connect_set_toolbar (void)
gint connect_get_current_page (gint *pagecount)
gboolean on_connect_keypress (GdkEventKey *event)
void connect_goto_page (connectScreen_t newpage)
void on_connect_goto_page (gint newpage)
void on_connect_icon_clicked (int iconID, int iconState)

Variables

static GtkWidget * g_connect_notebook = NULL


Detailed Description

connectionMgr - the entry of 'connect-to-server' screen containing a connectScreenOptions and a connectScreenProfiles screen handling and event processing

Copyright (C) 2007 iRex Technologies BV.

Definition in file connectScreen.c.


Function Documentation

gint connect_get_current_page ( gint *  pagecount  ) 

Definition at line 214 of file connectScreen.c.

00215 {
00216     GtkNotebook *notebook = GTK_NOTEBOOK(g_connect_notebook);
00217 
00218     // get number of pages, when requested.
00219     if (pagecount != NULL)
00220     {
00221         *pagecount = gtk_notebook_get_n_pages(notebook);
00222     }
00223 
00224     // return current page number, counting from 0.
00225     return gtk_notebook_get_current_page(notebook);
00226 }

void connect_goto_page ( connectScreen_t  newpage  ) 

Definition at line 252 of file connectScreen.c.

00253 {
00254     GtkNotebook *notebook;
00255     gint curpage, pagecount;
00256 
00257     curpage = connect_get_current_page(&pagecount);
00258     if (curpage != newpage)
00259     {
00260         if (newpage >= 0 && newpage < pagecount)
00261         {
00262             CN_LOGPRINTF ("curpage %d-->newpage %d, pagecount %d", 
00263                            curpage, newpage, pagecount);
00264             notebook = GTK_NOTEBOOK(g_connect_notebook);
00265             gtk_notebook_set_current_page(notebook, newpage);
00266         }
00267     }
00268 }

Here is the call graph for this function:

GtkWidget* connect_screen_create ( void   ) 

Definition at line 74 of file connectScreen.c.

00075 {
00076     CN_LOGPRINTF ("entry");
00077 
00078     GtkWidget *alignment;
00079     GtkWidget *page;
00080     
00081     // alignment
00082     alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
00083     gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 
00084             0, 0, SCREEN_BORDER, 0);
00085     gtk_widget_show(alignment); 
00086 
00087     // connect_notebook
00088     g_connect_notebook = gtk_notebook_new ();
00089     gtk_notebook_set_show_tabs (GTK_NOTEBOOK (g_connect_notebook), FALSE);
00090     gtk_notebook_set_show_border (GTK_NOTEBOOK (g_connect_notebook), FALSE);
00091     gtk_container_add (GTK_CONTAINER (alignment), g_connect_notebook);
00092 
00093     // page: connect-screen-options
00094     page = connect_options_create ();
00095     gtk_notebook_append_page(GTK_NOTEBOOK (g_connect_notebook), page, NULL);
00096 
00097     // page: connect-screen profiles
00098     page = connect_profiles_create ();
00099     gtk_notebook_append_page(GTK_NOTEBOOK(g_connect_notebook), page, NULL);
00100 
00101     // notebook pages start counting from zero
00102     gtk_notebook_set_current_page (GTK_NOTEBOOK(g_connect_notebook), 0);
00103     gtk_widget_show (g_connect_notebook);
00104 
00105     g_signal_connect_after(g_connect_notebook, "switch-page",  
00106                     G_CALLBACK (on_connect_switch_page), NULL);
00107 
00108     return alignment;
00109 }

Here is the call graph for this function:

void connect_screen_display ( void   ) 

Definition at line 111 of file connectScreen.c.

00112 {
00113     int page;
00114 
00115     CN_LOGPRINTF ("entry");
00116 
00117     page = connect_get_current_page(NULL);
00118     if (page == connectScreenOptions_e)
00119     {
00120         connect_options_display();
00121     }
00122     else if (page == connectScreenProfiles_e)
00123     {
00124         connect_profiles_display();
00125     }
00126 }

Here is the call graph for this function:

void connect_screen_set_text ( void   ) 

Definition at line 129 of file connectScreen.c.

00130 {
00131     CN_LOGPRINTF ("entry");
00132 
00133     connect_options_set_text();
00134     connect_profiles_set_text();
00135 }

Here is the call graph for this function:

void connect_set_pagebar ( void   ) 

Definition at line 138 of file connectScreen.c.

00139 {
00140     CN_LOGPRINTF ("entry");
00141 
00142     //gint current_page;
00143     //gint page_num;
00144 
00145     if (!main_get_background ())
00146     {
00147         // a little overkill, 
00148         // but this ensures the pageBar always has the correct currentApp
00149         pagebar_reset ();
00150 
00151         // For connect screen only show one page.
00152         // This forces the user to navigate using the on-screen items
00153         pagebar_set_pagecount( 1 );
00154         pagebar_goto_page( 1 );
00155         pagebar_redraw();
00156     }
00157 }

Here is the call graph for this function:

void connect_set_toolbar ( void   ) 

Definition at line 159 of file connectScreen.c.

00160 {
00161     CN_LOGPRINTF("entry");
00162 
00163     connect_show_back();
00164     connect_show_keyboard();
00165     connect_show_trashcan();
00166 }

Here is the call graph for this function:

static void connect_show_back ( void   )  [static]

Definition at line 168 of file connectScreen.c.

00169 {
00170     screenPage_t curPage, backPage;
00171 
00172     CN_LOGPRINTF("entry");
00173 
00174     curPage.screen = cmgrScreenConnect_e;
00175     curPage.page = connect_get_current_page(NULL);
00176     
00177     cmgr_get_back_page(&curPage, &backPage);
00178 
00179     if ((backPage.screen == cmgrScreenUndef_e)
00180         || (backPage.page == -1))
00181     {
00182         toolbar_setIconState(iconID_back, iconState_grey);
00183     }
00184     else
00185     {
00186         toolbar_setIconState(iconID_back, iconState_normal);
00187     }
00188 }

Here is the call graph for this function:

static void connect_show_keyboard ( void   )  [static]

Definition at line 190 of file connectScreen.c.

00191 {
00192     CN_LOGPRINTF("entry");
00193     show_keyboard(FALSE);
00194 }

Here is the call graph for this function:

static void connect_show_trashcan ( void   )  [static]

Definition at line 196 of file connectScreen.c.

00197 {
00198     CN_LOGPRINTF("entry");
00199     toolbar_setIconState(iconID_trashcan, iconState_grey);
00200 }

Here is the call graph for this function:

void on_connect_goto_page ( gint  newpage  ) 

Definition at line 270 of file connectScreen.c.

00271 {
00272     CN_LOGPRINTF("entry newpage[%d]", newpage);
00273     connect_goto_page(newpage - 1);
00274 }

Here is the call graph for this function:

void on_connect_icon_clicked ( int  iconID,
int  iconState 
)

Definition at line 276 of file connectScreen.c.

00277 {
00278     int page;
00279 
00280     CN_LOGPRINTF("entry iconID[%d] iconState[%d]", iconID, iconState);
00281 
00282     switch (iconID)
00283     {
00284         case iconID_back:
00285             page = connect_get_current_page(NULL);
00286             if (page == connectScreenProfiles_e) 
00287             {
00288                 on_connect_profiles_icon_clicked(iconID, iconState);
00289             }
00290             break;
00291         default:
00292             break;
00293     }
00294 }

Here is the call graph for this function:

gboolean on_connect_keypress ( GdkEventKey *  event  ) 

Definition at line 229 of file connectScreen.c.

00230 {
00231     guint ret = 0; // return FALSE => default gtk handling
00232     
00233     CN_LOGPRINTF ("entry");
00234   
00235     switch (connect_get_current_page(NULL))
00236     {
00237         case connectScreenOptions_e:
00238             ret = on_connect_options_keypress(event);
00239             break;
00240         case connectScreenProfiles_e:
00241             ret = on_connect_profiles_keypress(event);
00242             break;
00243         default:
00244             CN_ERRORPRINTF ("-- case default");
00245             erbusy_off ();
00246             break;
00247     }
00248 
00249     return ret;
00250 }

Here is the call graph for this function:

static void on_connect_switch_page ( GtkNotebook *  notebook,
GtkNotebookPage *  new_page,
guint  page_num,
gpointer  data 
) [static]

Definition at line 203 of file connectScreen.c.

00207 {
00208     CN_LOGPRINTF ("Entry, new_page [%d]", (int) page_num);
00209 
00210     connect_set_pagebar();
00211     connect_set_toolbar();
00212 }

Here is the call graph for this function:


Variable Documentation

GtkWidget* g_connect_notebook = NULL [static]

Definition at line 53 of file connectScreen.c.


Generated on Sun Dec 14 17:16:02 2008 by  doxygen 1.5.6