Example #1
0
/**
 * gva_main_analyze_roms:
 * @error: return location for a #GError, or %NULL
 *
 * Executes the lengthy process of analyzing all available ROM and sample
 * sets for correctness and then updating the games database with the new
 * status information.  The function updates the main window's progress bar
 * to help track the analysis.  The function is synchronous; it blocks until
 * the analysis is complete or aborted.
 *
 * Returns: %TRUE if the analysis completed successfully,
 *          %FALSE if the analysis failed or was aborted
 **/
gboolean
gva_main_analyze_roms (GError **error)
{
        GvaProcess *process;
        GvaProcess *process2 = NULL;
        guint context_id;
        gboolean main_loop_quit = FALSE;
        gboolean success = FALSE;
        guint timeout_id = 0;

        context_id = gva_main_statusbar_get_context_id (G_STRFUNC);

        process = gva_audit_roms (error);
        if (process == NULL)
                goto exit;

        process2 = gva_audit_samples (error);
        if (process2 == NULL)
                goto exit;

        gva_main_progress_bar_show ();
        gva_main_progress_bar_set_fraction (0.0);
        gva_main_statusbar_push (context_id, _("Analyzing ROM filesā€¦"));

        timeout_id = g_timeout_add (
                PROGRESS_BAR_PULSE_INTERVAL_MS,
                main_progress_bar_pulse_cb,
                GVA_WIDGET_MAIN_PROGRESS_BAR);

        while (!gva_process_has_exited (process, NULL))
                main_loop_quit = gtk_main_iteration ();

        if (main_loop_quit)
                goto exit;

        while (!gva_process_has_exited (process2, NULL))
                main_loop_quit = gtk_main_iteration ();

        if (main_loop_quit)
                goto exit;

        success = TRUE;

        gva_main_statusbar_pop (context_id);
        gva_main_progress_bar_hide ();

exit:
        if (timeout_id > 0)
                g_source_remove (timeout_id);

        if (process != NULL)
                g_object_unref (process);

        if (process2 != NULL)
                g_object_unref (process2);

        return success;
}
Example #2
0
/**
 * gva_main_analyze_roms:
 * @error: return location for a #GError, or %NULL
 *
 * Executes the lengthy process of analyzing all available ROM and sample
 * sets for correctness and then updating the games database with the new
 * status information.  The function updates the main window's progress bar
 * to help track the analysis.  The function is synchronous; it blocks until
 * the analysis is complete or aborted.
 *
 * Returns: %TRUE if the analysis completed successfully,
 *          %FALSE if the analysis failed or was aborted
 **/
gboolean
gva_main_analyze_roms (GError **error)
{
        GvaProcess *process;
        GvaProcess *process2 = NULL;
        guint context_id;
        guint total_supported;
        gboolean main_loop_quit = FALSE;
        gboolean success = FALSE;

        context_id = gva_main_statusbar_get_context_id (G_STRFUNC);
        total_supported = gva_mame_get_total_supported (NULL);

        process = gva_audit_roms (error);
        if (process == NULL)
                goto exit;

        process2 = gva_audit_samples (error);
        if (process2 == NULL)
                goto exit;

        gva_main_statusbar_push (context_id, _("Analyzing ROM files..."));

        g_signal_connect (
                process, "notify::progress",
                G_CALLBACK (main_build_database_progress_cb),
                GUINT_TO_POINTER (total_supported));

        while (!gva_process_has_exited (process, NULL))
                main_loop_quit = gtk_main_iteration ();

        if (main_loop_quit)
                goto exit;

        while (!gva_process_has_exited (process2, NULL))
                main_loop_quit = gtk_main_iteration ();

        if (main_loop_quit)
                goto exit;

        success = TRUE;

        gva_main_statusbar_pop (context_id);

exit:
        if (process != NULL)
                g_object_unref (process);

        if (process2 != NULL)
                g_object_unref (process2);

        return success;
}
Example #3
0
/**
 * gva_main_build_database:
 * @error: return location for a #GError, or %NULL
 *
 * Executes the lengthy process of constructing the games database.
 * The function updates the main window's progress bar to help track
 * the database construction.  The function is synchronous; it blocks
 * until database construction is complete or aborted.
 *
 * Returns: %TRUE if the database construction was successful,
 *          %FALSE if construction failed or was aborted
 **/
gboolean
gva_main_build_database (GError **error)
{
        GvaProcess *process;
        guint context_id;
        guint total_supported;
        gboolean main_loop_quit = FALSE;
        gboolean success = FALSE;

        /* XXX Comment this code! */

        context_id = gva_main_statusbar_get_context_id (G_STRFUNC);
        total_supported = gva_mame_get_total_supported (NULL);

        process = gva_db_build (error);
        if (process == NULL)
                goto exit;

        gva_main_progress_bar_show ();
        gva_main_progress_bar_set_fraction (0.0);
        gva_main_statusbar_push (context_id, _("Building game databaseā€¦"));

        g_signal_connect (
                process, "notify::progress",
                G_CALLBACK (main_build_database_progress_cb),
                GUINT_TO_POINTER (total_supported));

        while (!gva_process_has_exited (process, NULL))
                main_loop_quit = gtk_main_iteration ();

        if (main_loop_quit)
                goto exit;

        success = TRUE;

        gva_main_statusbar_pop (context_id);
        gva_main_progress_bar_hide ();

exit:
        if (process != NULL)
                g_object_unref (process);

        return success;
}
Example #4
0
/**
 * gva_main_connect_proxy_cb:
 * @manager: a #GtkUIManager
 * @action: a #GtkAction
 * @proxy: a #GtkWidget
 *
 * Callback for @manager's "%connect-proxy" signal.  The function configures
 * main menu items to display the appropriate tooltip in the status bar when
 * the mouse hovers over them.  @action supplies the tooltip.
 **/
void
gva_main_connect_proxy_cb (GtkUIManager *manager,
                           GtkAction *action,
                           GtkWidget *proxy)
{
        /* Show GtkMenuItem tooltips in the statusbar. */
        if (GTK_IS_MENU_ITEM (proxy))
        {
                g_signal_connect (
                        proxy, "select",
                        G_CALLBACK (main_menu_item_select_cb), action);
                g_signal_connect (
                        proxy, "deselect",
                        G_CALLBACK (main_menu_item_deselect_cb), NULL);

                menu_tooltip_cid =
                        gva_main_statusbar_get_context_id (G_STRFUNC);
        }
}