Avoid duplicating code
[projects/chimara/chimara.git] / player / browser.c
index 8dfadf401184620bb2ce31c43dacddc863dae5e6..9be256afbf8cced3681c957ba3865c70d256517f 100644 (file)
@@ -1,6 +1,9 @@
 #include <glib-object.h>
+#include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include "browser.h"
+#include "app.h"
+#include "util.h"
 
 typedef struct _ChimaraBrowserPrivate {
        int dummy;
@@ -38,12 +41,27 @@ chimara_browser_class_init(ChimaraBrowserClass *klass)
 static void
 chimara_browser_init(ChimaraBrowser *self)
 {
+       ChimaraApp *theapp = chimara_app_get();
+       GError *error = NULL;
+
+       /* Set own properties */
+       g_object_set(self,
+               "title", _("Chimara"),
+               NULL);
+
+       GtkUIManager *uimanager = new_ui_manager("browser.menus");
+
+       gtk_ui_manager_insert_action_group(uimanager, chimara_app_get_action_group(theapp), 0);
+       GtkWidget *menubar = gtk_ui_manager_get_widget(uimanager, "/browser_menu");
+       gtk_container_add(GTK_CONTAINER(self), menubar);
 }
 
 /* PUBLIC FUNCTIONS */
-ChimaraBrowser *
+GtkWidget *
 chimara_browser_new(void)
 {
-       return CHIMARA_BROWSER(g_object_new(CHIMARA_TYPE_BROWSER, NULL));
+       return GTK_WIDGET(g_object_new(CHIMARA_TYPE_BROWSER,
+               "type", GTK_WINDOW_TOPLEVEL,
+               NULL));
 }