Ejemplo n.º 1
0
int main(int argc, char *argv[])
{
    bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALEDIR);
    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
    textdomain (GETTEXT_PACKAGE);
    
    g_set_application_name (_("Gtranscoder"));

    GtranscoderOptions *options = g_new0(GtranscoderOptions, 1);;
    GOptionEntry entries[] =
    {
        { "verbose", 'v', 0, G_OPTION_ARG_NONE, &options->verbose, N_("Print debug info"), NULL },
        { "version", 'V', 0, G_OPTION_ARG_NONE, &options->show_version, N_("Show version number and exit"), NULL },
        { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, 0 }
    };

    GError *error = NULL;
    GOptionContext *context;
  
    context = g_option_context_new(N_("- Movie transcoding program"));
    g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE);
    g_option_context_add_group (context, gtk_get_option_group (TRUE));
    if (g_option_context_parse(context, &argc, &argv, &error) == FALSE)
    {
        gchar *help_text = g_option_context_get_help (context, TRUE, NULL);
        g_print ("%s\n\n%s", error->message, help_text);
        g_free (help_text);
        g_error_free (error);
        g_option_context_free (context);
        g_free(options);
        return 1;
    }
    if (options->show_version)
    {
        g_print("Gtranscoder " VERSION " \n");
        return 0;
    }

    g_option_context_free (context);
    gtk_init(&argc, &argv);
    
    gboolean has_ffmpeg = check_for_ffmpeg();
    if (! has_ffmpeg)
    {
        gchar *error_mess = N_("Gtranscoder could not find the ffmpeg executable. Aborting.");
        g_critical("%s", error_mess);
        gtranscoder_show_error_dialog_without_main_loop(error_mess);
        g_error("%s", N_("ffmpeg is required."));
        return 1;
    }
    else
    {
        g_debug("%s", N_("Found ffmpeg"));
        run_main_window(options);
        gtk_main();
    }
    g_free(options);
    return 0;
}
Ejemplo n.º 2
0
void
fe_init (void)
{
    GConfClient *client;

    client = gconf_client_get_default ();
    gconf_client_add_dir (client, "/apps/xchat", GCONF_CLIENT_PRELOAD_NONE, NULL);
    g_object_unref (client);

    u = userlist_new ();
    gui.quit = FALSE;
    palette_init ();
    run_migrations ();
    initialize_gui_1 ();
    if (!preferences_exist ()) {
        run_setup_dialog ();
    } else {
        set_version ();
    }
    servlist_init ();
    initialize_gui_2 ();
    load_preferences ();
    run_main_window (opt_fullscreen);

    /* Force various window-related options to match our interaction model */
    prefs.use_server_tab = TRUE;
    prefs.notices_tabs = FALSE;
    prefs.servernotice = TRUE;
    prefs.slist_skip = FALSE;

    /* If we don't have a specific DCC IP address, force get-from-server */
    if (strlen (prefs.dcc_ip_str) == 0) {
        prefs.ip_from_server = TRUE;
    }

    /* Don't allow the core to autoload plugins. We use our own
     * method for autoloading.
     */
    arg_skip_plugins = 1;

    if (not_autoconnect ()) {
        ConnectDialog *cd;

        cd = connect_dialog_new ();
        gtk_widget_show_all (GTK_WIDGET (cd));
    }

#ifdef USE_PLUGIN
    plugins_initialize ();
#endif
}