#include "util.h"
typedef struct _ChimaraBrowserPrivate {
- int dummy;
+ GtkActionGroup *action_group;
} ChimaraBrowserPrivate;
#define CHIMARA_BROWSER_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), CHIMARA_TYPE_BROWSER, ChimaraBrowserPrivate))
static void
chimara_browser_finalize(GObject *self)
{
+ CHIMARA_BROWSER_USE_PRIVATE;
+ g_object_unref(priv->action_group);
+
/* Chain up */
G_OBJECT_CLASS(chimara_browser_parent_class)->finalize(self);
}
static void
chimara_browser_init(ChimaraBrowser *self)
{
+ CHIMARA_BROWSER_USE_PRIVATE;
ChimaraApp *theapp = chimara_app_get();
/* Set own properties */
"title", _("Chimara"),
NULL);
+ /* Build user interface */
+ char *object_ids[] = {
+ "browser_group",
+ NULL
+ };
+ GtkBuilder *builder = new_builder_with_objects(object_ids);
+
+ priv->action_group = GTK_ACTION_GROUP(load_object(builder, "browser_group"));
+ g_object_ref(priv->action_group);
+
GtkUIManager *uimanager = new_ui_manager("browser.menus");
- gtk_ui_manager_insert_action_group(uimanager, chimara_app_get_action_group(theapp), 0);
+ gtk_ui_manager_insert_action_group(uimanager, priv->action_group, 0);
+ gtk_ui_manager_insert_action_group(uimanager, chimara_app_get_action_group(theapp), 1);
GtkWidget *menubar = gtk_ui_manager_get_widget(uimanager, "/browser_menu");
- gtk_container_add(GTK_CONTAINER(self), menubar);
+ GtkWidget *toolbar = gtk_ui_manager_get_widget(uimanager, "/browser_toolbar");
+ GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(self), vbox);
+ gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
g_signal_connect(self, "delete-event", G_CALLBACK(on_browser_delete_event), NULL);
+
+ g_object_unref(uimanager);
+ g_object_unref(builder);
}
/* PUBLIC FUNCTIONS */
+
GtkWidget *
chimara_browser_new(void)
{
NULL));
}
+/* GLADE CALLBACKS */
+
+void
+action_add_file(GtkAction *action, ChimaraBrowser *browser)
+{
+}
+
+void
+action_add_watched_folder(GtkAction *action, ChimaraBrowser *browser)
+{
+}
+
+void
+action_remove_file(GtkAction *action, ChimaraBrowser *browser)
+{
+}
+
+void
+action_play(GtkAction *action, ChimaraBrowser *browser)
+{
+}
+
+void
+action_more_info(GtkAction *action, ChimaraBrowser *browser)
+{
+}
<ui>
<menubar name="browser_menu">
<menu action="game">
+ <menuitem action="play"/>
+ <menuitem action="more_info"/>
+ <separator/>
<menuitem action="open"/>
<menuitem action="recent"/>
<separator/>
<menu action="edit">
<menuitem action="preferences"/>
</menu>
+ <menu action="library">
+ <menuitem action="add_file"/>
+ <menuitem action="add_watched_folder"/>
+ <menuitem action="remove_file"/>
+ </menu>
<menu action="help">
<menuitem action="about"/>
</menu>
</menubar>
+ <toolbar name="browser_toolbar">
+ <toolitem action="add_file"/>
+ <toolitem action="remove_file"/>
+ <separator/>
+ <toolitem action="play"/>
+ <toolitem action="more_info"/>
+ </toolbar>
</ui>
<property name="label">_Open...</property>
<property name="short_label">_Open</property>
<property name="tooltip">Quit the current game and load a new one</property>
- <property name="stock_id">gtk-media-play</property>
+ <property name="stock_id">gtk-open</property>
<signal name="activate" handler="on_open_activate" swapped="no"/>
</object>
<accelerator key="o" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
</object>
+ <object class="GtkActionGroup" id="browser_group">
+ <child>
+ <object class="GtkAction" id="add_file">
+ <property name="label" translatable="yes">_Add file to library...</property>
+ <property name="short_label" translatable="yes">Add</property>
+ <property name="tooltip" translatable="yes">Add a single game file to your library</property>
+ <property name="stock_id">gtk-add</property>
+ <signal name="activate" handler="action_add_file" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkAction" id="add_watched_folder">
+ <property name="label" translatable="yes">Add watched _folder to library...</property>
+ <property name="short_label" translatable="yes">Add folder</property>
+ <property name="tooltip" translatable="yes">Add all the game files in a folder to your library, and keep monitoring the folder to see if any game files are added to it in the future</property>
+ <property name="stock_id">gtk-directory</property>
+ <signal name="activate" handler="action_add_watched_folder" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkAction" id="play">
+ <property name="label" translatable="yes">_Play</property>
+ <property name="short_label" translatable="yes">Play</property>
+ <property name="tooltip" translatable="yes">Play the game</property>
+ <property name="stock_id">gtk-media-play</property>
+ <signal name="activate" handler="action_play" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkAction" id="more_info">
+ <property name="label" translatable="yes">More _information...</property>
+ <property name="short_label" translatable="yes">Info</property>
+ <property name="tooltip" translatable="yes">View information about this game</property>
+ <property name="stock_id">gtk-info</property>
+ <signal name="activate" handler="action_more_info" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkAction" id="remove_file">
+ <property name="label" translatable="yes">_Remove file</property>
+ <property name="short_label" translatable="yes">Remove</property>
+ <property name="tooltip" translatable="yes">Remove this game file from your library</property>
+ <property name="stock_id">gtk-remove</property>
+ <signal name="activate" handler="action_remove_file" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkAction" id="library">
+ <property name="label" translatable="yes">_Library</property>
+ </object>
+ </child>
+ </object>
<object class="GtkAboutDialog" id="aboutwindow">
<property name="can_focus">False</property>
<property name="border_width">5</property>