예제 #1
0
/**
 * gva_main_init:
 *
 * Initializes the main window.
 *
 * This function should be called once when the application starts.
 **/
void
gva_main_init (void)
{
        GSettings *settings;
        gchar *text;

        settings = gva_get_settings ();

        gva_tree_view_init ();

        gtk_box_pack_start (
                GTK_BOX (GVA_WIDGET_MAIN_VBOX),
                gva_ui_get_managed_widget ("/main-menu"),
                FALSE, FALSE, 0);

        gtk_box_reorder_child (
                GTK_BOX (GVA_WIDGET_MAIN_VBOX),
                gva_ui_get_managed_widget ("/main-menu"), 0);

        gtk_widget_set_sensitive (
                GVA_WIDGET_MAIN_MUTE_BUTTON,
                gva_mame_supports_sound ());

        g_settings_bind (
                settings, GVA_SETTING_SOUND_MUTED,
                GVA_WIDGET_MAIN_MUTE_BUTTON, "muted",
                G_SETTINGS_BIND_DEFAULT);

        gtk_window_move (
                GTK_WINDOW (GVA_WIDGET_MAIN_WINDOW),
                g_settings_get_int (settings, "window-x"),
                g_settings_get_int (settings, "window-y"));

        gtk_window_resize (
                GTK_WINDOW (GVA_WIDGET_MAIN_WINDOW),
                g_settings_get_int (settings, "window-width"),
                g_settings_get_int (settings, "window-height"));

        if (g_settings_get_boolean (settings, "window-maximized"))
                gtk_window_maximize (GTK_WINDOW (GVA_WIDGET_MAIN_WINDOW));

        /* Initialize the search entry. */
        text = gva_main_get_last_search_text ();
        gtk_entry_set_text (GTK_ENTRY (GVA_WIDGET_MAIN_SEARCH_ENTRY), text);
        g_free (text);

        gva_ui_lock ();

        gtk_action_set_visible (GVA_ACTION_INSERT_FAVORITE, FALSE);
        gtk_action_set_visible (GVA_ACTION_REMOVE_FAVORITE, FALSE);

        gtk_window_present (GTK_WINDOW (GVA_WIDGET_MAIN_WINDOW));
}
예제 #2
0
/**
 * gva_main_init:
 *
 * Initializes the main window.
 *
 * This function should be called once when the application starts.
 **/
void
gva_main_init (void)
{
        gchar *text;

        gva_tree_view_init ();

        gtk_box_pack_start (
                GTK_BOX (GVA_WIDGET_MAIN_VBOX),
                gva_ui_get_managed_widget ("/main-menu"),
                FALSE, FALSE, 0);

        gtk_action_connect_proxy (
                GVA_ACTION_VIEW_AVAILABLE,
                GVA_WIDGET_MAIN_VIEW_BUTTON_0);

        gtk_action_connect_proxy (
                GVA_ACTION_VIEW_FAVORITES,
                GVA_WIDGET_MAIN_VIEW_BUTTON_1);

        gtk_action_connect_proxy (
                GVA_ACTION_VIEW_RESULTS,
                GVA_WIDGET_MAIN_VIEW_BUTTON_2);

        gtk_action_connect_proxy (
                GVA_ACTION_PROPERTIES,
                GVA_WIDGET_MAIN_PROPERTIES_BUTTON);

        gtk_action_connect_proxy (
                GVA_ACTION_START,
                GVA_WIDGET_MAIN_START_GAME_BUTTON);

        gtk_widget_set_sensitive (
                GVA_WIDGET_MAIN_MUTE_BUTTON,
                gva_mame_supports_sound ());

        gconf_bridge_bind_property (
                gconf_bridge_get (), GVA_GCONF_SOUND_MUTED,
                G_OBJECT (GVA_WIDGET_MAIN_MUTE_BUTTON), "muted");

        gconf_bridge_bind_window (
                gconf_bridge_get (), GVA_GCONF_WINDOW_PREFIX,
                GTK_WINDOW (GVA_WIDGET_MAIN_WINDOW), TRUE, FALSE);

        /* Initialize the search entry. */
        text = gva_main_get_last_search_text ();
        gtk_entry_set_text (GTK_ENTRY (GVA_WIDGET_MAIN_SEARCH_ENTRY), text);
        g_free (text);

#if !GTK_CHECK_VERSION(2,14,0) && !defined WITH_GNOME
        /* Requires that we link against libgnome. */
        gtk_action_set_sensitive (GVA_ACTION_CONTENTS, FALSE);
#endif

        gtk_action_set_sensitive (GVA_ACTION_PROPERTIES, FALSE);
        gtk_action_set_sensitive (GVA_ACTION_RECORD, FALSE);
        gtk_action_set_sensitive (GVA_ACTION_SEARCH, FALSE);
        gtk_action_set_sensitive (GVA_ACTION_SHOW_CLONES, FALSE);
        gtk_action_set_sensitive (GVA_ACTION_START, FALSE);
        gtk_action_set_sensitive (GVA_ACTION_VIEW_AVAILABLE, FALSE);
        gtk_action_set_sensitive (GVA_ACTION_VIEW_FAVORITES, FALSE);
        gtk_action_set_sensitive (GVA_ACTION_VIEW_RESULTS, FALSE);

        gtk_action_set_visible (GVA_ACTION_INSERT_FAVORITE, FALSE);
        gtk_action_set_visible (GVA_ACTION_REMOVE_FAVORITE, FALSE);

        gtk_window_present (GTK_WINDOW (GVA_WIDGET_MAIN_WINDOW));
}