Action on help button.
authorMrinmayee Hingolikar <mrinmayee@ti.com>
Tue, 8 Jan 2013 16:54:07 +0000 (22:24 +0530)
committerMrinmayee <mrinmayee@ubuntu.(none)>
Tue, 8 Jan 2013 16:54:07 +0000 (22:24 +0530)
src/gui.c

index 2ae5523def6e5d61a0875a0cba10f5ae7814460d..db6bdd65f97901d17df735e59fdac7842337b19e 100644 (file)
--- a/src/gui.c
+++ b/src/gui.c
@@ -83,10 +83,11 @@ static gboolean cbPlayClicked (GtkWidget *widget, gpointer data);
 static gboolean cbPauseClicked (GtkWidget *widget, gpointer data);
 static gboolean cbStopClicked (GtkWidget *widget, gpointer data);
 static gboolean cbWindowClosed (GtkWidget *widget, gpointer data);
+static gboolean cbHelpClicked (GtkWidget *widget, gpointer data);
 static gboolean cbTimerInterval (gpointer data);
 static gboolean cbSeekValueChanged (GtkWidget *widget, gpointer data);
 static gboolean cbSwitchButtonClicked (GtkWidget *widget, gpointer data);
-
+static gboolean cbHelpClosed (GtkWidget *widget, gpointer data);
 //static void logGUI (GtkWidget *logWindow, gchar *format, ...); 
 
 static gint setAbsolutePathname (gchar *file, gchar **uri)                             
@@ -478,6 +479,17 @@ static gboolean cbWindowClosed(GtkWidget *widget, gpointer data){
     return TRUE;
 }
 
+static gboolean cbHelpClicked (GtkWidget *widget, gpointer data){
+    g_print ("HELP BUTTON CLICKED\n");
+    gtk_widget_show (helpWindow);
+    return TRUE;
+}
+
+static gboolean cbHelpClosed (GtkWidget *widget, gpointer data){
+    g_print ("IN HELP CLOSED\n");
+    gtk_widget_hide (helpWindow);
+    return TRUE;
+}
 /******************************************************************************
  *     static utility functions definition
  ******************************************************************************/
@@ -808,6 +820,11 @@ static GUIWindow *createWindow()
                        G_CALLBACK(cbPlayClicked),
                        ret);
 
+    ret->playSignal = g_signal_connect(G_OBJECT(ret->helpButton),               
+            "clicked",                                                          
+            G_CALLBACK(cbHelpClicked),                                          
+            ret);   
+
 
        ret->switchButton = DualDecode_getWidget("switchButtonSingle");
        if(NULL == ret->switchButton){
@@ -859,10 +876,28 @@ static GtkWidget *createLogWindow()
 
 static GtkWidget *createHelpWindow()
 {
-       /*TODO: create help window*/
-       return gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    GtkWidget * helpWindow;
+    gint width;
+    gint height;
+
+    helpWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+    gtk_window_set_title ( (GtkWindow *) helpWindow, "Help");
+    gtk_window_set_resizable ( (GtkWindow * )helpWindow, FALSE);
+
+    /*Set size same as display windows*/
+    gtk_widget_get_size_request (window[DECODER_INDEX_SINGLE]->window,
+                                 &width,
+                                 &height);  
+    gtk_widget_set_size_request (helpWindow, width, height);
+    /*Connect signal to close button handler*/
+    g_signal_connect(G_OBJECT (helpWindow), "delete-event", 
+      G_CALLBACK (cbHelpClosed), NULL);
+    g_print ("RETURNING FROM CREATE HELP\n");
+    return helpWindow;
 }
 
+
+                                                         
 /*static void logGUI(GtkWidget *logWindow, gchar *format, ...)
 {
        //TODO: dummy now
@@ -952,7 +987,7 @@ void DualDecode_startApplication()
        setWindowSizeLocation();
 
        helpWindow = createHelpWindow();
-       g_assert(helpWindow != NULL);
+       g_assert (helpWindow != NULL);
 
        logWindow[DECODER_INDEX_SINGLE] = createLogWindow();
        g_assert (logWindow[DECODER_INDEX_SINGLE] != NULL);
@@ -987,7 +1022,7 @@ void DualDecode_exitApplication()
        g_free(window[DECODER_INDEX_DOUBLE]);
        gtk_widget_destroy(logWindow[DECODER_INDEX_SINGLE]);
        gtk_widget_destroy(logWindow[DECODER_INDEX_DOUBLE]);
-       gtk_widget_destroy(helpWindow);
+       gtk_widget_destroy (helpWindow);
 
        /*TODO: destroy pipes here*/