r67 - in trunk/src/target/OM-2007: examples/openmoko-paned-demo libraries/mokoui

mickey at gta01.hmw-consulting.de mickey at gta01.hmw-consulting.de
Mon Oct 2 21:43:20 CEST 2006


Author: mickey
Date: 2006-10-02 19:43:19 +0000 (Mon, 02 Oct 2006)
New Revision: 67

Added:
   trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.c
   trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.h
Removed:
   trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.c
   trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.h
Modified:
   trunk/src/target/OM-2007/examples/openmoko-paned-demo/demo-main.c
   trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.c
   trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.h
   trunk/src/target/OM-2007/libraries/mokoui/mokoui.pro
Log:
remove MokoMenuBar and add MokoMenuBox containing the GtkMenuBar and GtkOptionMenu instead


Modified: trunk/src/target/OM-2007/examples/openmoko-paned-demo/demo-main.c
===================================================================
--- trunk/src/target/OM-2007/examples/openmoko-paned-demo/demo-main.c	2006-10-02 08:59:40 UTC (rev 66)
+++ trunk/src/target/OM-2007/examples/openmoko-paned-demo/demo-main.c	2006-10-02 19:43:19 UTC (rev 67)
@@ -19,7 +19,6 @@
 
 #include <mokoui/moko-application.h>
 #include <mokoui/moko-paned-window.h>
-#include <mokoui/moko-menubar.h>
 #include <mokoui/moko-toolbar.h>
 
 #include <gtk/gtkactiongroup.h>
@@ -27,6 +26,7 @@
 #include <gtk/gtkcheckmenuitem.h>
 #include <gtk/gtkmain.h>
 #include <gtk/gtkmenu.h>
+#include <gtk/gtkmenutoolbutton.h>
 #include <gtk/gtkstock.h>
 #include <gtk/gtktoolbutton.h>
 #include <gtk/gtkuimanager.h>
@@ -35,109 +35,9 @@
 
 #include <stdlib.h>
 
-/* Obligatory basic callback */
-static void print_hello( GtkWidget *w,
-                         gpointer   data )
-{
-    g_message ("Hello, World!\n");
-}
-
-/* For the check button */
-static void print_toggle( gpointer   callback_data,
-                          guint      callback_action,
-                          GtkWidget *menu_item )
-{
-    g_message ("Check button state - %d\n",
-               GTK_CHECK_MENU_ITEM (menu_item)->active);
-}
-
-/* For the radio buttons */
-static void print_selected( gpointer   callback_data,
-                            guint      callback_action,
-                            GtkWidget *menu_item )
-{
-    if(GTK_CHECK_MENU_ITEM(menu_item)->active)
-        g_message ("Radio button %d selected\n", callback_action);
-}
-
-/* Normal items */
-static const GtkActionEntry entries[] = {
-    { "FileMenu", NULL, "_File" },
-    { "ViewMenu", NULL, "_View" },
-    { "Open", GTK_STOCK_OPEN, "_Open", "<control>O", "Open a file", print_hello },
-    { "Exit", GTK_STOCK_QUIT, "E_xit", "<control>Q", "Exit the program", print_hello },
-    { "ZoomIn", GTK_STOCK_ZOOM_IN, "Zoom _In", "plus", "Zoom into the image", print_hello },
-    { "ZoomOut", GTK_STOCK_ZOOM_OUT, "Zoom _Out", "minus", "Zoom away from the image", print_hello },
-};
-
-/* Toggle items */
-static const GtkToggleActionEntry toggle_entries[] = {
-    { "FullScreen", NULL, "_Full Screen", "F11", "Switch between full screen and windowed mode", print_hello, FALSE }
-};
-
-/* Radio items */
-static const GtkRadioActionEntry radio_entries[] = {
-    { "HighQuality", "my-stock-high-quality", "_High Quality", NULL, "Display images in high quality, slow mode", 0 },
-    { "NormalQuality", "my-stock-normal-quality", "_Normal Quality", NULL, "Display images in normal quality", 1 },
-    { "LowQuality", "my-stock-low-quality", "_Low Quality", NULL, "Display images in low quality, fast mode", 2 }
-};
-
-static const char* application_menu_ui =
-        "<ui>"
-        "   <menu action='ApplicationMenu'>"
-        "       <menuitem action='Open'/>"
-        "       <menuitem action='Exit'/>"
-        "   </menu>"
-        "</ui>"
-        ;
-
-static const char *ui_description =
-        "<ui>"
-        "  <menubar name='MainMenu'>"
-        "    <menu action='FileMenu'>"
-        "      <menuitem action='Open'/>"
-        "      <menuitem action='Exit'/>"
-        "    </menu>"
-        "    <menu action='ViewMenu'>"
-        "      <menuitem action='ZoomIn'/>"
-        "      <menuitem action='ZoomOut'/>"
-        "      <separator/>"
-        "      <menuitem action='FullScreen'/>"
-        "      <separator/>"
-        "      <menuitem action='HighQuality'/>"
-        "      <menuitem action='NormalQuality'/>"
-        "      <menuitem action='LowQuality'/>"
-        "    </menu>"
-        "  </menubar>"
-        "</ui>";
-
-static GtkWidget* get_menubar_menu( GtkWindow* window )
-{
-    GtkActionGroup* action_group = gtk_action_group_new ("MenuActions");
-    gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), window);
-    gtk_action_group_add_toggle_actions (action_group, toggle_entries, G_N_ELEMENTS (toggle_entries), window);
-    gtk_action_group_add_radio_actions (action_group, radio_entries, G_N_ELEMENTS (radio_entries), 0, print_selected, window);
-
-    GtkUIManager* ui_manager = gtk_ui_manager_new ();
-    gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
-
-    GtkAccelGroup* accel_group = gtk_ui_manager_get_accel_group (ui_manager);
-    gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
-
-    GError* error = NULL;
-    if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, &error))
-    {
-        g_message ("building menus failed: s", error->message);
-        g_error_free (error);
-        exit (EXIT_FAILURE);
-    }
-
-    return gtk_ui_manager_get_widget (ui_manager, "/MainMenu");
-}
-
 int main( int argc, char** argv )
 {
-    g_debug( "OPENMOKO-PANED-DEMO starting up" );
+    g_debug( "openmoko-paned-demo starting up" );
     /* Initialize GTK+ */
     gtk_init( &argc, &argv );
 
@@ -171,14 +71,23 @@
     GtkToolButton* tool_action1 = GTK_TOOL_BUTTON(gtk_tool_button_new( NULL, "action1" ));
     gtk_toolbar_insert( GTK_TOOLBAR(toolbar), tool_action1, 1 );
 
-    GtkToolButton* tool_action2 = GTK_TOOL_BUTTON(gtk_tool_button_new( NULL, "action2" ));
-    gtk_toolbar_insert( GTK_TOOLBAR(toolbar), tool_action2, 2 );
+    GtkMenu* actionmenu = GTK_MENU(gtk_menu_new());
+    GtkMenuItem* fooitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Foo" ));
+    GtkMenuItem* baritem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Bar" ));
+    gtk_widget_show( GTK_WIDGET(fooitem) );
+    gtk_widget_show( GTK_WIDGET(baritem) );
+    gtk_menu_shell_append( actionmenu, fooitem );
+    gtk_menu_shell_append( actionmenu, baritem );
 
+    GtkMenuToolButton* tool_menu = GTK_MENU_TOOL_BUTTON(gtk_menu_tool_button_new( NULL, "amenu" ));
+    gtk_menu_tool_button_set_menu( tool_menu, actionmenu );
+    gtk_toolbar_insert( GTK_TOOLBAR(toolbar), GTK_TOOL_BUTTON(tool_menu), 2 );
+
     GtkToolButton* tool_action3 = GTK_TOOL_BUTTON(gtk_tool_button_new( NULL, "action3" ));
     gtk_toolbar_insert( GTK_TOOLBAR(toolbar), tool_action3, 3 );
 
     GtkToolButton* tool_action4 = GTK_TOOL_BUTTON(gtk_tool_button_new( NULL, "action4" ));
-     gtk_toolbar_insert( GTK_TOOLBAR(toolbar), tool_action4, 4 );
+    gtk_toolbar_insert( GTK_TOOLBAR(toolbar), tool_action4, 4 );
 
     /* details area */
     GtkButton* detailslist = gtk_button_new_with_label( "Hello Details Area!" );
@@ -186,9 +95,9 @@
 
     /* show everything and run main loop */
     gtk_widget_show_all( GTK_WIDGET(window) );
-    g_debug( "OPENMOKO-PANED-DEMO entering main loop" );
+    g_debug( "openmoko-paned-demo entering main loop" );
     gtk_main();
-    g_debug( "OPENMOKO-PANED-DEMO left main loop" );
+    g_debug( "openmoko-paned-demo left main loop" );
 
     return 0;
 }

Deleted: trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.c
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.c	2006-10-02 08:59:40 UTC (rev 66)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.c	2006-10-02 19:43:19 UTC (rev 67)
@@ -1,85 +0,0 @@
-/*
- *  libmokoui -- OpenMoko Application Framework UI Library
- *
- *  Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
- *
- *  Copyright (C) 2006 First International Computer Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser Public License as published by
- *  the Free Software Foundation; version 2.1 of the license.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-#include "moko-menubar.h"
-
-/* add your signals here */
-enum {
-    MOKO_MENUBAR_SIGNAL,
-    LAST_SIGNAL
-};
-
-static void moko_menubar_class_init          (MokoMenuBarClass *klass);
-static void moko_menubar_init                (MokoMenuBar      *f);
-
-static guint moko_menubar_signals[LAST_SIGNAL] = { 0 };
-
-GType moko_menubar_get_type (void) /* Typechecking */
-{
-    static GType self_type = 0;
-
-    if (!self_type)
-    {
-        static const GTypeInfo f_info =
-        {
-            sizeof (MokoMenuBarClass),
-            NULL, /* base_init */
-            NULL, /* base_finalize */
-            (GClassInitFunc) moko_menubar_class_init,
-            NULL, /* class_finalize */
-            NULL, /* class_data */
-            sizeof (MokoMenuBar),
-            0,
-            (GInstanceInitFunc) moko_menubar_init,
-        };
-
-        /* add the type of your parent class here */
-        self_type = g_type_register_static(GTK_TYPE_MENU_BAR, "MokoMenuBar", &f_info, 0);
-    }
-
-    return self_type;
-}
-
-static void moko_menubar_class_init (MokoMenuBarClass *klass) /* Class Initialization */
-{
-    moko_menubar_signals[MOKO_MENUBAR_SIGNAL] = g_signal_new ("moko_menubar",
-            G_TYPE_FROM_CLASS (klass),
-            G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
-            G_STRUCT_OFFSET (MokoMenuBarClass, moko_menubar),
-            NULL,
-            NULL,
-            g_cclosure_marshal_VOID__VOID,
-            G_TYPE_NONE, 0);
-}
-
-static void moko_menubar_init (MokoMenuBar *f) /* Instance Construction */
-{
-    /* populate your widget here */
-}
-
-GtkWidget* moko_menubar_new() /* Construction */
-{
-    return GTK_WIDGET(g_object_new(moko_menubar_get_type(), NULL));
-}
-
-void moko_menubar_clear(MokoMenuBar *f) /* Destruction */
-{
-    /* destruct your widgets here */
-}
-
-/* add new methods here */

Deleted: trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.h
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.h	2006-10-02 08:59:40 UTC (rev 66)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.h	2006-10-02 19:43:19 UTC (rev 67)
@@ -1,58 +0,0 @@
-/*
- *  libmokoui -- OpenMoko Application Framework UI Library
- *
- *  Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
- *
- *  Copyright (C) 2006 First International Computer Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser Public License as published by
- *  the Free Software Foundation; version 2.1 of the license.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-#ifndef _MOKO_MENUBAR_H_
-#define _MOKO_MENUBAR_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gtk/gtkmenubar.h>
-
-G_BEGIN_DECLS
-
-#define MOKO_TYPE_MENUBAR            (moko_menubar_get_type())
-#define MOKO_MENUBAR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_TYPE_MENUBAR, MokoMenuBar))
-#define MOKO_MENUBAR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_MENUBAR, MokoMenuBarClass))
-#define IS_MOKO_MENUBAR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_TYPE_MENUBAR))
-#define IS_MOKO_MENUBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_MENUBAR))
-
-typedef struct _MokoMenuBar       MokoMenuBar;
-typedef struct _MokoMenuBarClass  MokoMenuBarClass;
-
-struct _MokoMenuBar
-{
-    GtkMenuBar parent;
-    /* add pointers to new members here */
-};
-
-struct _MokoMenuBarClass
-{
-    /* add your parent class here */
-    GtkMenuBarClass parent_class;
-    void (*moko_menubar) (MokoMenuBar *self);
-};
-
-GType          moko_menubar_get_type    (void);
-GtkWidget*     moko_menubar_new         (void);
-void           moko_menubar_clera       (MokoMenuBar *self);
-
-/* add additional methods here */
-
-G_END_DECLS
-
-#endif /* _MOKO_MENUBAR_H_ */

Copied: trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.c (from rev 66, trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.c)
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.c	2006-10-02 08:59:40 UTC (rev 66)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.c	2006-10-02 19:43:19 UTC (rev 67)
@@ -0,0 +1,131 @@
+/*
+ *  libmokoui -- OpenMoko Application Framework UI Library
+ *
+ *  Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+ *
+ *  Copyright (C) 2006 First International Computer Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser Public License as published by
+ *  the Free Software Foundation; version 2.1 of the license.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Lesser Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+#include "moko-menubox.h"
+
+#include <gtk/gtkmenubar.h>
+#include <gtk/gtkmenuitem.h>
+#include <gtk/gtkoptionmenu.h>
+
+#define MOKO_MENU_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MOKO_TYPE_MENUBOX, MokoMenuBoxPriv));
+
+typedef struct _MokoMenuBoxPriv
+{
+    GtkMenuBar* menubar;
+    GtkOptionMenu* optionmenu;
+} MokoMenuBoxPriv;
+
+/* add your signals here */
+enum {
+    MOKO_MENUBOX_SIGNAL,
+    LAST_SIGNAL
+};
+
+static void moko_menubox_class_init          (MokoMenuBoxClass *klass);
+static void moko_menubox_init                (MokoMenuBox      *f);
+
+static guint moko_menubox_signals[LAST_SIGNAL] = { 0 };
+
+GType moko_menubox_get_type (void) /* Typechecking */
+{
+    static GType self_type = 0;
+
+    if (!self_type)
+    {
+        static const GTypeInfo f_info =
+        {
+            sizeof (MokoMenuBoxClass),
+            NULL, /* base_init */
+            NULL, /* base_finalize */
+            (GClassInitFunc) moko_menubox_class_init,
+            NULL, /* class_finalize */
+            NULL, /* class_data */
+            sizeof (MokoMenuBox),
+            0,
+            (GInstanceInitFunc) moko_menubox_init,
+        };
+
+        /* add the type of your parent class here */
+        self_type = g_type_register_static(GTK_TYPE_HBOX, "MokoMenuBox", &f_info, 0);
+    }
+
+    return self_type;
+}
+
+static void moko_menubox_class_init (MokoMenuBoxClass *klass) /* Class Initialization */
+{
+    g_type_class_add_private(klass, sizeof(MokoMenuBoxPriv));
+
+    moko_menubox_signals[MOKO_MENUBOX_SIGNAL] = g_signal_new ("moko_menubox",
+            G_TYPE_FROM_CLASS (klass),
+            G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+            G_STRUCT_OFFSET (MokoMenuBoxClass, moko_menubox),
+            NULL,
+            NULL,
+            g_cclosure_marshal_VOID__VOID,
+            G_TYPE_NONE, 0);
+}
+
+static void moko_menubox_init (MokoMenuBox *self) /* Instance Construction */
+{
+    g_debug( "moko_paned_window_init" );
+    MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
+
+    priv->menubar = NULL;
+    priv->optionmenu = NULL;
+
+}
+
+GtkWidget* moko_menubox_new() /* Construction */
+{
+    return GTK_WIDGET(g_object_new(moko_menubox_get_type(), NULL));
+}
+
+void moko_menubox_clear(MokoMenuBox *f) /* Destruction */
+{
+    /* destruct your widgets here */
+}
+
+void moko_menubox_set_application_menu(MokoMenuBox* self, GtkMenu* menu)
+{
+    g_debug( "moko_menubox_set_application_menu" );
+
+    MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
+    if (!priv->menubar )
+    {
+        priv->menubar = gtk_menu_bar_new();
+        gtk_box_pack_start( GTK_BOX(self), GTK_WIDGET(priv->menubar), FALSE, FALSE, 0 );
+    }
+    GtkMenuItem* appitem = gtk_menu_item_new_with_label( g_get_application_name() );
+    gtk_menu_item_set_submenu( appitem, menu );
+    gtk_menu_shell_append( GTK_MENU_BAR(priv->menubar), appitem );
+}
+
+void moko_menubox_set_filter_menu(MokoMenuBox* self, GtkMenu* menu)
+{
+    g_debug( "moko_menubox_set_filter_menu" );
+
+    MokoMenuBoxPriv* priv = MOKO_MENU_BOX_GET_PRIVATE(self);
+    if (!priv->optionmenu )
+    {
+        priv->optionmenu = gtk_option_menu_new();
+        gtk_box_pack_end( GTK_BOX(self), GTK_WIDGET(priv->optionmenu), FALSE, FALSE, 0 );
+    }
+    gtk_option_menu_set_menu( priv->optionmenu, menu );
+}
+

Copied: trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.h (from rev 66, trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.h)
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-menubar.h	2006-10-02 08:59:40 UTC (rev 66)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-menubox.h	2006-10-02 19:43:19 UTC (rev 67)
@@ -0,0 +1,60 @@
+/*
+ *  libmokoui -- OpenMoko Application Framework UI Library
+ *
+ *  Authored By Michael 'Mickey' Lauer <mlauer at vanille-media.de>
+ *
+ *  Copyright (C) 2006 First International Computer Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser Public License as published by
+ *  the Free Software Foundation; version 2.1 of the license.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Lesser Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+#ifndef _MOKO_MENUBOX_H_
+#define _MOKO_MENUBOX_H_
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtkmenu.h>
+
+G_BEGIN_DECLS
+
+#define MOKO_TYPE_MENUBOX            (moko_menubox_get_type())
+#define MOKO_MENUBOX(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_TYPE_MENUBOX, MokoMenuBox))
+#define MOKO_MENUBOX_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_MENUBOX, MokoMenuBoxClass))
+#define IS_MOKO_MENUBOX(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_TYPE_MENUBOX))
+#define IS_MOKO_MENUBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_MENUBOX))
+
+typedef struct _MokoMenuBox       MokoMenuBox;
+typedef struct _MokoMenuBoxClass  MokoMenuBoxClass;
+
+struct _MokoMenuBox
+{
+    GtkHBox parent;
+    /* add pointers to new members here */
+};
+
+struct _MokoMenuBoxClass
+{
+    /* add your parent class here */
+    GtkHBoxClass parent_class;
+    void (*moko_menubox) (MokoMenuBox *self);
+};
+
+GType          moko_menubox_get_type    (void);
+GtkWidget*     moko_menubox_new         (void);
+void           moko_menubox_clear       (MokoMenuBox *self);
+
+void           moko_menubox_set_application_menu(MokoMenuBox* self, GtkMenu* menu);
+void           moko_menubox_set_filter_menu(MokoMenuBox* self, GtkMenu* menu);
+
+G_END_DECLS
+
+#endif /* _MOKO_MENUBOX_H_ */

Modified: trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.c
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.c	2006-10-02 08:59:40 UTC (rev 66)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.c	2006-10-02 19:43:19 UTC (rev 67)
@@ -17,7 +17,7 @@
  *  Current Version: $Rev$ ($Date$) [$Author$]
  */
 #include "moko-paned-window.h"
-#include "moko-menubar.h"
+#include "moko-menubox.h"
 #include "moko-toolbar.h"
 
 #include <gtk/gtkvbox.h>
@@ -30,7 +30,7 @@
     GtkVPaned* outerframe;
     GtkVBox* upper;
     GtkVBox* lower;
-    MokoMenuBar* menubar;
+    MokoMenuBox* menubox;
     MokoToolBar* toolbar;
 
 } MokoPanedWindowPriv;
@@ -96,7 +96,7 @@
     gtk_paned_add1( GTK_PANED(priv->outerframe), GTK_WIDGET(priv->upper) );
     priv->lower = gtk_vbox_new( FALSE, 0 );
     gtk_paned_add2( GTK_PANED(priv->outerframe), GTK_WIDGET(priv->lower) );
-    priv->menubar = NULL;
+    priv->menubox = NULL;
     priv->toolbar = NULL;
 }
 
@@ -116,16 +116,27 @@
     g_debug( "moko_paned_window_set_application_menu" );
 
     MokoPanedWindowPriv* priv = MOKO_PANED_WINDOW_GET_PRIVATE(self);
-    if (!priv->menubar )
+    if (!priv->menubox )
     {
-        priv->menubar = moko_menubar_new();
-        gtk_box_pack_start( GTK_BOX(priv->upper), GTK_WIDGET(priv->menubar), FALSE, FALSE, 0 );
+        priv->menubox = moko_menubox_new();
+        gtk_box_pack_start( GTK_BOX(priv->upper), GTK_WIDGET(priv->menubox), FALSE, FALSE, 0 );
     }
-    GtkMenuItem* appitem = gtk_menu_item_new_with_label( g_get_application_name() );
-    gtk_menu_item_set_submenu( appitem, menu );
-    gtk_menu_shell_append( GTK_MENU_BAR(priv->menubar), appitem );
+    moko_menubox_set_application_menu( priv->menubox, menu );
 }
 
+void moko_paned_window_set_filter_menu(MokoPanedWindow* self, GtkMenu* menu)
+{
+    g_debug( "moko_paned_window_set_filter_menu" );
+
+    MokoPanedWindowPriv* priv = MOKO_PANED_WINDOW_GET_PRIVATE(self);
+    if (!priv->menubox )
+    {
+        priv->menubox = moko_menubox_new();
+        gtk_box_pack_start( GTK_BOX(priv->upper), GTK_WIDGET(priv->menubox), FALSE, FALSE, 0 );
+    }
+    moko_menubox_set_filter_menu( priv->menubox, menu );
+}
+
 void moko_paned_window_set_upper_pane(MokoPanedWindow* self, GtkWidget* child)
 {
     g_debug( "moko_paned_window_set_upper_pane" );
@@ -149,3 +160,9 @@
     gtk_box_pack_end( GTK_BOX(priv->upper), toolbar, FALSE, FALSE, 0 );
     gtk_box_reorder_child( GTK_BOX(priv->upper), toolbar, 1 );
 }
+
+GtkMenuBar* moko_paned_window_get_menubox(MokoPanedWindow* self)
+{
+    MokoPanedWindowPriv* priv = MOKO_PANED_WINDOW_GET_PRIVATE(self);
+    return priv->menubox;
+}

Modified: trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.h
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.h	2006-10-02 08:59:40 UTC (rev 66)
+++ trunk/src/target/OM-2007/libraries/mokoui/moko-paned-window.h	2006-10-02 19:43:19 UTC (rev 67)
@@ -22,6 +22,7 @@
 #include <glib.h>
 #include <glib-object.h>
 #include <gtk/gtkmenu.h>
+#include <gtk/gtkmenubar.h>
 #include <gtk/gtktoolbar.h>
 #include "moko-window.h"
 
@@ -54,14 +55,15 @@
 void           moko_paned_window_clear           (MokoPanedWindow *self);
 
 /* add additional methods here */
+//TODO: Getters
+
 void moko_paned_window_set_application_menu(MokoPanedWindow* self, GtkMenu* menu);
-//TODO GtkMenu* moko_paned_window_get_application_menu(MokoPanedWindow* self);
+void moko_paned_window_set_filter_menu(MokoPanedWindow* self, GtkMenu* menu);
 
 void moko_paned_window_set_upper_pane(MokoPanedWindow* self, GtkWidget* child);
 void moko_paned_window_set_lower_pane(MokoPanedWindow* self, GtkWidget* child);
 
 void moko_paned_window_add_toolbar(MokoPanedWindow* self, GtkToolbar* toolbar);
-//TODO void moko_paned_window_remove_toolbar(MokoPanedWindow* self, GtkToolbar* toolbar);
 
 G_END_DECLS
 

Modified: trunk/src/target/OM-2007/libraries/mokoui/mokoui.pro
===================================================================
--- trunk/src/target/OM-2007/libraries/mokoui/mokoui.pro	2006-10-02 08:59:40 UTC (rev 66)
+++ trunk/src/target/OM-2007/libraries/mokoui/mokoui.pro	2006-10-02 19:43:19 UTC (rev 67)
@@ -1,8 +1,8 @@
 TEMPLATE = lib
 VERSION = 0.0.1
 
-HEADERS = moko-application.h moko-window.h moko-paned-window.h moko-menubar.h moko-toolbar.h
-SOURCES = moko-application.c moko-window.c moko-paned-window.c moko-menubar.c moko-toolbar.c
+HEADERS = moko-application.h moko-window.h moko-paned-window.h moko-menubox.h moko-toolbar.h
+SOURCES = moko-application.c moko-window.c moko-paned-window.c moko-menubox.c moko-toolbar.c
 
 PKGCONFIG += gtk+-2.0
 





More information about the commitlog mailing list