connectionMgr/inc/gtkProfileEntry.h File Reference

connectionMgr - the network-profile entry containing a button with profile name or SSID a icon showing the wireless signal quality a icon showing it's a profile with encryption a label showing the status a button to let user enter the profile editor More...

#include <gtk/gtk.h>
#include <glib.h>
#include "commonData.h"

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _GtkProfileEntry
struct  _GtkProfileEntryClass

Defines

#define PROFILE_ENTRY_WIDTH   666
#define PROFILE_ENTRY_HEIGHT   27
#define PROFILE_ENTRY_SPACING   20
#define PROFILE_ENTRY_NAME_BUTTON_WIDTH   310
#define PROFILE_ENTRY_NAME_BUTTON_HEIGHT   27
#define PROFILE_ENTRY_SIG_IMG_WIDTH   37
#define PROFILE_ENTRY_SIG_IMG_HEIGHT   27
#define PROFILE_ENTRY_ENCR_IMG_WIDTH   40
#define PROFILE_ENTRY_ENCR_IMG_HEIGHT   27
#define PROFILE_ENTRY_STATUS_WIDTH   (-1)
#define PROFILE_ENTRY_STATUS_HEIGHT   27
#define PROFILE_ENTRY_EDIT_BUTTON_WIDTH   130
#define PROFILE_ENTRY_EDIT_BUTTON_HEIGHT   27
#define GTK_PROFILE_ENTRY_TYPE   (gtk_profile_entry_get_type ())
#define GTK_PROFILE_ENTRY(obj)
#define GTK_PROFILE_ENTRY_CLASS(klass)
#define IS_GTK_PROFILE_ENTRY(obj)
#define IS_GTK_PROFILE_ENTRY_CLASS(klass)

Typedefs

typedef struct _GtkProfileEntry GtkProfileEntry
typedef struct
_GtkProfileEntryClass 
GtkProfileEntryClass

Functions

GtkWidget * gtk_profile_entry_new (void)
void gtk_profile_entry_display_settings (GtkProfileEntry *profileEntry, const networkProfile_t *settings, gchar *status)
void gtk_profile_entry_set_namebutton_text (GtkProfileEntry *profileEntry, gchar *nameText)
void gtk_profile_entry_set_signal_image (GtkProfileEntry *profileEntry, gint quality)
void gtk_profile_entry_set_status (GtkProfileEntry *profileEntry, gchar *statusText)
void gtk_profile_entry_set_status_flashing (GtkProfileEntry *profileEntry, gboolean flashing)
void gtk_profile_entry_set_editbutton_text (GtkProfileEntry *profileEntry, gchar *editText)
void gtk_profile_entry_show_encr_image (GtkProfileEntry *profileEntry, gboolean show)
void gtk_profile_entry_show_edit_button (GtkProfileEntry *profileEntry, gboolean show)
void gtk_profile_entry_set_buttons_active (GtkProfileEntry *profileEntry, gboolean nameActive, gboolean editActive)
GtkWidget * gtk_profile_entry_get_namebutton (GtkProfileEntry *profileEntry)
GtkWidget * gtk_profile_entry_get_editbutton (GtkProfileEntry *profileEntry)
GType gtk_profile_entry_get_type (void)


Detailed Description

connectionMgr - the network-profile entry containing a button with profile name or SSID a icon showing the wireless signal quality a icon showing it's a profile with encryption a label showing the status a button to let user enter the profile editor

Copyright (C) 2007 iRex Technologies BV.

Definition in file gtkProfileEntry.h.


Define Documentation

#define GTK_PROFILE_ENTRY ( obj   ) 

Value:

(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
                                GTK_PROFILE_ENTRY_TYPE, GtkProfileEntry))

Definition at line 58 of file gtkProfileEntry.h.

#define GTK_PROFILE_ENTRY_CLASS ( klass   ) 

Value:

(G_TYPE_CHECK_CLASS_CAST ((klass), \
                                        GTK_PROFILE_ENTRY_TYPE, \
                                        GtkProfileEntryClass))

Definition at line 60 of file gtkProfileEntry.h.

#define GTK_PROFILE_ENTRY_TYPE   (gtk_profile_entry_get_type ())

Definition at line 57 of file gtkProfileEntry.h.

#define IS_GTK_PROFILE_ENTRY ( obj   ) 

Value:

(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
                                   GTK_PROFILE_ENTRY_TYPE))

Definition at line 63 of file gtkProfileEntry.h.

#define IS_GTK_PROFILE_ENTRY_CLASS ( klass   ) 

Value:

(G_TYPE_CHECK_CLASS_TYPE ((klass), \
                                           GTK_PROFILE_ENTRY_TYPE))

Definition at line 65 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_EDIT_BUTTON_HEIGHT   27

Definition at line 55 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_EDIT_BUTTON_WIDTH   130

Definition at line 54 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_ENCR_IMG_HEIGHT   27

Definition at line 49 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_ENCR_IMG_WIDTH   40

Definition at line 48 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_HEIGHT   27

Definition at line 38 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_NAME_BUTTON_HEIGHT   27

Definition at line 43 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_NAME_BUTTON_WIDTH   310

Definition at line 42 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_SIG_IMG_HEIGHT   27

Definition at line 46 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_SIG_IMG_WIDTH   37

Definition at line 45 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_SPACING   20

Definition at line 40 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_STATUS_HEIGHT   27

Definition at line 52 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_STATUS_WIDTH   (-1)

Definition at line 51 of file gtkProfileEntry.h.

#define PROFILE_ENTRY_WIDTH   666

Definition at line 37 of file gtkProfileEntry.h.


Typedef Documentation

Definition at line 68 of file gtkProfileEntry.h.

Definition at line 69 of file gtkProfileEntry.h.


Function Documentation

void gtk_profile_entry_display_settings ( GtkProfileEntry profileEntry,
const networkProfile_t settings,
gchar *  status 
)

Definition at line 209 of file gtkProfileEntry.c.

00211 {
00212     CN_LOGPRINTF("entry [%p][%p][%s]", profileEntry, settings, status);
00213 
00214     int                 nActiveIndex;
00215     regNetworkProfile_t *pRegSettings = NULL;
00216     network_spec_t      *pScanSettings = NULL;
00217     char                *nwName;
00218     gboolean             encrypted;
00219 
00220     g_return_if_fail(IS_GTK_PROFILE_ENTRY(profileEntry));
00221 
00222     if (settings)
00223     {
00224         if ((settings->nRegProfiles > 0)
00225             && settings->regSettingsList
00226             && ((settings->nActiveIndex >= 0) 
00227                 && (settings->nActiveIndex < settings->nRegProfiles)))
00228         {
00229             nActiveIndex = settings->nActiveIndex;
00230             pRegSettings = settings->regSettingsList[nActiveIndex];
00231         }
00232         pScanSettings = settings->scanSettings;
00233     }
00234     
00235     if (pRegSettings)
00236     {
00237         nwName = pRegSettings->name;
00238     }
00239     else if (pScanSettings)
00240     {
00241         nwName = pScanSettings->ssid;
00242     }
00243     else
00244     {
00245         nwName = NULL;
00246     }
00247 
00248     if ((nwName == NULL) || (nwName[0] == '\0'))
00249     {
00250         gtk_profile_entry_set_namebutton_text(profileEntry, "");
00251         gtk_profile_entry_set_status(profileEntry, "");
00252     }
00253     else
00254     {
00255         // network name
00256         gtk_profile_entry_set_namebutton_text(profileEntry, nwName);
00257 
00258         // signal images
00259         if (pScanSettings)
00260         {
00261             gtk_profile_entry_set_signal_image(profileEntry, 
00262                                                pScanSettings->quality);
00263         }
00264         else if (pRegSettings && pRegSettings->connection == wireless_t)
00265         {
00266             gtk_profile_entry_set_signal_image(profileEntry, 0);
00267         }
00268         else
00269         {
00270             gtk_profile_entry_hide_signal_image(profileEntry);
00271         }
00272        
00273         // encryption image
00274         if (pScanSettings && (pScanSettings->encryption != encr_none_t))
00275         {
00276             encrypted = TRUE;
00277         }
00278         else if (pRegSettings 
00279                  && pRegSettings->wirelessSettings
00280                  && pRegSettings->wirelessSettings->encrType != encr_none_t)
00281         {
00282             encrypted = TRUE;
00283         }
00284         else
00285         {
00286             encrypted = FALSE;
00287         }
00288         
00289         gtk_profile_entry_show_encr_image(profileEntry, encrypted);
00290        
00291         // status
00292         gtk_profile_entry_set_status(profileEntry, status);
00293     }
00294 }

Here is the call graph for this function:

GtkWidget* gtk_profile_entry_get_editbutton ( GtkProfileEntry profileEntry  ) 

Definition at line 499 of file gtkProfileEntry.c.

00500 {
00501     CN_LOGPRINTF("entry");
00502     g_return_val_if_fail(IS_GTK_PROFILE_ENTRY(profileEntry), NULL);
00503     return profileEntry->editButton;
00504 }

GtkWidget* gtk_profile_entry_get_namebutton ( GtkProfileEntry profileEntry  ) 

Definition at line 492 of file gtkProfileEntry.c.

00493 {
00494     CN_LOGPRINTF("entry");
00495     g_return_val_if_fail(IS_GTK_PROFILE_ENTRY(profileEntry), NULL);
00496     return profileEntry->nameButton;
00497 }

GType gtk_profile_entry_get_type ( void   ) 

Definition at line 69 of file gtkProfileEntry.c.

00070 {
00071     static GType profile_entry_type = 0;
00072 
00073     if (!profile_entry_type)
00074     {
00075         static const GTypeInfo  profile_entry_info = 
00076         {
00077             sizeof(GtkProfileEntryClass),  /* class_size */
00078             NULL,                          /* base_init */
00079             NULL,                          /* base_finalize */
00080             (GClassInitFunc) gtk_profile_entry_class_init,/* class_init */
00081             NULL,                          /* class_finalize */
00082             NULL,                          /* class_data */
00083             sizeof(GtkProfileEntry),       /* instance_size */
00084             0,                             /* n_preallocs */
00085             (GInstanceInitFunc) gtk_profile_entry_init,  /* instance_init */
00086             0                              /* value_table */
00087         };
00088         profile_entry_type = g_type_register_static(GTK_TYPE_EVENT_BOX, 
00089                                                     "ProfileEntry", 
00090                                                     &profile_entry_info, 
00091                                                     0);
00092     }
00093 
00094     return profile_entry_type;
00095 }

Here is the call graph for this function:

GtkWidget* gtk_profile_entry_new ( void   ) 

Definition at line 52 of file gtkProfileEntry.c.

00053 {
00054     GtkProfileEntry *profileEntry;
00055 
00056     profileEntry = (GtkProfileEntry *) g_object_new(GTK_PROFILE_ENTRY_TYPE, NULL);
00057 
00058     gtk_widget_show_all(profileEntry->clientArea);
00059     gdk_flush();
00060 
00061     gtk_profile_entry_hide_signal_image(profileEntry);
00062     gtk_widget_hide(profileEntry->encrImage);
00063     gtk_widget_hide(profileEntry->editButton);
00064 
00065     return GTK_WIDGET(profileEntry);
00066 }

Here is the call graph for this function:

void gtk_profile_entry_set_buttons_active ( GtkProfileEntry profileEntry,
gboolean  nameActive,
gboolean  editActive 
)

Definition at line 389 of file gtkProfileEntry.c.

00392 {
00393     GtkToggleButton *button;
00394 
00395     CN_LOGPRINTF("entry nameActive[%d]editActive[%d]", 
00396                   nameActive, editActive);
00397 
00398     g_return_if_fail(IS_GTK_PROFILE_ENTRY(profileEntry));
00399 
00400     button = GTK_TOGGLE_BUTTON(profileEntry->nameButton);
00401     gtk_toggle_button_set_active(button, nameActive);
00402 
00403     button = GTK_TOGGLE_BUTTON(profileEntry->editButton);
00404     gtk_toggle_button_set_active(button, editActive);
00405 }

void gtk_profile_entry_set_editbutton_text ( GtkProfileEntry profileEntry,
gchar *  editText 
)

Definition at line 376 of file gtkProfileEntry.c.

00378 {
00379     g_return_if_fail(IS_GTK_PROFILE_ENTRY(profileEntry));
00380 
00381     if (editText)
00382     {
00383         CN_LOGPRINTF("edit: [%s]", editText);
00384         gtk_button_set_label(GTK_BUTTON(profileEntry->editButton), 
00385                              editText);
00386     }
00387 }

void gtk_profile_entry_set_namebutton_text ( GtkProfileEntry profileEntry,
gchar *  nameText 
)

Definition at line 297 of file gtkProfileEntry.c.

00299 {
00300     g_return_if_fail(IS_GTK_PROFILE_ENTRY(profileEntry));
00301 
00302     if (nameText)
00303     {
00304         CN_LOGPRINTF("name: [%s]", nameText);
00305         gtk_button_set_label(GTK_BUTTON(profileEntry->nameButton), 
00306                              nameText);
00307     }
00308 }

void gtk_profile_entry_set_signal_image ( GtkProfileEntry profileEntry,
gint  quality 
)

Definition at line 310 of file gtkProfileEntry.c.

00312 {
00313     g_return_if_fail(IS_GTK_PROFILE_ENTRY(profileEntry));
00314     g_return_if_fail((quality >= 0) && (quality <= 100));
00315 
00316     CN_LOGPRINTF("quality: [%d]", quality);
00317 
00318     // hide all signal images firstly
00319     gtk_profile_entry_hide_signal_image(profileEntry);
00320 
00321     // show one correct signal image secondly
00322     if (quality <= 0)
00323     {
00324         gtk_widget_show(profileEntry->sigImage[0]);
00325     }
00326     else if (quality <= 25)
00327     {
00328         gtk_widget_show(profileEntry->sigImage[1]);
00329     }
00330     else if (quality <= 50)
00331     {
00332         gtk_widget_show(profileEntry->sigImage[2]);
00333     }
00334     else if (quality <= 75)
00335     {
00336         gtk_widget_show(profileEntry->sigImage[3]);
00337     }
00338     else
00339     {
00340         gtk_widget_show(profileEntry->sigImage[4]);
00341     }
00342 }

Here is the call graph for this function:

void gtk_profile_entry_set_status ( GtkProfileEntry profileEntry,
gchar *  statusText 
)

Definition at line 345 of file gtkProfileEntry.c.

00347 {
00348     g_return_if_fail(IS_GTK_PROFILE_ENTRY(profileEntry));
00349 
00350     if (statusText)
00351     {
00352         CN_LOGPRINTF("status: [%s]", statusText);
00353         gtk_label_set_text(GTK_LABEL(profileEntry->status), statusText);
00354         gtk_profile_entry_set_status_flashing(profileEntry, FALSE);
00355     }
00356 }

Here is the call graph for this function:

void gtk_profile_entry_set_status_flashing ( GtkProfileEntry profileEntry,
gboolean  flashing 
)

Definition at line 358 of file gtkProfileEntry.c.

00360 {
00361     g_return_if_fail(IS_GTK_PROFILE_ENTRY(profileEntry));
00362 
00363     CN_LOGPRINTF("flashing: [%d]", flashing);
00364 
00365     gtk_widget_set_state(GTK_WIDGET(profileEntry->status), 
00366                          GTK_STATE_NORMAL);
00367 
00368     if (flashing == TRUE && profileEntry->statusFlashing == FALSE)
00369     {
00370         g_timeout_add(1100, on_flash_status, profileEntry);
00371     }
00372     profileEntry->statusFlashing = flashing;
00373 }

Here is the call graph for this function:

void gtk_profile_entry_show_edit_button ( GtkProfileEntry profileEntry,
gboolean  show 
)

Definition at line 437 of file gtkProfileEntry.c.

00439 {
00440     CN_LOGPRINTF("entry show[%d]", show);
00441 
00442     g_return_if_fail(IS_GTK_PROFILE_ENTRY(profileEntry));
00443 
00444     if (show)
00445     {
00446         gtk_widget_show(profileEntry->editButton);
00447     }
00448     else
00449     {
00450         gtk_widget_hide(profileEntry->editButton);
00451     }
00452 }

void gtk_profile_entry_show_encr_image ( GtkProfileEntry profileEntry,
gboolean  show 
)

Definition at line 420 of file gtkProfileEntry.c.

00422 {
00423     CN_LOGPRINTF("entry show[%d]", show);
00424 
00425     g_return_if_fail(IS_GTK_PROFILE_ENTRY(profileEntry));
00426 
00427     if (show)
00428     {
00429         gtk_widget_show(profileEntry->encrImage);
00430     }
00431     else
00432     {
00433         gtk_widget_hide(profileEntry->encrImage);
00434     }
00435 }


Generated on Sun Dec 14 17:15:46 2008 by  doxygen 1.5.6