[gcompris] bar: added the keyboard shortcut ctrl-b do hide/show the GCompris control bar.



commit 224541aa158537cf5a15e85943bcc0b640cabeb6
Author: Pawel <dpa o2 pl>
Date:   Thu Jun 2 09:48:59 2011 +0200

    bar: added the keyboard shortcut ctrl-b do hide/show the GCompris control bar.

 src/gcompris/bar.c        |    4 +++-
 src/gcompris/gcompris.c   |   15 +++++++++++++++
 src/gcompris/properties.c |    2 +-
 src/gcompris/properties.h |    2 ++
 4 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/src/gcompris/bar.c b/src/gcompris/bar.c
index ee65bc9..7f9428d 100644
--- a/src/gcompris/bar.c
+++ b/src/gcompris/bar.c
@@ -438,6 +438,7 @@ bar_set (const GComprisBarFlags flags)
 static void
 bar_hide (gboolean hide)
 {
+  GcomprisProperties *properties = gc_prop_get();
   /* Non yet initialized : Something Wrong */
   if ( ! rootitem )
     return;
@@ -451,7 +452,8 @@ bar_hide (gboolean hide)
     }
   else
     {
-      g_object_set(rootitem,
+      if(!properties->bar_hidden)
+        g_object_set(rootitem,
 		   "visibility", GOO_CANVAS_ITEM_VISIBLE, NULL);
     }
 
diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c
index 76e336f..6e98f96 100644
--- a/src/gcompris/gcompris.c
+++ b/src/gcompris/gcompris.c
@@ -328,6 +328,21 @@ board_widget_key_press_callback (GtkWidget   *widget,
 {
   int kv = event->keyval;
 
+  if(event->state & GDK_CONTROL_MASK && ((event->keyval == GDK_b)
+					 || (event->keyval == GDK_B))) {
+    if(properties->bar_hidden){
+      g_message("Restoring the control bar\n");
+      properties->bar_hidden=FALSE;
+      gc_bar_hide(properties->bar_hidden);
+    }
+    else{
+      g_message("Hidding the control bar\n");
+      properties->bar_hidden=TRUE;
+      gc_bar_hide(properties->bar_hidden);
+    };
+    goo_canvas_update(GOO_CANVAS(canvas));
+    return TRUE;
+  }
   if(event->state & GDK_CONTROL_MASK && ((event->keyval == GDK_r)
 					 || (event->keyval == GDK_R))) {
     g_message("Refreshing the canvas\n");
diff --git a/src/gcompris/properties.c b/src/gcompris/properties.c
index cd36624..c846b18 100644
--- a/src/gcompris/properties.c
+++ b/src/gcompris/properties.c
@@ -185,7 +185,7 @@ gc_prop_new ()
   tmp->config_dir = gc_prop_default_config_directory_get();
   tmp->user_dir = gc_prop_default_user_directory_get();
   tmp->database = NULL;
-
+  tmp->bar_hidden = FALSE;
   return (tmp);
 }
 
diff --git a/src/gcompris/properties.h b/src/gcompris/properties.h
index e95e697..5770c95 100644
--- a/src/gcompris/properties.h
+++ b/src/gcompris/properties.h
@@ -68,6 +68,8 @@ typedef struct {
   gchar        *server;
   gint		drag_mode;
   gint		zoom;
+  gboolean	bar_hidden;  /* Is the bar hiden */
+
 } GcomprisProperties;
 
 GcomprisProperties	*gc_prop_get (void);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]