#include <config.h>
#include <libchimara/chimara-if.h>
#include "app.h"
+#include "browser.h"
#include "error.h"
#include "preferences.h"
#include "player.h"
if(G_UNLIKELY(theapp == NULL)) {
theapp = CHIMARA_APP(g_object_new(CHIMARA_TYPE_APP, NULL));
- /* Create preferences window */
+ /* Create one-per-application windows */
theapp->prefswindow = chimara_prefs_new();
+ theapp->browser_window = chimara_browser_new();
}
return theapp;
#include <glib-object.h>
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "browser.h"
+#include "app.h"
+#include "error.h"
typedef struct _ChimaraBrowserPrivate {
int dummy;
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 = gtk_ui_manager_new();
+ if( !gtk_ui_manager_add_ui_from_file(uimanager, PACKAGE_DATA_DIR "/chimara.menus", &error) ) {
+#ifdef DEBUG
+ g_error_free(error);
+ error = NULL;
+ if( !gtk_ui_manager_add_ui_from_file(uimanager, PACKAGE_SRC_DIR "/chimara.menus", &error) ) {
+#endif /* DEBUG */
+ error_dialog(NULL, error, "Error while building interface: ");
+ return;
+#ifdef DEBUG
+ }
+#endif /* DEBUG */
+ }
+
+ 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));
}
ChimaraApp *theapp = chimara_app_get();
- GtkWidget *window = chimara_player_new();
- gtk_widget_show_all(window);
-
//if(argc == 3) {
// g_object_set(glk, "graphics-file", argv[2], NULL);
//}
// }
//}
+ gtk_widget_show_all(theapp->browser_window);
+
gdk_threads_enter();
gtk_main();
gdk_threads_leave();