mainProject.c File Reference

mainProject.c generates the GUI using which the events can be added,edited and suitably deleted and also writes them into a database. More...

#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <mysql/mysql.h>
#include <string.h>
#include <gtk/gtk.h>

Go to the source code of this file.

Data Structures

struct  date

Enumerations

enum  { COL_FIRST = 0, COL_SECOND, COL_THIRD }

Functions

void week_calc (date tp, char d[5])
 week_calc return the day of a week for a given date
static GtkWidget * create_view_and_model ()
 create_view_and_model creates a model for the list structure
void display_row ()
 display_row displays the result set returned by Select Command
void ret_one_day_less (char dat[15], char dt_register[15])
 ret_one_day_less subtracts one day from a given date and returns the new date
void create_connection ()
 create_connection creates a database connection with the background database used(MYSQL) void
static GtkTreeModel * create_and_fill_model ()
 create_and_fill_model populates the list structure created by create_view_and_model
void box_remove (GtkWidget *btn, GtkBox *box)
 box_remove is a function to refresh screen,delete all extra widgets barring the widget pointed by *btn
void display_dialog (char msg[])
 display_dialog displays a dialog box with a Custom message
void grab_int_value_hour (GtkSpinButton *a_spinner, gpointer user_data)
 grab_int_value_hour is the handler for Spinner buttons used,it grabs the "Hour" value of time
void grab_int_value_min (GtkSpinButton *a_spinner, gpointer user_data)
 grab_int_value_min is the handler for Spinner buttons used,it grabs the "Min" value of time
GtkWidget * create_integer_spin_button_hours (void)
 create_integer_spin_button_hours creates the Spinner buttons for "Hours"
GtkWidget * create_integer_spin_button_mins (void)
 create_integer_spin_button_mins creates the Spinner buttons for "Mins"
void cb_changed_dd (GtkComboBox *combo, gpointer data)
 cb_changed_dd is the handler for the Day combobox,retrieves the "Day" selected from the Combobox
void cb_changed_mm (GtkComboBox *combo, gpointer data)
 cb_changed_mm is the handler for the Month combobox,retrieves the "Month" selected from the Combobox
void cb_changed_yy (GtkComboBox *combo, gpointer data)
 cb_changed_yy is the handler for the Year combobox,retrieves the "Year" selected from the Combobox
void cb_changed_AM_PM (GtkComboBox *combo, gpointer data)
 cb_changed_AM_PM is the handler for the Year combobox,retrieves the "AM/PM type" selected from the Combobox
GtkWidget * create_combobox_days (void)
 create_combobox_days creates the combobox for rendering days.
GtkWidget * create_combobox_months (void)
 create_combobox_months creates the combobox for rendering Months
GtkWidget * create_combobox_years (void)
 create_combobox_years creates the combobox for rendering Year.
GtkWidget * create_combobox_AM_PM (void)
 create_combobox_AM_PM creates the combobox for rendering AM/PM.
gint delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
 delete_event is the callback that quits the Calendar
gint delete_event_master (GtkWidget *widget, GdkEvent *event, gpointer data)
 delete_event_master quits the master menu form
void callback (GtkWidget *widget, gpointer data)
 callback for the radio button,sets the flag indicating which radio button is pressed.
char * convert_to_num (char month[])
 convert_to_num converts "month" to standard numeral format(a preceding 0 before a single digit number)
void match_answer (GtkWidget *widget, gpointer data)
 match_answer is the caller function, when add/update button is pressed
GtkWidget * create_dialog_box (char message[20])
 create_dialog_box creates the 'add event' form
void view_onRowActivated (GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *col, gpointer userdata)
 view_onRowActivated is the caller function called when a row on the list structure is clicked
static void menuitem_response (gchar *string)
 menuitem_response prints a string when a menu item is selected
void create_master_form ()
 create _master_form creates the main form (renders main menu)
gint calendar_day_double_clicked (GtkCalendar *cal, gpointer data)
 calendar_day_double_clicked is the handler function called when a date on the calendar is double clicked
int main (int argc, char *argv[])
 main function where the program starts working

Variables

char answer [10]
gint temp
int radio_flag = 0
int parent_flag = 0
int update_add = 0
int del_form = 0
int show_all = 0
GtkWidget * vbox
GtkWidget * menu_bar
int pid = 0
MYSQL * connection1
MYSQL_RES * result
MYSQL_ROW sqlrow
MYSQL_ROW sqlrow1
int check_flag = 0
int a = 0
int b = 0
int day1
int month1
int year1
int combo_cnt = 0
int g_hour = 0
int g_min = 0
int g_once = 0
int g_daily = 0
int g_weekly = 0
int g_monthly = 0
int g_yearly = 0
int id = 0
int month_init = 0
int year_init = 0
const gchar * g_event
gchar * g_dd
gchar * g_mm
gchar * g_yy
gchar * g_am_pm
GtkWidget * disp
GtkWidget * window1
GtkWidget * window
char str [50]
char curdate [50]
char eve [100]
char g_event_upd [100]
char yy_upd [6]
char mm_upd [6]
char dd_upd [6]
char * months []

Detailed Description

mainProject.c generates the GUI using which the events can be added,edited and suitably deleted and also writes them into a database.

Version:
1.0
Author:
Ankit Sharma, Rameez Meheboob

Definition in file mainProject.c.


Enumeration Type Documentation

anonymous enum
Enumerator:
COL_FIRST 
COL_SECOND 
COL_THIRD 

Definition at line 1122 of file mainProject.c.

01123 {
01124         COL_FIRST = 0,
01125         COL_SECOND,
01126     COL_THIRD
01127 } ;


Function Documentation

void box_remove ( GtkWidget *  btn,
GtkBox *  box 
)

box_remove is a function to refresh screen,delete all extra widgets barring the widget pointed by *btn

Returns:
void
Parameters:
btn is the widget that should not be deleted
box is a pointer to the vertical box used for widget alignment

Definition at line 370 of file mainProject.c.

Referenced by menuitem_response(), and view_onRowActivated().

00371 {     
00372     /* Remove all widgets in the Box*/      
00373     GtkWidget *widget=NULL;
00374     GtkBoxChild *child,*needed_box;
00375     GList *ptr=box->children;
00376     int len=g_list_length(box->children);
00377     int i=0;
00378     g_assert(btn!=NULL && box!=NULL);
00379     gtk_widget_freeze_child_notify (btn);
00380     if(len <= 1)
00381         return;
00382 
00383     for(i=0;i<len;i++,ptr=ptr->next)
00384     {
00385         child=(GtkBoxChild *)ptr->data;
00386         widget=child->widget;
00387         if(GTK_IS_LABEL(widget))
00388         {
00389         }
00390 
00391         if(widget!=btn && widget!=NULL)
00392         {
00393             gtk_widget_unparent(widget);
00394         }                     
00395         else
00396         {
00397             needed_box=child;
00398         }
00399     }
00400 
00401     gtk_widget_thaw_child_notify (btn);
00402     g_list_free(box->children);
00403     box->children=g_list_alloc();
00404     box->children->data=needed_box;
00405     gtk_container_check_resize(GTK_CONTAINER(box));
00406     len=g_list_length(box->children);
00407 }

gint calendar_day_double_clicked ( GtkCalendar *  cal,
gpointer  data 
)

calendar_day_double_clicked is the handler function called when a date on the calendar is double clicked

Returns:
TRUE on successs
Parameters:
cal is the the widget pointing to calendar.
data is the data sent to this callback function.

Definition at line 1649 of file mainProject.c.

References create_master_form(), curdate, day1, month1, month_init, parent_flag, year1, and year_init.

Referenced by main().

01650 {
01651     char message[20];
01652     guint day,month,year;
01653     char d[5],m[15],y[6];
01654     if(parent_flag==0)
01655     {
01656         gtk_calendar_get_date(cal,& year,& month,&day);
01657     
01658         month_init=month;
01659         year_init=year-1;
01660 
01661         sprintf(y,"%d",year);
01662 
01663         if(month+1==1)
01664             strcpy(m,"01");
01665         else if(month+1==2) 
01666             strcpy(m,"02");     
01667         else if(month+1==3)
01668             strcpy(m,"03"); 
01669         else if(month+1==4) 
01670             strcpy(m,"04");
01671         else if(month+1==5) 
01672             strcpy(m,"05");
01673         else if(month+1==6)
01674             strcpy(m,"06");
01675         else if(month+1==7)
01676             strcpy(m,"07");
01677         else if(month+1==8)
01678             strcpy(m,"08");
01679         else if(month+1==9)
01680             strcpy(m,"09");
01681         else 
01682             sprintf(m,"%d",month+1);
01683 
01684         if(day==1)
01685             strcpy(d,"01");
01686         else if(day==2)
01687             strcpy(d,"02");         
01688         else if(day==3) 
01689             strcpy(d,"03");
01690         else if(day==4) 
01691             strcpy(d,"04");
01692         else if(day==5) 
01693             strcpy(d,"05");
01694         else if(day==6)
01695             strcpy(d,"06");
01696         else if(day==7)
01697             strcpy(d,"07");
01698         else if(day==8)
01699             strcpy(d,"08");
01700         else if(day==9)
01701             strcpy(d,"09");
01702         else
01703             sprintf(d,"%d",day);
01704 
01705         int k=0,i=0;
01706         for(i=0;y[i];i++)
01707         {
01708             curdate[k]=y[i];
01709             k++;
01710         }
01711         curdate[k]='-';
01712         k++;
01713         for(i=0;m[i];i++)
01714         {
01715             curdate[k]=m[i];
01716             k++;
01717         }
01718         curdate[k]='-';
01719         k++;
01720         for(i=0;d[i];i++)
01721         {
01722             curdate[k]=d[i];
01723             k++;
01724         }
01725         curdate[k]='\0';    
01726 
01727         /*Setting Global Data*/
01728 
01729         day1=day;
01730         month1=month+1;
01731         year1=year;
01732 
01733         sprintf(message,"%d/%d/%d\n",day,month+1,year);
01734 
01735         parent_flag=1;
01736         create_master_form();
01737     }
01738 
01739     return TRUE;
01740 }

void callback ( GtkWidget *  widget,
gpointer  data 
)

callback for the radio button,sets the flag indicating which radio button is pressed.

Returns:
void
Parameters:
widget that points to the radio button
data is the data sent to this callback

Definition at line 685 of file mainProject.c.

References answer, and radio_flag.

Referenced by create_dialog_box().

00686 {
00687     strcpy(answer,data);
00688     if(strcmp(answer,"Once")==0)
00689     {
00690         radio_flag=1;
00691     }
00692     if(strcmp(answer,"Daily")==0)
00693     {
00694         radio_flag=2;
00695     }
00696     if(strcmp(answer,"Weekly")==0)
00697     {
00698         radio_flag=3;
00699     } 
00700     if(strcmp(answer,"Monthly")==0)
00701     {
00702         radio_flag=4;
00703     } 
00704     if(strcmp(answer,"Yearly")==0)
00705     {
00706         radio_flag=5;
00707     }
00708 }

void cb_changed_AM_PM ( GtkComboBox *  combo,
gpointer  data 
)

cb_changed_AM_PM is the handler for the Year combobox,retrieves the "AM/PM type" selected from the Combobox

Returns:
void
Parameters:
combo is the pointer to the combobox that renders AM/PM.
data is data sent to the function when the "Changed" signal is generated.

Definition at line 553 of file mainProject.c.

References g_am_pm.

Referenced by create_combobox_AM_PM().

00554 {
00555     gchar *string = gtk_combo_box_get_active_text(combo);
00556     g_am_pm=string;
00557 }

void cb_changed_dd ( GtkComboBox *  combo,
gpointer  data 
)

cb_changed_dd is the handler for the Day combobox,retrieves the "Day" selected from the Combobox

Returns:
void
Parameters:
combo is the pointer to the combobox that renders day.
data is data sent when the Changed signal is generated

Definition at line 517 of file mainProject.c.

References g_dd.

Referenced by create_combobox_days().

00518 {
00519     gchar *string = gtk_combo_box_get_active_text(combo);
00520     g_dd=string;
00521 }

void cb_changed_mm ( GtkComboBox *  combo,
gpointer  data 
)

cb_changed_mm is the handler for the Month combobox,retrieves the "Month" selected from the Combobox

Returns:
void
Parameters:
combo is the pointer to the combobox that renders Month.
data is data sent to the function when the "Changed" signal is generated

Definition at line 529 of file mainProject.c.

References g_mm.

Referenced by create_combobox_months().

00530 {
00531     gchar *string = gtk_combo_box_get_active_text(combo);
00532     g_mm=string;
00533 }

void cb_changed_yy ( GtkComboBox *  combo,
gpointer  data 
)

cb_changed_yy is the handler for the Year combobox,retrieves the "Year" selected from the Combobox

Returns:
void
Parameters:
combo is the pointer to the combobox that renders Year.
data is data sent to the function when the "Changed" signal is generated.

Definition at line 541 of file mainProject.c.

References g_yy.

Referenced by create_combobox_years().

00542 {
00543     gchar *string = gtk_combo_box_get_active_text(combo);
00544     g_yy=string;
00545 }

char* convert_to_num ( char  month[]  ) 

convert_to_num converts "month" to standard numeral format(a preceding 0 before a single digit number)

Returns:
a char pointer containing the result
Parameters:
month is the input parameter the (month name)

Definition at line 716 of file mainProject.c.

Referenced by match_answer().

00717 {
00718     if(strcmp(month,"January")==0)
00719         return "01";
00720     else if(strcmp(month,"February")==0)
00721         return "02";
00722     else if(strcmp(month,"March")==0)
00723         return "03";
00724     else if(strcmp(month,"April")==0)
00725         return "04";
00726     else if(strcmp(month,"May")==0)
00727         return "05";
00728     else if(strcmp(month,"June")==0)
00729         return "06";
00730     else if(strcmp(month,"July")==0)
00731         return "07";
00732     else if(strcmp(month,"August")==0)
00733         return "08";
00734     else if(strcmp(month,"September")==0)
00735         return "09";
00736     else if(strcmp(month,"October")==0)
00737         return "10";
00738     else if(strcmp(month,"November")==0)
00739         return "11";
00740     else if(strcmp(month,"December")==0)
00741         return "12";
00742     else 
00743         return "00";
00744 
00745 }

static GtkTreeModel * create_and_fill_model (  )  [static]

create_and_fill_model populates the list structure created by create_view_and_model

Returns:
a populated tree store
Parameters:
void 

Definition at line 1340 of file mainProject.c.

References COL_FIRST, COL_SECOND, COL_THIRD, connection1, curdate, query(), result, and sqlrow.

Referenced by create_view_and_model().

01341 {
01342     GtkTreeStore  *treestore;
01343     GtkTreeIter    toplevel;
01344     int res=0,h=0,m=0;
01345     char query[300],r[5];
01346 
01347     char time_display[20],event_display[100],type_display[20];
01348 
01349     treestore = gtk_tree_store_new(3,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT);
01350     sprintf(query,"select hour,min,event,o,d,w,m,y from ers where dt='%s' or (d=1 and dt<='%s') order by hour,min",curdate,curdate);
01351     res=mysql_query(connection1,query);
01352     if (res!=0)
01353     {
01354         printf("SELECT QUERY FAILED!!");
01355     }
01356     else
01357     {
01358         result=mysql_use_result (connection1);
01359         if(result)
01360         {
01361             while ((sqlrow = mysql_fetch_row (result)))
01362             {
01363                 if(strcmp(sqlrow[3],"1")==0)
01364                     strcpy(type_display,"Once");
01365                 else if(strcmp(sqlrow[4],"1")==0)
01366                     strcpy(type_display,"Daily");
01367                 else if(strcmp(sqlrow[5],"1")==0)
01368                     strcpy(type_display,"Weekly");
01369                 else if(strcmp(sqlrow[6],"1")==0)
01370                     strcpy(type_display,"Monthly");
01371                 else if(strcmp(sqlrow[7],"1")==0)
01372                     strcpy(type_display,"Yearly");
01373     
01374                 strcpy(r,"AM");
01375                 h=atoi(sqlrow[0]);
01376                 m=atoi(sqlrow[1]);
01377                 if(h==12)
01378                     strcpy(r,"PM");
01379                 else if(h >=13)
01380                 {
01381                     h-=12;
01382                     strcpy(r,"PM");
01383                 }
01384                 else if(h==0)
01385                     h+=12;
01386                 
01387                 if(h<10 && m<10)
01388                     sprintf(time_display,"0%d:0%d %s",h,m,r);
01389                 else if(h<10 && m>9)
01390                                         sprintf(time_display,"0%d:%d %s",h,m,r);
01391                 else if(h>9 && m<10)
01392                                         sprintf(time_display,"%d:0%d %s",h,m,r);
01393                 else 
01394                                         sprintf(time_display,"%d:%d %s",h,m,r);
01395 
01396                 strcpy(event_display,sqlrow[2]);
01397 
01398                 /* Append a top level row */    
01399                 gtk_tree_store_append(treestore, &toplevel, NULL);
01400                 gtk_tree_store_set(treestore, &toplevel,COL_FIRST,time_display,COL_SECOND,event_display,COL_THIRD,type_display,-1);
01401             }
01402         }
01403         mysql_free_result(result);  
01404     }
01405     return GTK_TREE_MODEL(treestore);
01406 }

GtkWidget* create_combobox_AM_PM ( void   ) 

create_combobox_AM_PM creates the combobox for rendering AM/PM.

Returns:
the newly created Combobox Widget.
Parameters:
void 

Definition at line 635 of file mainProject.c.

References cb_changed_AM_PM().

Referenced by create_dialog_box().

00636 {
00637     GtkWidget *combo;
00638     /* creates the combobox, with no decimal places */
00639     combo = gtk_combo_box_new_text();
00640     gtk_combo_box_append_text( GTK_COMBO_BOX(combo),"AM");
00641     gtk_combo_box_append_text( GTK_COMBO_BOX(combo),"PM"); 
00642 
00643     /* Connect signal to tour handler function */
00644     g_signal_connect( G_OBJECT( combo ), "changed",G_CALLBACK(cb_changed_AM_PM), NULL );
00645     return combo;
00646 }

GtkWidget* create_combobox_days ( void   ) 

create_combobox_days creates the combobox for rendering days.

Returns:
the newly created Combobox widget
Parameters:
void 

Definition at line 564 of file mainProject.c.

References cb_changed_dd().

Referenced by create_dialog_box().

00565 {
00566     GtkWidget *combo;
00567     int i;
00568     char t[3];
00569     /* creates the combobox, with no decimal places */
00570     combo = gtk_combo_box_new_text();
00571     for(i=1;i<=31;i++)
00572     {
00573         sprintf(t,"%d",i);
00574         gtk_combo_box_append_text( GTK_COMBO_BOX(combo),t);
00575     }
00576 
00577     /* Connect signal to tour handler function */
00578     g_signal_connect( G_OBJECT( combo ), "changed",G_CALLBACK(cb_changed_dd), NULL );
00579 
00580     return combo;
00581 }

GtkWidget* create_combobox_months ( void   ) 

create_combobox_months creates the combobox for rendering Months

Returns:
the newly created Combobox widget.
Parameters:
void 

Definition at line 588 of file mainProject.c.

References cb_changed_mm(), and months.

Referenced by create_dialog_box().

00589 {
00590     GtkWidget *combo;
00591     int i;
00592     /* creates the combobox, with no decimal places */
00593     combo = gtk_combo_box_new_text();
00594     for(i=0;i<12;i++)
00595     {
00596         gtk_combo_box_append_text( GTK_COMBO_BOX(combo),months[i]);
00597     }
00598 
00599     /* Connect signal to tour handler function */
00600     g_signal_connect( G_OBJECT( combo ), "changed",G_CALLBACK(cb_changed_mm), NULL );
00601 
00602     return combo;
00603 }

GtkWidget* create_combobox_years ( void   ) 

create_combobox_years creates the combobox for rendering Year.

Returns:
the newly created Combobox widget.
Parameters:
void 

Definition at line 610 of file mainProject.c.

References cb_changed_yy().

Referenced by create_dialog_box().

00611 {
00612     GtkWidget *combo;
00613     int i;
00614     char t[8];
00615     /* creates the combobox, with no decimal places */
00616     combo = gtk_combo_box_new_text();
00617     for(i=2010;i<=2020;i++)
00618     {
00619         sprintf(t,"%d",i);
00620         gtk_combo_box_append_text( GTK_COMBO_BOX(combo),t);
00621     }
00622 
00623     /* Connect signal to tour handler function */
00624     g_signal_connect( G_OBJECT( combo ), "changed",G_CALLBACK(cb_changed_yy), NULL );
00625 
00626     return combo;
00627 }

void create_connection (  ) 

create_connection creates a database connection with the background database used(MYSQL) void

Returns:
void

Definition at line 260 of file mainProject.c.

References check_flag, connection1, display_row(), pid, query(), result, and sqlrow.

Referenced by main().

00261 {
00262     FILE *fp;
00263     int r=0,k=0;
00264     int res,create_table=0;
00265     char query[1000],query1[100],ch,p_id[10];
00266 
00267     r=system("./poll");
00268         if(r==-1)
00269                 printf("./poll not invoked");
00270 
00271     system("ps -C poll -o pid|tail -1|sed 's/ //' > temp.txt");
00272         fp=fopen("temp.txt","r");
00273         if(fp)
00274         {
00275                 while((ch=fgetc(fp))!=EOF)
00276                 {
00277                         p_id[k]=ch;
00278                         k++;
00279                 }
00280                 p_id[k]='\0';
00281         }
00282         pid=atoi(p_id);
00283     printf("PID NOW %d\n",pid);
00284     
00285     
00286     /*---Creating Table---*/
00287     strcpy(query,"create table ers(dt date,day varchar(5),hour integer,min integer,event varchar(100),o integer,d integer,w integer,m integer,y integer,eo integer,ed date,ew date,em integer,ey integer,id MEDIUMINT NOT NULL AUTO_INCREMENT,primary key(id))");
00288     connection1 = mysql_init(NULL);
00289     if (mysql_real_connect (connection1, "localhost", "alarm_user", "alarm_password", "alarm", 0, NULL, 0))
00290     {
00291         printf ("Connection successful\n");
00292 
00293         strcpy(query1,"select 'ers' from information_schema.tables where table_schema='alarm'");
00294         res=mysql_query(connection1,query1);
00295         if (res)
00296         {
00297             printf ("select failed as : %s\n", mysql_error (connection1));
00298         }
00299         else
00300         {
00301             result = mysql_use_result (connection1);
00302             if (result)
00303             {
00304                 while ((sqlrow = mysql_fetch_row (result)))
00305                     display_row ();
00306 
00307                 if (mysql_errno (connection1))
00308                 {
00309                     printf ("Error occurred while retrieving data : %s\n", mysql_error (connection1));
00310                 }
00311             }
00312             if(check_flag==0)
00313             {
00314                 printf("GO GO CREATE TABLE\n");
00315                 create_table=1;
00316             }
00317             check_flag=0;
00318             mysql_free_result(result);
00319         }   
00320 
00321         if(create_table==1)
00322         {
00323             res = mysql_query(connection1,query);                    
00324             if (res==0)                
00325             {
00326                 printf ("Table created successfully.\n");
00327             }
00328             else
00329             {
00330                 fprintf (stderr,"Could not create table as %d: %s\n",mysql_errno (connection1),mysql_error (connection1));
00331                 mysql_close (connection1);
00332             }
00333         }
00334     }                                                       
00335     else
00336     {
00337         fprintf (stderr, "Connection failed\n");
00338         if (mysql_errno (connection1))
00339         {
00340             fprintf (stderr, "Connection error %d: %s\n",mysql_errno (connection1),mysql_error(connection1));
00341         }
00342     }
00343 
00344 }

GtkWidget* create_dialog_box ( char  message[20]  ) 

create_dialog_box creates the 'add event' form

Returns:
the frame on which the form is rendered
Parameters:
message is the message sent to this function

Definition at line 904 of file mainProject.c.

References callback(), create_combobox_AM_PM(), create_combobox_days(), create_combobox_months(), create_combobox_years(), create_integer_spin_button_hours(), create_integer_spin_button_mins(), day1, dd_upd, disp, g_daily, g_event_upd, g_hour, g_min, g_monthly, g_once, g_weekly, g_yearly, match_answer(), mm_upd, month1, update_add, year1, and yy_upd.

Referenced by menuitem_response(), and view_onRowActivated().

00905 {
00906     GtkWidget *frame;
00907     GtkWidget *table;
00908     GtkWidget *radbut0,*radbut1,*radbut2,*radbut3,*radbut4,*button;
00909     GtkWidget *label_question,*date1,*time1,*label_freq,*sep,*spinner1,*spinner2,*combo1,*combo2,*combo3,*combo4;
00910 
00911     /*Created a frame*/
00912 
00913     if(update_add==1)
00914         frame=gtk_frame_new( "Update Event" );
00915     else
00916         frame=gtk_frame_new( "Add Event" );
00917     gtk_widget_show(frame);
00918 
00919     /* Create a 5x5 table */
00920     table = gtk_table_new (5,5,TRUE);
00921     
00922     label_question=gtk_label_new("Event Details");
00923 
00924 
00925     /*Put the label in the first row*/
00926     gtk_table_attach_defaults (GTK_TABLE(table), label_question, 0, 5, 0, 1);
00927     gtk_widget_show (label_question);
00928     
00929     /*Note About The Reminder*/
00930     disp = gtk_entry_new();
00931     gtk_table_attach_defaults(GTK_TABLE (table), disp,0,5,1, 2);
00932     if(update_add==1)
00933         gtk_entry_set_text(GTK_ENTRY(disp),g_event_upd);
00934 
00935     gtk_widget_show(disp);
00936 
00937     date1=gtk_label_new("Event Date");
00938     gtk_table_attach_defaults(GTK_TABLE (table),date1,0,1,2, 3);
00939         gtk_widget_show(date1);
00940     
00941     /*Combo Box added*/
00942     
00943     combo1=create_combobox_days();
00944         gtk_table_attach_defaults(GTK_TABLE (table),combo1,2,3,2,3);
00945     if(update_add==1)
00946     {
00947         gtk_combo_box_set_active (GTK_COMBO_BOX(combo1),atoi(dd_upd)-1);        //Retrieve second argument 
00948     }
00949     else
00950     {
00951         gtk_combo_box_set_active (GTK_COMBO_BOX(combo1),day1-1);
00952     }
00953         gtk_widget_show(combo1);
00954 
00955     combo2=create_combobox_months();
00956         gtk_table_attach_defaults(GTK_TABLE (table),combo2,3,4,2,3);
00957     if(update_add==1)
00958     {
00959         gtk_combo_box_set_active (GTK_COMBO_BOX(combo2),atoi(mm_upd)-1);
00960     }
00961      else
00962                 gtk_combo_box_set_active (GTK_COMBO_BOX(combo2),month1-1);
00963 
00964         gtk_widget_show(combo2);
00965 
00966     combo3=create_combobox_years();
00967         gtk_table_attach_defaults(GTK_TABLE (table),combo3,4,5,2,3);
00968     if(update_add==1)
00969     {
00970                 gtk_combo_box_set_active (GTK_COMBO_BOX(combo3),atoi(yy_upd)-2010);
00971     }
00972     else
00973                 gtk_combo_box_set_active (GTK_COMBO_BOX(combo3),year1-2010);
00974 
00975         gtk_widget_show(combo3);
00976     
00977 
00978     time1=gtk_label_new("Event Time");
00979     gtk_table_attach_defaults(GTK_TABLE (table),time1,0,1,3, 4);
00980         gtk_widget_show(time1);
00981 
00982     /*Spinner Buttons added*/
00983     
00984     int temp_hr=0;
00985     temp_hr=g_hour;
00986 
00987     spinner1=create_integer_spin_button_hours();
00988         gtk_table_attach_defaults(GTK_TABLE (table),spinner1,2,3,3,4);
00989     if(update_add==1)                               //Put value from database
00990     {
00991         if(g_hour > 12)
00992         {
00993             gtk_spin_button_set_value (GTK_SPIN_BUTTON(spinner1),g_hour-12);
00994         }
00995         else if(g_hour==0)
00996             gtk_spin_button_set_value (GTK_SPIN_BUTTON(spinner1),g_hour+12);
00997         
00998         else
00999             gtk_spin_button_set_value (GTK_SPIN_BUTTON(spinner1),g_hour);
01000     }
01001     else
01002         gtk_spin_button_set_value (GTK_SPIN_BUTTON(spinner1),0);
01003 
01004         gtk_widget_show(spinner1);
01005 
01006     spinner2=create_integer_spin_button_mins();
01007         gtk_table_attach_defaults(GTK_TABLE (table),spinner2,3,4,3,4);
01008     if(update_add==1)
01009     {
01010                 gtk_spin_button_set_value (GTK_SPIN_BUTTON(spinner2),g_min);
01011     }
01012     else
01013         gtk_spin_button_set_value (GTK_SPIN_BUTTON(spinner1),0);
01014         gtk_widget_show(spinner2);
01015     
01016     combo4=create_combobox_AM_PM();
01017         gtk_table_attach_defaults(GTK_TABLE (table),combo4,4,5,3,4);
01018 
01019         if(update_add==1)
01020     {
01021         if(temp_hr>=12)
01022         {
01023                     gtk_combo_box_set_active (GTK_COMBO_BOX(combo4),1);
01024         }
01025         else
01026             gtk_combo_box_set_active (GTK_COMBO_BOX(combo4),0);
01027     }
01028     else
01029     {
01030         gtk_combo_box_set_active (GTK_COMBO_BOX(combo4),1);
01031     }
01032             
01033         gtk_widget_show(combo4);
01034 
01035     /*Horizontal Seperator added*/
01036 
01037     sep =gtk_hseparator_new ();
01038     gtk_table_attach_defaults(GTK_TABLE (table),sep,0,5,4,5);
01039         gtk_widget_show(sep);
01040 
01041 
01042     label_freq=gtk_label_new("Event Reminder frequency");
01043         gtk_table_attach_defaults(GTK_TABLE (table),label_freq,0,5,5,6);
01044         gtk_widget_show(label_freq);
01045 
01046 
01047     /*---------------------------------Radio buttons being added-------------------------*/
01048 
01049 
01050     /*Create first radio button*/
01051     radbut0 = gtk_radio_button_new_with_label(NULL,"Once");
01052     gtk_signal_connect (GTK_OBJECT (radbut0), "clicked", GTK_SIGNAL_FUNC (callback), (gpointer) "Once");
01053     gtk_table_attach_defaults (GTK_TABLE(table), radbut0, 0, 1, 6,7);
01054     if(update_add==1 && g_once==1) 
01055     {                                                                      //Put from database
01056                 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(radbut0),TRUE);
01057     }
01058         
01059     gtk_widget_show (radbut0);
01060 
01061     /*Create second radio button*/
01062     radbut1 = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON (radbut0)),"Daily");
01063     gtk_signal_connect (GTK_OBJECT (radbut1), "clicked",GTK_SIGNAL_FUNC (callback), (gpointer) "Daily");
01064     gtk_table_attach_defaults (GTK_TABLE(table), radbut1, 1, 2, 6,7);
01065     if(update_add==1 && g_daily==1)                                 //Put from database
01066         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(radbut1),TRUE);
01067     
01068     gtk_widget_show (radbut1);
01069     
01070     /*Create third radio button*/
01071     radbut2 = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON (radbut1)),"Weekly");
01072     gtk_signal_connect (GTK_OBJECT (radbut2), "clicked",GTK_SIGNAL_FUNC (callback), (gpointer) "Weekly");
01073     gtk_table_attach_defaults (GTK_TABLE(table), radbut2, 2, 3, 6,7);
01074     if(update_add==1 && g_weekly==1)                                                                       //Put from database
01075                 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(radbut2),TRUE);
01076     gtk_widget_show (radbut2);
01077 
01078     /*Create fourth radio button*/
01079     radbut3 = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON (radbut2)),"Monthly");
01080     gtk_signal_connect (GTK_OBJECT (radbut3), "clicked",GTK_SIGNAL_FUNC (callback), (gpointer) "Monthly");
01081     gtk_table_attach_defaults (GTK_TABLE(table), radbut3, 3, 4, 6,7);
01082     if(update_add==1 && g_monthly==1)                                                                       //Put from database
01083                 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(radbut3),TRUE);
01084     gtk_widget_show (radbut3);
01085     
01086     /*Create fifth radio button*/
01087     radbut4 = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON (radbut3)),"Yearly");
01088     gtk_signal_connect (GTK_OBJECT (radbut4), "clicked",GTK_SIGNAL_FUNC (callback), (gpointer) "Yearly");
01089     gtk_table_attach_defaults (GTK_TABLE(table), radbut4, 4, 5, 6, 7);
01090     if(update_add==1 && g_yearly==1)                                                                       //Put from database
01091                 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(radbut4),TRUE);
01092     gtk_widget_show (radbut4);  
01093 
01094 
01095     /*-------------------------------------Radio buttons added---------------------------------*/
01096 
01097 
01098     /*Button to update record*/
01099     if(update_add==1)
01100         button = gtk_button_new_with_label ("Update Event");
01101     else
01102             button = gtk_button_new_with_label ("Add Event");
01103     /*When the button is clicked, we call the "delete_event" function and the program exits*/
01104     gtk_signal_connect (GTK_OBJECT (button),"clicked",GTK_SIGNAL_FUNC (match_answer), NULL);
01105     /*Insert the quit button into the both lower quadrants of the table*/
01106     gtk_table_attach_defaults (GTK_TABLE(table), button, 0, 5, 7,8);
01107     gtk_widget_show (button); 
01108 
01109     /* Put the table in the main window */
01110     gtk_container_add (GTK_CONTAINER (frame),table);
01111     gtk_widget_show (table);
01112     
01113     return frame;           //FRAME RETURNED
01114 }

GtkWidget* create_integer_spin_button_hours ( void   ) 

create_integer_spin_button_hours creates the Spinner buttons for "Hours"

Returns:
the newly created widget spinner
Parameters:
void 

Definition at line 459 of file mainProject.c.

References grab_int_value_hour().

Referenced by create_dialog_box().

00460 {
00461     GtkWidget *spinner;
00462     GtkAdjustment *spinner_adj;
00463     spinner_adj = (GtkAdjustment *) gtk_adjustment_new (0.0,1.0,12.0, 1.0, 0.0, 0.0);
00464 
00465     /* creates the spinner, with no decimal places */
00466     spinner=gtk_spin_button_new (spinner_adj, 1.0, 0);
00467     gtk_signal_connect(GTK_OBJECT(spinner), "value-changed",GTK_SIGNAL_FUNC(grab_int_value_hour),NULL);
00468     return spinner;
00469 }

GtkWidget* create_integer_spin_button_mins ( void   ) 

create_integer_spin_button_mins creates the Spinner buttons for "Mins"

Returns:
the newly created widget spinner
Parameters:
void 

Definition at line 476 of file mainProject.c.

References grab_int_value_min().

Referenced by create_dialog_box().

00477 {
00478     GtkWidget *spinner;
00479     GtkAdjustment *spinner_adj;
00480     spinner_adj = (GtkAdjustment *) gtk_adjustment_new(0.0,0.0,59.0, 1.0, 0.0, 0.0);
00481 
00482     /* creates the spinner, with no decimal places */
00483     spinner=gtk_spin_button_new (spinner_adj, 1.0, 0);
00484     
00485 
00486 gtk_signal_connect(GTK_OBJECT(spinner), "value-changed",GTK_SIGNAL_FUNC(grab_int_value_min),NULL);
00487     return spinner;
00488 }

void create_master_form (  ) 

create _master_form creates the main form (renders main menu)

Returns:
void
Parameters:
void 

Definition at line 1502 of file mainProject.c.

References delete_event_master(), menu_bar, menuitem_response(), vbox, window, and window1.

Referenced by calendar_day_double_clicked().

01503 {
01504 
01505     GtkWidget *root_menu1,*root_menu2,*root_menu3,*root_menu4;
01506 
01507 
01508     /* create a new window */
01509     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
01510     gtk_widget_set_usize (GTK_WIDGET (window), 500,300);
01511     gtk_window_set_title (GTK_WINDOW (window), "Event Registration Menu");
01512     gtk_window_set_transient_for(GTK_WINDOW(window),GTK_WINDOW(window1));
01513 
01514     gtk_window_set_destroy_with_parent(GTK_WINDOW(window),TRUE);
01515     gtk_window_set_resizable(GTK_WINDOW(window),FALSE);
01516     gtk_signal_connect (GTK_OBJECT (window), "delete_event",GTK_SIGNAL_FUNC (delete_event_master), NULL);
01517 
01518 
01519     root_menu1 = gtk_menu_item_new_with_label ("Add Event");
01520     root_menu2 = gtk_menu_item_new_with_label ("Update Event");
01521     root_menu3 = gtk_menu_item_new_with_label ("Delete Event");
01522     root_menu4 = gtk_menu_item_new_with_label ("Show Events for the Day");
01523 
01524     gtk_widget_show (root_menu1);
01525     gtk_widget_show (root_menu2);
01526     gtk_widget_show (root_menu3);
01527     gtk_widget_show (root_menu4);
01528 
01529     
01530     /* Now we specify that all root menus with no sub menu items*/
01531     gtk_signal_connect_object (GTK_OBJECT (root_menu1), "activate",GTK_SIGNAL_FUNC (menuitem_response), (gpointer)"FIRST");
01532     gtk_signal_connect_object (GTK_OBJECT (root_menu2), "activate",GTK_SIGNAL_FUNC (menuitem_response), (gpointer)"SECOND");
01533     gtk_signal_connect_object (GTK_OBJECT (root_menu3), "activate",GTK_SIGNAL_FUNC (menuitem_response), (gpointer)"THIRD");
01534     gtk_signal_connect_object (GTK_OBJECT (root_menu4), "activate",GTK_SIGNAL_FUNC (menuitem_response), (gpointer)"FOURTH");
01535 
01536 
01537     /* A vbox to put a menu and a button in: */
01538     vbox = gtk_vbox_new (FALSE, 0);
01539     gtk_container_add (GTK_CONTAINER (window), vbox);
01540     gtk_widget_show (vbox);
01541 
01542     /* Create a menu-bar to hold the menus and add it to our main window */
01543     menu_bar = gtk_menu_bar_new ();
01544     gtk_box_pack_start (GTK_BOX (vbox), menu_bar, FALSE, FALSE, 2);
01545     gtk_widget_show (menu_bar);
01546     
01547     gtk_widget_show(menu_bar);
01548 
01549     /* And finally we append the menu-item to the menu-bar */
01550     gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), root_menu1);
01551     gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), root_menu2);
01552     gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), root_menu3);
01553     gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), root_menu4);
01554 
01555     /* always display the window as the last step so it all splashes on
01556       the screen at once. */
01557     gtk_widget_show (window);
01558 
01559 }

static GtkWidget * create_view_and_model (  )  [static]

create_view_and_model creates a model for the list structure

Returns:
an instance of tree view
Parameters:
void 

Definition at line 1414 of file mainProject.c.

References COL_FIRST, COL_SECOND, COL_THIRD, create_and_fill_model(), del_form, show_all, update_add, and view_onRowActivated().

Referenced by menuitem_response(), and view_onRowActivated().

01415 {
01416     GtkTreeViewColumn   *col;
01417     GtkCellRenderer     *renderer;
01418     GtkWidget           *view;
01419     GtkTreeModel        *model;
01420 
01421     view = gtk_tree_view_new();
01422 
01423     /*----Column #1-------*/
01424 
01425 
01426     col = gtk_tree_view_column_new();
01427     gtk_tree_view_column_set_title(col, "Time");
01428     /* pack tree view column into tree view */
01429     gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
01430     renderer = gtk_cell_renderer_text_new();
01431     /* pack cell renderer into tree view column */
01432     gtk_tree_view_column_pack_start(col, renderer, TRUE);
01433     /* connect 'text' property of the cell renderer to
01434      *  model column that contains the last name */
01435     gtk_tree_view_column_add_attribute(col, renderer, "text", COL_FIRST);
01436     /* set 'weight' property of the cell renderer to
01437        bold print (we want all last names in bold) */
01438     g_object_set(renderer,"weight", PANGO_WEIGHT_BOLD,"weight-set", TRUE,NULL);
01439 
01440 
01441     /* --- Column #2 --- */
01442 
01443     col = gtk_tree_view_column_new();
01444     /*Set tilte and alignment*/
01445     if(update_add==1)
01446         gtk_tree_view_column_set_title(col,"Double Click to Select Event to be Updated");
01447     else if(del_form==1)
01448         gtk_tree_view_column_set_title(col,"Double Click to Delete Event");
01449     else if(show_all==1)
01450         gtk_tree_view_column_set_title(col,"Events for Today");
01451     gtk_tree_view_column_set_alignment  (col,.5);
01452     /* pack tree view column into tree view */
01453     gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
01454     renderer = gtk_cell_renderer_text_new();
01455     /* pack cell renderer into tree view column */
01456     gtk_tree_view_column_pack_start(col, renderer, TRUE);
01457     /* connect 'text' property of the cell renderer to model column that contains the first name */
01458     gtk_tree_view_column_add_attribute(col, renderer, "text",COL_SECOND);
01459 
01460     
01461     /* --- Column #3 --- */
01462 
01463         col = gtk_tree_view_column_new();
01464     gtk_tree_view_column_set_title(col, "Scheduled");
01465         gtk_tree_view_column_set_alignment  (col,.5);
01466         /* pack tree view column into tree view */
01467         gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
01468         renderer = gtk_cell_renderer_text_new();
01469         /* pack cell renderer into tree view column */
01470         gtk_tree_view_column_pack_start(col, renderer, TRUE);
01471         /* connect 'text' property of the cell renderer to model column that contains the first name */
01472         gtk_tree_view_column_add_attribute(col, renderer, "text",COL_THIRD);
01473 
01474     /*Display grid lines*/
01475 
01476     gtk_tree_view_set_enable_tree_lines (GTK_TREE_VIEW(view),TRUE);
01477     gtk_tree_view_set_grid_lines(GTK_TREE_VIEW(view),GTK_TREE_VIEW_GRID_LINES_BOTH);
01478                                                          
01479     model = create_and_fill_model();
01480     gtk_tree_view_set_model(GTK_TREE_VIEW(view), model);
01481     if(del_form==1|| update_add==1)
01482         g_signal_connect(view, "row-activated", (GCallback) view_onRowActivated, NULL);
01483 
01484     g_object_unref(model); /* destroy model automatically with view */
01485     gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(view)),GTK_SELECTION_NONE);
01486 
01487     return view;
01488 }

gint delete_event ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
)

delete_event is the callback that quits the Calendar

Returns:
FALSE so that the "destroy" Signal is emitted
Parameters:
widget that points to the calendar
event is the Signal that raised the event
data is the data sent to callback

Definition at line 659 of file mainProject.c.

Referenced by main().

00660 {
00661     gtk_main_quit ();
00662     return(FALSE);
00663 }

gint delete_event_master ( GtkWidget *  widget,
GdkEvent *  event,
gpointer  data 
)

delete_event_master quits the master menu form

Returns:
FALSE so that the "destroy" Signal is emitted
Parameters:
widget that points to the master form
event is the Signal that raised the event
data is data sent to the Callback.

Definition at line 672 of file mainProject.c.

References parent_flag.

Referenced by create_master_form().

00673 {
00674     parent_flag=0;
00675     gtk_widget_destroy(widget);
00676     return(FALSE);
00677 }

void display_dialog ( char  msg[]  ) 

display_dialog displays a dialog box with a Custom message

Returns:
void
Parameters:
msg is the message to be displayed

Definition at line 414 of file mainProject.c.

Referenced by match_answer(), and view_onRowActivated().

00415 {
00416     GtkWidget *dialog;
00417         dialog = gtk_message_dialog_new(NULL,GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK,"%s",msg);
00418         gtk_dialog_run (GTK_DIALOG(dialog));
00419         gtk_widget_destroy (dialog);
00420 }

void display_row (  ) 

display_row displays the result set returned by Select Command

Returns:
void
Parameters:
void 

Definition at line 212 of file mainProject.c.

References check_flag, connection1, and sqlrow.

Referenced by create_connection(), and query().

00213 {
00214     unsigned int field_count;
00215     field_count = 0;
00216     check_flag=1;
00217     while (field_count < mysql_field_count (connection1))
00218     {
00219         printf ("%s ", sqlrow[field_count]);
00220         field_count++;
00221     }
00222 }

void grab_int_value_hour ( GtkSpinButton *  a_spinner,
gpointer  user_data 
)

grab_int_value_hour is the handler for Spinner buttons used,it grabs the "Hour" value of time

Returns:
void
Parameters:
a_spinner is pointing to the spinner widget
user_data is data sent to this callback function

Definition at line 436 of file mainProject.c.

References g_hour, and temp.

Referenced by create_integer_spin_button_hours().

00437 {
00438     temp=gtk_spin_button_get_value_as_int (a_spinner);
00439     g_hour=temp;
00440 }

void grab_int_value_min ( GtkSpinButton *  a_spinner,
gpointer  user_data 
)

grab_int_value_min is the handler for Spinner buttons used,it grabs the "Min" value of time

Returns:
void
Parameters:
a_spinner is pointing to the spinner widget
user_data is data sent to this callback function

Definition at line 448 of file mainProject.c.

References g_min, and temp.

Referenced by create_integer_spin_button_mins().

00449 {
00450     temp=gtk_spin_button_get_value_as_int (a_spinner);
00451     g_min=temp;
00452 }

int main ( int  argc,
char *  argv[] 
)

main function where the program starts working

Returns:
zero on success
Parameters:
argc number of command line arguments
argv actual command line arguments

Definition at line 1749 of file mainProject.c.

References calendar_day_double_clicked(), connection1, create_connection(), delete_event(), pid, and window1.

01750 {
01751     GtkCalendar *calendar;
01752     GtkWidget *table;
01753     char comm[15];
01754     int f=0;
01755 
01756     create_connection();                //Create table
01757     gtk_init (&argc, &argv);
01758     /* Create a new window */
01759     window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
01760     gtk_window_set_resizable(GTK_WINDOW(window1),FALSE);
01761     gtk_window_set_position(GTK_WINDOW(window1),GTK_WIN_POS_CENTER_ALWAYS);
01762     /* Set the window title */
01763     gtk_window_set_title (GTK_WINDOW(window1), "Task Reminder System");
01764     /* Set a handler for delete_event that immediately exits GTK. */
01765     gtk_signal_connect (GTK_OBJECT (window1), "delete_event",GTK_SIGNAL_FUNC (delete_event), NULL);
01766     /* Sets the border width of the window. */
01767     gtk_container_set_border_width (GTK_CONTAINER (window1), 20);
01768     /* Create a 1x1 table */
01769     table = gtk_table_new (1, 1, TRUE);
01770     /* Put the table in the main window */
01771     gtk_container_add (GTK_CONTAINER (window1), table);
01772     /*Creating a new calendar*/
01773     calendar=GTK_CALENDAR(gtk_calendar_new());
01774     gtk_calendar_display_options (calendar,GTK_CALENDAR_SHOW_HEADING|GTK_CALENDAR_SHOW_DAY_NAMES);
01775     /*Put the label in the first row*/
01776     gtk_table_attach_defaults (GTK_TABLE(table), GTK_WIDGET(calendar), 0, 1, 0, 1);
01777     /*Handler for double clicking a date in the calendar*/
01778     gtk_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click",GTK_SIGNAL_FUNC (calendar_day_double_clicked),NULL);
01779     gtk_widget_show (GTK_WIDGET(calendar));
01780     gtk_widget_show (table);
01781     gtk_widget_show (window1);
01782     
01783 
01784     gtk_main ();
01785     sprintf(comm,"kill %d",pid);
01786         f=system(comm);
01787         if(f==-1)
01788                 printf("Command failed");
01789 
01790     mysql_close(connection1);
01791     
01792     return 0;
01793 }

void match_answer ( GtkWidget *  widget,
gpointer  data 
)

match_answer is the caller function, when add/update button is pressed

Returns:
void
Parameters:
widget is the button widget itself
data is the data sent to this function

Definition at line 754 of file mainProject.c.

References connection1, convert_to_num(), date::dd, disp, display_dialog(), g_am_pm, g_daily, g_dd, g_event, g_hour, g_min, g_mm, g_monthly, g_once, g_weekly, g_yearly, g_yy, date::mm, month_init, pid, query(), radio_flag, ret_one_day_less(), str, update_add, week_calc(), year_init, and date::yy.

Referenced by create_dialog_box().

00755 {
00756     FILE *fp;
00757     int i=0,k=0,res=0,pid,not_null_flag=0,garbage_flag=0;
00758     char t1[7],query[300],ch,p_id[6],*mnth,odl[20],not_null[100];
00759     date d1;
00760     
00761 
00762     system("ps -C poll -o pid|tail -1|sed 's/ //' > temp.txt");
00763     fp=fopen("temp.txt","r");
00764     if(fp)
00765     {
00766         while((ch=fgetc(fp))!=EOF)
00767         {
00768             p_id[k]=ch;     
00769             k++;
00770         }
00771         p_id[k]='\0';
00772     }
00773     pid=atoi(p_id);
00774     k=0;
00775     g_event=gtk_entry_get_text(GTK_ENTRY(disp));
00776     strcpy(not_null,g_event);
00777 
00778     if(strlen(not_null)==0)
00779     {
00780         display_dialog("Event cannot be null,Re-enter!!");
00781         not_null_flag=1;
00782     }
00783     else
00784         not_null_flag=0;
00785 
00786     for(i=0;not_null[i];i++)
00787     {
00788         if(isalnum(not_null[i])==0)
00789         {
00790             garbage_flag=1;
00791             break;  
00792         }   
00793     }
00794     if(garbage_flag==1)
00795         display_dialog("Event contains invalid characters!!");
00796 
00797 
00798     mnth=convert_to_num(g_mm);
00799 
00800     d1.dd=atoi(g_dd);
00801     d1.mm=atoi(mnth);
00802     d1.yy=atoi(g_yy);
00803     week_calc(d1,t1);   
00804 
00805     k=0;
00806     for(i=0;g_yy[i];i++)
00807     {
00808         str[k]=g_yy[i];
00809         k++;
00810     }
00811     str[k]='-';
00812     k++;
00813     for(i=0;mnth[i];i++)
00814     {
00815         str[k]=mnth[i];
00816         k++;
00817     }
00818     str[k]='-';
00819     k++;
00820     for(i=0;g_dd[i];i++)
00821     {
00822         str[k]=g_dd[i];
00823         k++;
00824     }
00825     str[k]='\0';
00826 
00827 
00828     if(strcmp(g_am_pm,"PM")==0 && g_hour>=1 && g_hour<=11)
00829     {
00830         g_print("PM LOOP\n");
00831         g_hour+=12;
00832     }
00833 
00834     if(strcmp(g_am_pm,"AM")==0 && g_hour==12)
00835         {
00836         g_print("AM LOOP\n");
00837                 g_hour-=12;
00838         }
00839     
00840     if(radio_flag==1)
00841     {
00842         g_once=1;g_daily=0;g_weekly=0;g_monthly=0;g_yearly=0;
00843     }
00844     else if(radio_flag==2)
00845     {
00846                 g_once=0;g_daily=1;g_weekly=0;g_monthly=0;g_yearly=0;
00847     }
00848     else if(radio_flag==3)
00849     {
00850                 g_once=0;g_daily=0;g_weekly=1;g_monthly=0;g_yearly=0;
00851     }
00852     else if(radio_flag==4)
00853     {
00854                 g_once=0;g_daily=0;g_weekly=0;g_monthly=1;g_yearly=0;
00855     }
00856     else if(radio_flag==5)
00857     {
00858                 g_once=0;g_daily=0;g_weekly=0;g_monthly=0;g_yearly=1;
00859     }
00860 
00861 
00862     ret_one_day_less(odl,str);
00863 
00864 
00865     if(update_add==1)
00866     {
00867         sprintf(query,"update ers set dt='%s',day='%s',hour=%d,min=%d,event='%s',o=%d,d=%d,w=%d,m=%d,y=%d,eo=0,ed='%s',ew='%s',em=%d,ey=%d where id=%d",str,t1,g_hour,g_min,g_event,g_once,g_daily,g_weekly,g_monthly,g_yearly,odl,odl,month_init,year_init,id);
00868         res=mysql_query(connection1,query);
00869         if(res!=0)
00870             display_dialog("Updation Failed!!");
00871         else
00872         {
00873             printf("PID : %d",pid);
00874             kill(pid,SIGUSR1);
00875             display_dialog("Updation Successfull!!");
00876         }
00877     }
00878     else
00879     {
00880         if(not_null_flag==0 && garbage_flag==0)
00881         {
00882             sprintf(query,"insert into ers values('%s','%s',%d,%d,'%s',%d,%d,%d,%d,%d,0,'%s','%s',%d,%d,0)",str,t1,g_hour,g_min,g_event,g_once,g_daily,g_weekly,g_monthly,g_yearly,odl,odl,month_init,year_init);
00883             res=mysql_query(connection1,query);
00884             if (res!=0)
00885                 display_dialog("Insertion Failed!!");
00886             else
00887             {
00888                 kill(pid,SIGUSR1);
00889                 display_dialog("Insertion Successfull!!");
00890             }
00891         }
00892     }
00893 }

static void menuitem_response ( gchar *  string  )  [static]

menuitem_response prints a string when a menu item is selected

Returns:
void
Parameters:
string is the string indicating which menu is pressed

Definition at line 1566 of file mainProject.c.

References box_remove(), create_dialog_box(), create_view_and_model(), del_form, menu_bar, show_all, update_add, and vbox.

Referenced by create_master_form().

01567 {
01568     GtkWidget *frame1,*view,*frame2,*scroller;
01569     if(strcmp(string,"FIRST")==0)       //Render add event
01570     {
01571         update_add=0;
01572         /*Create a frame*/
01573         frame1=create_dialog_box("Hi");
01574         box_remove(menu_bar,GTK_BOX(vbox));
01575         gtk_box_pack_start (GTK_BOX (vbox),frame1, FALSE, FALSE, 2);
01576     }
01577     else if(strcmp(string,"SECOND")==0)           //Render Update event
01578         {   
01579         update_add=1;
01580         show_all=0;
01581         del_form=0;
01582         view = create_view_and_model();
01583                 /*Create a frame*/
01584                 frame2=gtk_frame_new( "Update Event" );
01585         scroller=gtk_scrolled_window_new(NULL,NULL);
01586         gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroller),GTK_POLICY_ALWAYS,GTK_POLICY_ALWAYS);
01587         gtk_widget_set_size_request(scroller,200,250);
01588                 gtk_container_add (GTK_CONTAINER (scroller),view);
01589         gtk_container_add (GTK_CONTAINER (frame2),scroller);
01590                 /*Remove Extra Widgets*/
01591                 box_remove(menu_bar,GTK_BOX(vbox));
01592                 gtk_box_pack_start (GTK_BOX (vbox),frame2, FALSE, FALSE, 2);
01593                 gtk_widget_show(view);
01594                 gtk_widget_show(scroller);
01595         gtk_widget_show(frame2);
01596         }
01597 
01598     else if(strcmp(string,"THIRD")==0)      //Render delete event
01599     {
01600         update_add=0;
01601         show_all=0;
01602         del_form=1;
01603         view = create_view_and_model();
01604         /*Create a frame*/
01605         frame2=gtk_frame_new( "Delete Event" );
01606         scroller=gtk_scrolled_window_new(NULL,NULL);
01607         gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroller),GTK_POLICY_ALWAYS,GTK_POLICY_ALWAYS);
01608                 gtk_widget_set_size_request(scroller,200,250);
01609                 gtk_container_add (GTK_CONTAINER (scroller),view);
01610                 gtk_container_add (GTK_CONTAINER (frame2),scroller);
01611         /*Remove Extra Widgets*/
01612         box_remove(menu_bar,GTK_BOX(vbox));     
01613         gtk_box_pack_start (GTK_BOX (vbox),frame2, FALSE, FALSE, 2);
01614         gtk_widget_show(view);
01615         gtk_widget_show(frame2);
01616         gtk_widget_show(scroller);
01617     }
01618     else if(strcmp(string,"FOURTH")==0)     //Render show event
01619     {
01620         update_add=0;
01621         del_form=0;
01622         show_all=1;
01623         view = create_view_and_model(1);
01624         /*Create a frame*/
01625         frame2=gtk_frame_new( "Show Events" );
01626         scroller=gtk_scrolled_window_new(NULL,NULL);
01627                 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroller),GTK_POLICY_ALWAYS,GTK_POLICY_ALWAYS);
01628                 gtk_widget_set_size_request(scroller,200,250);
01629                 gtk_container_add (GTK_CONTAINER (scroller),view);
01630                 gtk_container_add (GTK_CONTAINER (frame2),scroller);
01631         //Remove Extra Widgets
01632         box_remove(menu_bar,GTK_BOX(vbox));     
01633         gtk_box_pack_start (GTK_BOX (vbox),frame2, FALSE, FALSE, 2);
01634         gtk_widget_show(view);
01635         gtk_widget_show(frame2);
01636         gtk_widget_show(scroller);
01637     }
01638 }

void ret_one_day_less ( char  dat[15],
char  dt_register[15] 
)

ret_one_day_less subtracts one day from a given date and returns the new date

Returns:
void
Parameters:
dat_register is the date from which one day is to be subtracted
dat is the pointer in which newly formed date will be returned

Definition at line 230 of file mainProject.c.

References connection1, result, and sqlrow.

Referenced by match_answer().

00231 {
00232         int return_value;
00233     char qq[50];
00234     sprintf(qq,"select DATE_SUB('%s',INTERVAL 1 DAY)",dt_register);
00235         return_value =  mysql_query (connection1,qq);
00236 
00237         if (return_value)
00238         {
00239                 printf ("select failed as : %s\n", mysql_error (connection1));
00240         }
00241         else
00242         {
00243                 result = mysql_use_result(connection1);
00244                 if (result)
00245                 {
00246                         while ((sqlrow = mysql_fetch_row (result)))
00247                         {
00248                                 strcpy(dat,sqlrow[0]);
00249                         }
00250                 }
00251                 mysql_free_result(result);
00252         }
00253 }

void view_onRowActivated ( GtkTreeView *  treeview,
GtkTreePath *  path,
GtkTreeViewColumn *  col,
gpointer  userdata 
)

view_onRowActivated is the caller function called when a row on the list structure is clicked

Returns:
void
Parameters:
treeview is an instance of tree view created
path refers to the specific row that is clicked
col refers to the columns of the list
userdata is the data sent to this caller function

Definition at line 1138 of file mainProject.c.

References a, b, box_remove(), COL_FIRST, COL_SECOND, COL_THIRD, connection1, create_dialog_box(), create_view_and_model(), dd_upd, del_form, display_dialog(), eve, g_daily, g_event_upd, g_hour, g_min, g_monthly, g_once, g_weekly, g_yearly, menu_bar, mm_upd, pid, query(), result, sqlrow, str, update_add, vbox, and yy_upd.

Referenced by create_view_and_model().

01139 {
01140     FILE *fp;
01141     GtkWidget *view,*frame2,*scroller;
01142     GtkWidget *frame1;
01143     GtkTreeModel *model;
01144     GtkTreeIter   iter;
01145     char time[10],type[10],p_id[6];
01146     int res=0,pid=0,k=0;
01147     char query[300],ch,r[5];
01148 
01149     system("ps -C poll -o pid|tail -1|sed 's/ //' > temp.txt");
01150         fp=fopen("temp.txt","r");
01151         if(fp)
01152         {
01153                 while((ch=fgetc(fp))!=EOF)
01154                 {
01155                         p_id[k]=ch;
01156                         k++;
01157                 }
01158                 p_id[k]='\0';
01159         }
01160         pid=atoi(p_id);
01161     k=0;
01162 
01163     model = gtk_tree_view_get_model(treeview);
01164     if (gtk_tree_model_get_iter(model, &iter, path))
01165     {
01166         gchar *name;
01167         gtk_tree_model_get(model, &iter,COL_FIRST, &name, -1);
01168         strcpy(time,name);
01169         gtk_tree_model_get(model, &iter, COL_SECOND, &name, -1);
01170         strcpy(eve,name);
01171         gtk_tree_model_get(model, &iter, COL_THIRD, &name, -1);
01172         strcpy(type,name);
01173 
01174         a=atoi(time);
01175         b=atoi(time+3);
01176         strcpy(r,time+6);
01177 
01178         if(strcmp(r,"PM")==0 && a>=1 && a<=11)
01179             {
01180                     a+=12;
01181             }
01182 
01183             if(strcmp(r,"AM")==0 && a==12)
01184             {
01185                     a-=12;
01186             }
01187 
01188 
01189 
01190         if(del_form==1)     /*ONLY IF DELETE FORM*/
01191         {
01192             if(strcmp(type,"Once")==0)
01193             {
01194                 sprintf(query,"delete from ers where hour=%d and min=%d and event='%s' and o=1",a,b,eve);
01195                 res=mysql_query(connection1,query);
01196             }
01197             else if(strcmp(type,"Daily")==0)
01198             {
01199                 sprintf(query,"delete from ers where hour=%d and min=%d and event='%s' and d=1",a,b,eve);
01200                 res=mysql_query(connection1,query);
01201             }
01202             else if(strcmp(type,"Weekly")==0)
01203             {
01204                 sprintf(query,"delete from ers where hour=%d and min=%d and event='%s' and w=1",a,b,eve);
01205                 res=mysql_query(connection1,query);
01206             }
01207             else if(strcmp(type,"Monthly")==0)
01208             {
01209                 sprintf(query,"delete from ers where hour=%d and min=%d and event='%s' and m=1",a,b,eve);
01210                 res=mysql_query(connection1,query);
01211             }
01212             else if(strcmp(type,"Yearly")==0)
01213             {
01214                 sprintf(query,"delete from ers where hour=%d and min=%d and event='%s' and y=1",a,b,eve);
01215                 res=mysql_query(connection1,query);
01216             }
01217             
01218 
01219             if(res!=0)
01220                 display_dialog("Deletion Failed!!");
01221             else 
01222             {       
01223                 kill(pid,SIGUSR1);
01224                 view = create_view_and_model();
01225                 /*Create a frame*/
01226                 frame2=gtk_frame_new( "Delete Event" );
01227                 scroller=gtk_scrolled_window_new(NULL,NULL);
01228                 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroller),GTK_POLICY_ALWAYS,GTK_POLICY_ALWAYS);
01229                 gtk_widget_set_size_request(scroller,200,250);
01230                 gtk_container_add (GTK_CONTAINER (scroller),view);
01231                 gtk_container_add (GTK_CONTAINER (frame2),scroller);
01232                 /*Remove Extra Widgets*/
01233                 box_remove(menu_bar,GTK_BOX(vbox));
01234                 gtk_box_pack_start (GTK_BOX (vbox),frame2, FALSE, FALSE, 2);
01235                 gtk_widget_show(view);
01236                 gtk_widget_show(frame2);
01237                 gtk_widget_show(scroller);
01238                 display_dialog("Deletion Successfull!!");
01239             }
01240         }
01241 
01242         else if(update_add==1)          /*IF UPDATE FORM*/
01243         {
01244 
01245             if(strcmp(type,"Once")==0)
01246             {
01247                 sprintf(query,"select id,dt,hour,min,event,o,d,w,m,y from ers where hour=%d and min=%d and event='%s' and o=1",a,b,eve);
01248                 res=mysql_query(connection1,query);
01249             }
01250             else if(strcmp(type,"Daily")==0)
01251             {
01252                 sprintf(query,"select id,dt,hour,min,event,o,d,w,m,y from ers where hour=%d and min=%d and event='%s' and d=1",a,b,eve);
01253                 res=mysql_query(connection1,query);
01254             }
01255             else if(strcmp(type,"Weekly")==0)
01256             {
01257                 sprintf(query,"select id,dt,hour,min,event,o,d,w,m,y from ers where hour=%d and min=%d and event='%s' and w=1",a,b,eve);
01258                 res=mysql_query(connection1,query);
01259             }
01260             else if(strcmp(type,"Monthly")==0)
01261             {
01262                 sprintf(query,"select id,dt,hour,min,event,o,d,w,m,y from ers where hour=%d and min=%d and event='%s' and m=1",a,b,eve);
01263                 res=mysql_query(connection1,query);
01264             }
01265             else if(strcmp(type,"Yearly")==0)
01266             {
01267                 sprintf(query,"select id,dt,hour,min,event,o,d,w,m,y from ers where hour=%d and min=%d and event='%s' and y=1",a,b,eve);
01268                 res=mysql_query(connection1,query);
01269             }
01270 
01271             if(res!=0)
01272             {
01273                 printf("SELECT FAILED");
01274             }
01275             else
01276             {
01277                 result=mysql_use_result(connection1);
01278                 if(result)
01279                 {
01280                     while ((sqlrow = mysql_fetch_row (result)))
01281                     {
01282                         id=atoi(sqlrow[0]);
01283                         strcpy(str,sqlrow[1]);
01284                         g_hour=atoi(sqlrow[2]);
01285                         g_min=atoi(sqlrow[3]);
01286                         strcpy(g_event_upd,sqlrow[4]);
01287                         g_once=atoi(sqlrow[5]);
01288                         g_daily=atoi(sqlrow[6]);
01289                         g_weekly=atoi(sqlrow[7]);
01290                         g_monthly=atoi(sqlrow[8]);      
01291                         g_yearly=atoi(sqlrow[9]);
01292                     }
01293                             }
01294                             mysql_free_result(result);
01295                     }
01296             /*Parsing Year,Month,Day from standard format*/
01297 
01298             int l=0,m=0,n=0;
01299             for(l=0;str[l]!='-';l++)
01300             {
01301                 yy_upd[m]=str[l];
01302                 m++;
01303             }
01304             yy_upd[m]='\0';
01305             m=0;
01306             l++;
01307             
01308             for(n=l;str[n]!='-';n++)
01309             {
01310                 mm_upd[m]=str[n];
01311                 m++;
01312             }
01313             mm_upd[m]='\0';
01314             m=0;
01315             n++;
01316 
01317             for(l=n;str[l];l++)
01318             {
01319                 dd_upd[m]=str[l];
01320                 m++;
01321             }
01322             dd_upd[m]='\0';
01323             m=0;
01324             n=0;
01325             l=0;
01326             
01327             frame1=create_dialog_box("Hi");
01328             box_remove(menu_bar,GTK_BOX(vbox));
01329             gtk_box_pack_start (GTK_BOX (vbox),frame1, FALSE, FALSE, 2);
01330         }
01331     }
01332 }

void week_calc ( date  tp,
char  d[5] 
)

week_calc return the day of a week for a given date

Returns:
void
Parameters:
tp structure variable to receive the date whose correspoding week has to be found
d pointer where day of the week will be returned

Definition at line 35 of file mainProject.c.

References date::dd, date::mm, mnts, and date::yy.

Referenced by match_answer().

00036 {
00037     int mnts[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
00038     char week[7][4];
00039     int maxday,flg;
00040     long int diff;
00041     date pd,t1,t2;
00042     pd.dd=4;pd.mm=9;pd.yy=2005;
00043     if(pd.yy>tp.yy)
00044     {
00045         t1.dd=tp.dd;t1.mm=tp.mm;t1.yy=tp.yy;
00046         t2.dd=pd.dd;t2.mm=pd.mm;t2.yy=pd.yy;
00047         flg=1;
00048     }
00049     else if(tp.yy>pd.yy)
00050     {
00051         t1.dd=pd.dd;t1.mm=pd.mm;t1.yy=pd.yy;
00052         t2.dd=tp.dd;t2.mm=tp.mm;t2.yy=tp.yy;
00053         flg=2;
00054     }
00055     else if(tp.yy==pd.yy)
00056     {
00057         if(pd.mm>tp.mm)
00058         {
00059             t1.dd=tp.dd;t1.mm=tp.mm;t1.yy=tp.yy;
00060             t2.dd=pd.dd;t2.mm=pd.mm;t2.yy=pd.yy;
00061             flg=1;
00062         }
00063         else if(tp.mm>pd.mm)
00064         {
00065             t1.dd=pd.dd;t1.mm=pd.mm;t1.yy=pd.yy;
00066             t2.dd=tp.dd;t2.mm=tp.mm;t2.yy=tp.yy;
00067             flg=2;
00068         }
00069         else if(tp.mm==pd.mm)
00070         {
00071             if(pd.dd>tp.dd)
00072             {
00073                 t1.dd=tp.dd;t1.mm=tp.mm;t1.yy=tp.yy;
00074                 t2.dd=pd.dd;t2.mm=pd.mm;t2.yy=pd.yy;
00075                 flg=1;
00076             }
00077             else if(tp.dd>pd.dd)
00078             {
00079                 t1.dd=pd.dd;t1.mm=pd.mm;t1.yy=pd.yy;
00080                 t2.dd=tp.dd;t2.mm=tp.mm;t2.yy=tp.yy;
00081                 flg=2;
00082             }
00083             else if(pd.dd==tp.dd)
00084             {
00085                 t1.dd=tp.dd;t1.mm=tp.mm;t1.yy=tp.yy;
00086                 t2.dd=pd.dd;t2.mm=pd.mm;t2.yy=pd.yy;
00087                 flg=1;
00088             }
00089         }
00090     }
00091     strcpy(week[0],"Mon");
00092     strcpy(week[1],"Tue");
00093     strcpy(week[2],"Wed");
00094     strcpy(week[3],"Thu");
00095     strcpy(week[4],"Fri");
00096     strcpy(week[5],"Sat");
00097     strcpy(week[6],"Sun");
00098     if(flg==1)
00099     {
00100         diff=6;
00101         while(t2.dd!=t1.dd || t2.mm!=t1.mm || t2.yy!=t1.yy)
00102         {
00103             if(t2.mm==1 && t2.dd<=1)
00104             {
00105                 t2.yy--;
00106                 t2.mm=12;
00107                 t2.dd=31;
00108                 diff--;
00109                 if(diff<0)
00110                     diff=6;
00111             }
00112             else if(t2.dd<=1 && t2.mm!=1)
00113             {
00114                 t2.mm--;
00115                 if(t2.yy%100==0)
00116                 {
00117                     if(t2.yy%400==0)
00118                         mnts[2]=29;
00119                 }
00120                 else if(t2.yy%4==0)
00121                     mnts[2]=29;
00122                 maxday=mnts[t2.mm];
00123                 mnts[2]=28;
00124                 t2.dd=maxday;
00125                 diff--;
00126                 if(diff<0)
00127                     diff=6;
00128             }
00129             else
00130             {
00131                 t2.dd--;
00132                 diff--;
00133                 if(diff<0)
00134                     diff=6;
00135             }
00136         }
00137     }
00138     else if(flg==2)
00139     {
00140         diff=6;
00141         while(t1.dd!=t2.dd || t1.mm!=t2.mm || t1.yy!=t2.yy)
00142         {
00143             if(t1.yy%100==0)
00144             {
00145                 if(t1.yy%400==0)
00146                     mnts[2]=29;
00147             }
00148             else if(t1.yy%4==0)
00149                 mnts[2]=29;
00150             maxday=mnts[t1.mm];
00151             mnts[2]=28;
00152             if(t1.mm==12 && t1.dd>=31)
00153             {
00154                 t1.yy++;
00155                 t1.mm=1;
00156                 t1.dd=1;
00157                 diff++;
00158                 if(diff>6)
00159                     diff=0;
00160             }
00161             else if(t1.dd>=maxday && t1.mm!=12)
00162             {
00163                 t1.mm++;
00164                 t1.dd=1;
00165                 diff++;
00166                 if(diff>6)
00167                     diff=0;
00168             }
00169             else
00170             {
00171                 t1.dd++;
00172                 diff++;
00173                 if(diff>6)
00174                     diff=0;
00175             }
00176         }
00177     }
00178     strcpy(d,week[diff]);
00179 }


Variable Documentation

int a = 0

Definition at line 349 of file mainProject.c.

Referenced by main(), and view_onRowActivated().

char answer[10]

Definition at line 187 of file mainProject.c.

Referenced by callback().

int b = 0

Definition at line 349 of file mainProject.c.

Referenced by main(), and view_onRowActivated().

int check_flag = 0

Definition at line 202 of file mainProject.c.

Referenced by create_connection(), and display_row().

int combo_cnt = 0

Definition at line 349 of file mainProject.c.

MYSQL* connection1
char curdate[50]

Definition at line 353 of file mainProject.c.

Referenced by calendar_day_double_clicked(), and create_and_fill_model().

int day1

Definition at line 349 of file mainProject.c.

Referenced by calendar_day_double_clicked(), and create_dialog_box().

char dd_upd[6]

Definition at line 353 of file mainProject.c.

Referenced by create_dialog_box(), and view_onRowActivated().

int del_form = 0

Definition at line 189 of file mainProject.c.

Referenced by create_view_and_model(), menuitem_response(), and view_onRowActivated().

GtkWidget* disp

Definition at line 352 of file mainProject.c.

Referenced by create_dialog_box(), and match_answer().

char eve[100]

Definition at line 353 of file mainProject.c.

Referenced by view_onRowActivated().

gchar * g_am_pm

Definition at line 351 of file mainProject.c.

Referenced by cb_changed_AM_PM(), and match_answer().

int g_daily = 0

Definition at line 349 of file mainProject.c.

Referenced by create_dialog_box(), match_answer(), and view_onRowActivated().

gchar* g_dd

Definition at line 351 of file mainProject.c.

Referenced by cb_changed_dd(), and match_answer().

const gchar* g_event

Definition at line 350 of file mainProject.c.

Referenced by match_answer(), and query().

char g_event_upd[100]

Definition at line 353 of file mainProject.c.

Referenced by create_dialog_box(), and view_onRowActivated().

int g_hour = 0
int g_min = 0
gchar * g_mm

Definition at line 351 of file mainProject.c.

Referenced by cb_changed_mm(), and match_answer().

int g_monthly = 0

Definition at line 349 of file mainProject.c.

Referenced by create_dialog_box(), match_answer(), and view_onRowActivated().

int g_once = 0

Definition at line 349 of file mainProject.c.

Referenced by create_dialog_box(), match_answer(), and view_onRowActivated().

int g_weekly = 0

Definition at line 349 of file mainProject.c.

Referenced by create_dialog_box(), match_answer(), and view_onRowActivated().

int g_yearly = 0

Definition at line 349 of file mainProject.c.

Referenced by create_dialog_box(), match_answer(), and view_onRowActivated().

gchar * g_yy

Definition at line 351 of file mainProject.c.

Referenced by cb_changed_yy(), and match_answer().

int id = 0

Definition at line 349 of file mainProject.c.

GtkWidget* menu_bar

Definition at line 192 of file mainProject.c.

Referenced by create_master_form(), menuitem_response(), and view_onRowActivated().

char mm_upd[6]

Definition at line 353 of file mainProject.c.

Referenced by create_dialog_box(), and view_onRowActivated().

int month1

Definition at line 349 of file mainProject.c.

Referenced by calendar_day_double_clicked(), and create_dialog_box().

int month_init = 0

Definition at line 349 of file mainProject.c.

Referenced by calendar_day_double_clicked(), and match_answer().

char* months[]
Initial value:
{
    "January",
    "February",
    "March",    
    "April",
    "May",
    "June",
    "July",
    "August",
    "September",
    "October",
    "Novemeber",
    "December"
}

Definition at line 495 of file mainProject.c.

Referenced by create_combobox_months(), and get_time().

int parent_flag = 0

Definition at line 189 of file mainProject.c.

Referenced by calendar_day_double_clicked(), and delete_event_master().

int pid = 0
int radio_flag = 0

Definition at line 189 of file mainProject.c.

Referenced by callback(), and match_answer().

MYSQL_RES* result
int show_all = 0

Definition at line 189 of file mainProject.c.

Referenced by create_view_and_model(), and menuitem_response().

MYSQL_ROW sqlrow
MYSQL_ROW sqlrow1

Definition at line 201 of file mainProject.c.

char str[50]

Definition at line 353 of file mainProject.c.

Referenced by get_time(), match_answer(), and view_onRowActivated().

gint temp

Definition at line 188 of file mainProject.c.

Referenced by grab_int_value_hour(), grab_int_value_min(), and main().

int update_add = 0
GtkWidget* vbox

Definition at line 191 of file mainProject.c.

Referenced by create_master_form(), menuitem_response(), and view_onRowActivated().

GtkWidget * window

Definition at line 352 of file mainProject.c.

Referenced by create_master_form(), and main().

GtkWidget * window1

Definition at line 352 of file mainProject.c.

Referenced by create_master_form(), and main().

int year1

Definition at line 349 of file mainProject.c.

Referenced by calendar_day_double_clicked(), and create_dialog_box().

int year_init = 0

Definition at line 349 of file mainProject.c.

Referenced by calendar_day_double_clicked(), and match_answer().

char yy_upd[6]

Definition at line 353 of file mainProject.c.

Referenced by create_dialog_box(), and view_onRowActivated().

 All Data Structures Files Functions Variables Enumerator

Generated on Wed Apr 7 18:55:21 2010 for Doxygentestproject by  doxygen 1.6.1