[gade] Added more basic stuff



commit db8f9e3cfc7add8e47c1f7af59094ffc8251ead9
Author: Jonh Wendell <jwendell gnome org>
Date:   Mon Mar 8 16:05:56 2010 -0300

    Added more basic stuff

 gade/Makefile.am        |    5 +--
 gade/gade-notebook.vala |    1 +
 gade/gade-ui.vala       |   50 ---------------------------
 gade/gade-window.vala   |   85 +++++++++++++++++++++++++++++++++++++++++++++--
 vapi/config.vapi        |    1 +
 5 files changed, 86 insertions(+), 56 deletions(-)
---
diff --git a/gade/Makefile.am b/gade/Makefile.am
index 2fec546..503043c 100644
--- a/gade/Makefile.am
+++ b/gade/Makefile.am
@@ -25,10 +25,9 @@ bin_PROGRAMS = gade
 
 gade_SOURCES = \
 	gade-main.vala          \
-	gade-window.vala        \
-	gade-ui.vala            \
 	gade-notebook.vala            \
-	gade-tab-label.vala
+	gade-tab-label.vala            \
+	gade-window.vala
 
 gade_LDFLAGS = \
 	-Wl,--export-dynamic	\
diff --git a/gade/gade-notebook.vala b/gade/gade-notebook.vala
index 4ffcc21..e3145e3 100644
--- a/gade/gade-notebook.vala
+++ b/gade/gade-notebook.vala
@@ -28,6 +28,7 @@ namespace Gade {
 
       public Notebook ()
         {
+          //stdout.printf ("Notebook\n");
         }
 
     }
diff --git a/gade/gade-window.vala b/gade/gade-window.vala
index 9645aa0..913d3ae 100644
--- a/gade/gade-window.vala
+++ b/gade/gade-window.vala
@@ -31,9 +31,37 @@ namespace Gade {
       private Statusbar statusbar;
       private VBox main_vbox;
       private UIManager manager;
+      private uint sb_tip;
 
       public Notebook notebook { get {return _notebook;} }
 
+      const ActionEntry[] entries = {
+        /* Toplevel */
+          { "Secretary", null, N_("_Secretary") },
+          { "Finances", null, N_("_Finances") },
+          { "View", null, N_("_View") },
+          { "Help", null, N_("_Help") },
+
+        /* Secretary Menu */
+          { "SecretaryChurch", null, N_("_Church"), null, N_("Edit church data"), null },
+          { "SecretaryMembers", "system-users", N_("_Members"), null, N_("Edit members"), null },
+          { "SecretaryQuit", STOCK_QUIT, null, "<control>Q", N_("Quit the program"), main_quit },
+
+        /* Finances Menu */
+          { "FinancesIncomes", "down", N_("_Incomes"), null, N_("Manage incomes"), null },
+          { "FinancesExpenses", "up", N_("_Expenses"), null, N_("Manage expenses"), null },
+
+        /* Help menu */
+          { "HelpContents", STOCK_HELP, N_("_Contents"), "F1", N_("Open the manual"),  null },
+          { "HelpAbout", STOCK_ABOUT, null, null, N_("About this application"), show_about }
+      };
+
+      const ToggleActionEntry[] toggle_entries = {
+        /* View Menu */
+          { "ViewToolbar", "null", N_("_Toolbar"), null, N_("Show or hide the toolbar"), null, false },
+          { "ViewStatusbar", "null", N_("_Statusbar"), null, N_("Show or hide the statusbar"), null, false }
+      };
+
       public Window ()
         {
           title = Environment.get_application_name ();
@@ -50,6 +78,7 @@ namespace Gade {
           main_vbox.pack_start (_notebook, true, true, 0);
 
           statusbar = new Gtk.Statusbar ();
+          sb_tip = statusbar.get_context_id ("hints");
           main_vbox.pack_start (statusbar, false, false, 0);
         }
 
@@ -66,9 +95,13 @@ namespace Gade {
             }
           }
 
+          add_accel_group (manager.get_accel_group ());
+          manager.connect_proxy.connect (connect_proxy);
+          manager.disconnect_proxy.connect (disconnect_proxy);
+
           var ag = new ActionGroup ("AllGroups");
-          ag.add_actions (entries, null);
-          ag.add_toggle_actions (toggle_entries, null);
+          ag.add_actions (entries, this);
+          ag.add_toggle_actions (toggle_entries, this);
           manager.insert_action_group (ag, 0);
 
           menubar = manager.get_widget ("/MenuBar") as MenuBar;
@@ -76,6 +109,52 @@ namespace Gade {
 
           toolbar = manager.get_widget ("/ToolBar") as Toolbar;
           main_vbox.pack_start (toolbar, false, false, 0);
+      }
+
+      public void show_about (Action action)
+        {
+          string[] authors = {"Jonh Wendell <wendell bani com br>", null};
+          string comment = _("Gade is a Church Management application designed for the GNOME desktop");
+
+          show_about_dialog (this,
+                             "authors", authors,
+                             "copyright", "Copyright © 2010 Jonh Wendell",
+                             "translator-credits", _("translator-credits"),
+                             "comments", comment,
+                             "version", Config.VERSION,
+                             "website", "http://live.gnome.org/Gade";,
+                             null);
+        }
+
+      private void connect_proxy (Action action, Widget widget)
+        {
+          if (widget is MenuItem)
+            {
+              (widget as MenuItem).select.connect (menu_item_selected);
+              (widget as MenuItem).deselect.connect (menu_item_deselected);
+            }
+        }
+
+      private void disconnect_proxy (Action action, Widget widget)
+        {
+          if (widget is MenuItem)
+            {
+              (widget as MenuItem).select.disconnect (menu_item_selected);
+              (widget as MenuItem).deselect.disconnect (menu_item_deselected);
+            }
+        }
+
+      private void menu_item_selected (Item source)
+        {
+          Action action = source.get_data ("gtk-action") as Action;
+          if (action.tooltip != null)
+            statusbar.push (sb_tip, action.tooltip);
+        }
+
+      private void menu_item_deselected ()
+        {
+          statusbar.pop (sb_tip);
         }
-    }
+  }
+
 }
\ No newline at end of file
diff --git a/vapi/config.vapi b/vapi/config.vapi
index ffc989c..21f79e7 100644
--- a/vapi/config.vapi
+++ b/vapi/config.vapi
@@ -5,6 +5,7 @@ namespace Config
   public const string PACKAGE_NAME;
   public const string PACKAGE_STRING;
   public const string PACKAGE_VERSION;
+  public const string VERSION;
 
   /* Gettext package */
   public const string GETTEXT_PACKAGE;



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